Skip to content

feat(github): accept operator policy from Landing YAML - #82

Open
PsiACE wants to merge 15 commits into
mainfrom
feat/repository-config
Open

PsiACE wants to merge 15 commits into
mainfrom
feat/repository-config

Conversation

@PsiACE

@PsiACE PsiACE commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Purpose

Let the GitHub Action read operator policy from Landing YAML, and move this repository's static workflow policy there. The allow-list is command_prefix, trust, upstream_workflow, bump_on_failure, dependency_update_actors, and check. Task inputs, native identity, event context, and credentials stay with the invocation.

Policy inputs in the bundled Action declare empty defaults, so an omitted with: entry falls through to Landing YAML and then the released default instead of being shadowed by a duplicated default in the Action. An explicit non-empty value, including false, still wins. This fixes trust: owner resolving to repository on the hosted path.

Shared workflow policy

.github/landing.yml is the single static policy file for both repository workflows, loaded through LANDING_CONFIG:

  • model_timeout_seconds: 120 replaces three workflow environment assignments.
  • bump_on_failure: true replaces a || 'true' default in the workflow expression. The step now passes the variable alone, so an explicit false still overrides the file.
  • dependency_update_actors holds the static dependabot[bot]/renovate[bot] base. The additive dependency-update-actor-additions input lets a run union identities it only learns at runtime, such as the authenticated publisher, without replacing the base. dependency-update-actors keeps replacement semantics; blank or whitespace-only additions add nothing.
  • modes.{gatekeeper,issuer,bumper}.instructions hold the static review, triage, and dependency-maintenance policy that used to live in workflow instruction: text. The system prompt already appends mode instructions after the mode skill, so methods are not replaced. Workflow instructions now carry only event evidence: native check results, selected scope, and release conclusion.

LANDING_COMPLETION_ARGS no longer carries a redundant || '{}', because completion_args already defaults to {}.

Safety properties

  • A job that checks out a pull request candidate reads .github/landing.yml from the base commit into the runner temp directory and points LANDING_CONFIG there, so candidate files cannot supply privileged policy. A job that checks out the default branch reads the checked-in file directly.
  • A release listener and a failed-candidate listener keep separate upstream-workflow values. They are distinct admission boundaries, so they are never combined into one allow-list, and the release step passes bump-on-failure: false explicitly so shared duty policy cannot widen it.
  • Secrets stay in Action step environment; LANDING_API_KEY is not job-wide. No provider values are written into YAML.
  • Everything else stays native: command routing, triggers, permissions, job and step if:, concurrency, checkout, artifact upload, tool setup, Git identity defaults consumed before Landing runs, and the job-level vars.LANDING_BUMP_ON_FAILURE != 'false' gate, which cannot read YAML.

Documentation

The public README is a short entry point: purpose, a minimal CLI quick start, one Action snippet, supported entry points, configuration pointers, limits, and links. The site landing page is a task-oriented index. Reference pages stay canonical and carry the replacement-versus-additive actor contract and the per-step workflow_run boundary.

Two corrections in this pass:

  • The trusted-policy example now includes a full-depth checkout and a miss guard. A shallow pull request checkout normally lacks the base commit, so the lookup fails; the guard keeps the runner's bash -eo pipefail shell from aborting, removes the empty file, emits a warning, and leaves LANDING_CONFIG unset so the documented defaults apply. This covers both a present base file and one that predates the file.
  • The entry-point summary now qualifies required checks as applying to fix, review, and bump rather than explain or triage.

Verification

Documentation-only changes; action.yml, .github/, src/, tests/, and pyproject.toml are unchanged, so the earlier functional results still apply.

Executed in this pass, exit code checked directly:

  • uv run zensical build -s — no issues (exit 0), including the generated API schema export.
  • uv run ruff check . and uv run ruff format --check . — clean (exit 0).
  • Link/anchor, fenced YAML parse, trailing-whitespace, and trailing-newline scans over README and docs/ — no problems.
  • The documented trusted-policy snippet, run verbatim under bash -eo pipefail against an offline fixture: with the base file present it copies the trusted content and exports LANDING_CONFIG; with the file absent, or with a shallow checkout, it emits the warning, leaves no policy file, and does not export LANDING_CONFIG. All cases exit 0. The pre-fix form fails these cases with exit 128 and a zero-byte file.

Not verified: a live hosted Action, provider, or model run; no CI rerun. These checks do not establish end-to-end delivery. The branch is unmerged.

The GitHub runner read operator policy only from Action inputs and CLI
options, so a local or hosted operator had to repeat the same trust scope,
command prefix, upstream workflows, dependency accounts, bump flag, and
checks on every invocation.

`GitHubSettings` now extends a restricted policy source: the already-loaded
Landing YAML may set those names, while task inputs, caller identity, event
context, run identity, delivery keys, and the database stay with the
invocation. Priority is explicit options, `INPUT_*`, YAML, then defaults;
a missing file preserves the previous behavior. The CLI loads execution
settings before constructing the event options so the existing YAML data
covers both.

This first commit keeps the same CLI, Action, and runner path and documents
the admitted names.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings: the added precedence test fails under GitHub Actions, and the documented YAML policy does not reach the hosted Action for four of the six names.

Comment thread tests/test_github.py Resolved
Comment thread docs/reference/configuration.md Resolved
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Landing: allow · 1ace89e

No blocking findings; the new candidate commit only tightens the trusted-policy recipe, and the added guidance matches both GITHUB_ENV semantics and the repository's own feedback job, which carries no inherited LANDING_CONFIG.

The composite Action declared released defaults for `trust`,
`command-prefix`, `bump-on-failure`, and `dependency-update-actors`, and its
step maps every input to `INPUT_*`. GitHub fills those defaults, so a hosted
run always exported non-empty values that outranked the new YAML layer: a
documented `trust: owner` resolved to `repository` and admitted write
collaborators.

Those four inputs now default to empty and keep the previous value in their
description. The CLI already supplies the identical released defaults, so an
omitted input defers to Landing YAML and then to the default, while an
explicit workflow value, including `false` or a concrete actor list, still
wins. Task inputs keep their non-empty or dynamic defaults.

The regression tests read the shipped action.yml, export its declared
defaults exactly as the composite step does, and assert YAML policy applies,
explicit overrides win, and a missing file keeps released behavior. A hosted
`trust: owner` run now skips a write collaborator and admits the owner. A
metadata check keeps every declared input mapped.
Duty's two Action steps repeated the same model, endpoint, completion, and
timeout environment, so a model or endpoint change meant editing both and
could drift. The job now sets that static, non-secret environment once and
the steps carry only their differing policy.

The duty steps also take `trust` from the one repository variable through the
Action's now-empty default instead of restating `repository`. Main keeps its
step-scoped environment and drops `run-id` and `checked-revision`, which the
Action already derives from the native run and `github.sha`.

Distinct upstream workflow allow-lists stay separate. Task inputs, secrets,
checkout refs, concurrency, and token boundaries are unchanged.
The GitHub runner section stated the Action's empty policy defaults twice, in
the precedence paragraph and again under the example. Keep the statement next
to the example that relies on it so a later default change has one place to
update.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One documentation finding, inline: the new trusted-revision recipe fails when copied into a workflow.

Comment thread docs/reference/configuration.md Outdated
run: |
mkdir -p "$RUNNER_TEMP/policy"
policy="$RUNNER_TEMP/policy/landing.yml"
git show "$POLICY_REVISION:.github/landing.yml" > "$policy"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recipe fails as written. actions/checkout defaults to fetch-depth: 1, so on a pull_request event the base commit object is not fetched (the default checkout fetches refs/pull/N/merge at depth 1). git show "$POLICY_REVISION:.github/landing.yml" then exits 128, and under the runner's default bash -eo pipefail shell the preparation step fails before LANDING_CONFIG is written, so the job stops before the Action runs. The same abort happens when the base revision predates the file, which the next paragraph asks readers to fall back from gracefully.

Reproduced on the fetch shape actions/checkout uses: git init + git fetch --depth 1 origin refs/pull/1/merge, then the snippet verbatim gives fatal: could not get object info for the base commit and exit 128; the same snippet against a full-history clone of that repository exits 0. A base revision without the file gives fatal: path '.github/landing.yml' exists on disk, but not in '<sha>', also exit 128.

Add fetch-depth: 0 to the checkout in the example, and guard the miss the way the repository's own feedback job does: write the file only when git show succeeds, otherwise remove it, emit a warning, and skip the LANDING_CONFIG export so the documented defaults apply.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at b31c622: the snippet now sets fetch-depth: 0 and guards the lookup. Replayed verbatim under bash -eo pipefail against a fixture repo whose refs/pull/1/merge was fetched the way actions/checkout fetches it: with full history the git show from github.event.pull_request.base.sha succeeds and the step writes LANDING_CONFIG to GITHUB_ENV; with a depth-1 fetch, and with a base revision that predates the file, the if takes the else branch, rm -f removes the truncated file, LANDING_CONFIG stays unset and the step exits 0. Unset is also safe here, since the CLI default is ~/.landing/config.yml, so no candidate-controlled file is read.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant