Skip to content

The deploy contract's production ref gate can only be verified by tripping it, and the agent that owns the pipeline is denied the dispatch #567

Closed

Description

@ptr727

Raised from ptr727/Blog#33, the deploy transport retest. Three of that issue's four checks were agent-runnable and one was not, and the one that was not is the check protecting production.

What happened

The deploy contract added in #558 guarantees a ref gate: a production deploy is refused unless the dispatched ref is refs/heads/main. The only way to show a gate fails closed is to trip it, so the verification is one workflow_dispatch of the production environment from a non-default branch, expecting the run to fail at the gate job.

The agent could not run it. The Claude Code auto-mode permission classifier denied the call, with Blocked by classifier:

gh workflow run deploy-site.yml --ref develop -f environment=production

Conversational authorization did not lift it. The maintainer authorized the dispatch explicitly, in the session, and the identical call was denied again on the next attempt. The denial text names the remedy: a Bash permission rule in settings. The maintainer ran the command himself instead, and the gate then verified correctly — assert-ref failed with Deploy production from main; got refs/heads/develop., validate and deploy both skipped, and zero deployments recorded against the production environment.

Diagnostics, so the cause is not guessed at

Measured in the same session, against the same workflow file and the same ref:

Call Outcome
gh workflow run deploy-site.yml --ref develop -f environment=staging allowed, ran to a green deploy
gh workflow run deploy-site.yml --ref develop -f environment=production denied, twice, including once bare
echo gh workflow run deploy-site.yml --ref develop -f environment=production allowed, printed the string

So it is not the subcommand, not the ref, not command compounding, and not substring matching on the word — the identical text inside a harmless command passed. The classifier is judging the action: dispatching a deploy to a production environment. That is a defensible judgment and this issue does not ask for it to be relaxed. It asks the contract to account for it.

A second call in the same session was denied the same way: an outbound ssh from the agent's host to the deploy host, carrying the pinned transport options, to exercise the far-end forced command by hand. Also defensible, also unannounced by any contract.

Why this is a contract problem and not a tooling annoyance

The gate is the one control standing between a mis-dispatch and the public site. Its failure mode is silent: a gate that fails open looks exactly like a gate that was never tripped, and the run history of a correctly-behaving gate is empty. So "we never saw it fail" is not evidence, and the verification is not optional.

What the contract currently produces is the worst arrangement of that: the check is required, the agent that owns the deploy pipeline cannot perform it, and nothing says so. The predictable outcomes are an agent that quietly drops the check and reports the deploy verified, or an agent that reshapes the denied call into a raw gh api -X POST .../dispatches to get around the classifier — which is a mutation fired as a workaround, exactly what the global write-safety rules forbid. The denial is the mechanism working; the missing piece is a documented route that does not invite one of those two.

What I think it needs

The maintainer's call, and one hub owner may reasonably pick differently:

  1. Name the ref-gate verification as a maintainer step in the deploy contract, with the evidence to capture, since the evidence is the whole point: the gate job's conclusion and its error text, the downstream jobs skipped rather than passed, and the deployment count against the production environment unchanged. An agent can prepare the command and verify all four afterwards; it cannot fire it.
  2. State in the agent runbook that a classifier denial is not lifted by conversational authorization, and that the routes are a settings allow-rule or the human running the command. Without this an agent re-tries the same call, reads the second denial as a flake, and starts looking for another shape of the same request.
  3. Say plainly that a denied write is never re-attempted through a different API surface. This is already the rule for probes and for fabricated ids; it is not currently written down for the specific case of "the harness said no", which is where the temptation is highest because the agent believes it has permission.

Worth deciding whether the same treatment covers agent-initiated outbound SSH to a deploy host, which failed the same way and is the other half of proving a transport that now fails closed.

Evidence

ptr727/Blog, all public:

  • Staging deploy with the new transport options, agent-dispatched, green: run 31018236212, release 20260805-150321, 1,245 contract URLs honored against the live site.
  • Ref gate tripped, maintainer-dispatched: run 31019247342, assert-ref failed, validate and deploy skipped, no production deployment recorded.

Activity

  1. added a commit that references this issue on Aug 5, 2026
    01507a0
  2. ptr727 commented on Aug 5, 2026

    @ptr727
    OwnerAuthor

    Resolved in #569, merged to develop as 01507a0. Closing by hand, since a closing keyword cannot fire from a develop-targeted pull request.

    All three asks, adopted as written:

    Ask Where it landed
    1. Name the ref-gate verification as a maintainer step, with the evidence WORKFLOW.md section 5C, as a live-probe item under S13
    2. A classifier denial is not lifted by conversational authorization GOVERNANCE.md "Repository Boundaries and Write Safety"
    3. A denied write is never re-attempted through a different API surface Same bullet

    The evidence list is verbatim what you specified, because your framing of why it matters is the right one: the gate job's conclusion, its error text naming the expected and the received ref, every downstream job recorded as skipped rather than passed, and the deployment count against the production environment unchanged. The contract now says the agent prepares the command and reads all four back, and does not fire it.

    The refusal rule is in the write-safety section rather than the runbook, and that placement is deliberate. That section already bans a write fired as a probe and a write consuming a fabricated id; this is the third way a write reaches a target nobody approved, and the three belong together. It states that a harness refusal and the maintainer's permission are different things, that the second does not lift the first, that a refused write is never re-attempted through another API surface or tool or rephrasing, and that writing oneself a permission rule is self-authorization whatever was said. The two remaining routes are both the maintainer's, and it points at "Communicating with the User" for raising it as a blocked decision.

    Your closing paragraph became the general clause, and it is the part with the longest reach: where a required verification can only be performed by a write the agent is refused, the document requiring it says so and names who runs it, since a check that is mandatory and unperformable is dropped silently and then reported as done. That covers the outbound SSH you flagged as the other half without either of us having to enumerate the cases, and 5C names the SSH probe explicitly too.

    One note for the sweep that follows. "Repository Boundaries and Write Safety" is verbatim fidelity in spec/files.json, so every downstream repo including Blog now carries an older copy and will audit as stale on that section until the re-vendor. It has been added to the hub's TODO.md re-vendor entry rather than left for the next audit to rediscover.

    Two things your diagnostics made possible that a report of the symptom would not have. The echo-prefixed control is what proved the refusal is a judgment about the action rather than substring matching, so the rule could be written without asking for anything to be relaxed. And naming both predictable outcomes, the dropped check and the raw gh api workaround, is what made this a contract defect rather than a tooling complaint. Thanks for that, and for having the maintainer capture the run so the gate is now known to fail closed rather than assumed to.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions