Repository navigation
fix(cli): authenticate the steer receipt with the job token - #7376
waynesun09 wants to merge 98 commits into
Conversation
PR Summary by QodoAuthenticate steer receipts with the GitHub Actions job token
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
|
🤖 Finished Review · ✅ Success · Started 4:01 PM UTC · Completed 4:25 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $11.85 |
Site previewPreview: https://9a455748-site.fullsend-ai.workers.dev Commit: |
Code Review by Qodo
1.
|
ReviewFindingsLow
Previous runReviewFindingsLow
Previous run (2)ReviewFindingsMedium
Next steps:
Previous run (3)ReviewFindingsLow
Verification of prior findingsThe medium-severity No new correctness, security, style, or documentation-currency issues were found in the files changed since the prior review or in the unchanged files (re-assessed via severity anchoring). Previous run (4)ReviewFindingsMedium
Low
Next steps:
Previous run (5)ReviewFindingsMedium
Low
Next steps:
|
…t lacks Two review findings on #7376, both confirmed against the source. A receipt after every successful run. steerMarkerFrom always sets HeadSHA, BuildSteerMarker renders a head-only marker, and the writer gated on the marker string being non-empty — so every successful run on a steering enabled repository posted a comment announcing that it had absorbed nothing. The head-only marker on the status comment was deliberate and stays; a standalone receipt asserting a queued run may skip has nothing to assert when nothing was absorbed. SteerMarker.ConsumedRuns is now the one answer to "did this run absorb anything" — the filtering the builder already did, lifted to where the receipt decision can share it, since a slice of nothing but zeroes is non-empty and records nothing. The receipt identity could coincide with the agent's. The claim is that the sandbox cannot post as the receipt author, and two paths broke it. With minting skipped — no mint URL, or no role — GH_TOKEN is never swapped, so the captured job token stays in os.Environ(), which childScriptEnv hands to the post-script. A post-script shelling out to gh is the exact forgery path the receipt exists to close. The receipt credential is now the job token only when minting swapped it, and only when it differs from the role token byte for byte: roleToken is read from GH_TOKEN after minting, so equality proves no swap happened whatever the minted flag claims. Otherwise it is empty and the writer and skip check both turn off, the fail-open GitLab already has. Separately, the action's github_token input defaults to github.token but is an input, so a caller can pass an App installation token that resolves to the same login the role token posts under — a different credential, same identity, and the agent's own comments then carry the trusted author. The reader resolves both logins and refuses to skip when they match. That costs one API call on a path that runs once per run. Reading the Actions API is deliberately not held to this bar: those reads prove no authorship, so the watcher keeps the job token either way. Only the receipt's identity has to be unreachable. The author check proves the comment came from a workflow job token of this repository, not from this run — every job's default GITHUB_TOKEN shares one login. That is a maintainer-controlled boundary and is now stated as such rather than implied. Corroborating the marker against the Actions API would not narrow it, since the run id it names is public. Tests: a head-only marker and unusable ids post nothing; no receipt without the mint swap or when the two credentials are the same string; a perfect receipt from a shared identity does not skip, case-insensitively; both logins resolved, and failing to resolve either fails open. Mutation-checked, each reverted after. Dropping the consumed-ids guard fails NotForAHeadOnlyMarker. Ignoring minted fails SteerReceiptToken and NotWithoutTheMintSwap. Ignoring the shared-credential case fails NotWhenTheCredentialIsSharedWithTheAgent. Neutering the login comparison fails SameIdentityNeverSkips. Also moves steerReceiptTimeout up to the constants block, moves a fail-open preamble onto the test it describes, and drops a paragraph left over from the deleted body-shape check. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
Addressed in 98eb06b: the receipt credential is now gated in code on the mint swap having happened ( |
|
🤖 Finished Review · ✅ Success · Started 4:34 PM UTC · Completed 5:01 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $10.88 |
|
Risk Assessment: moderate (2/5) DetailsTier 1 signals are unchanged from the prior assessment (same 8-file/992-line diff, large blast radius, zero protected/security-sensitive paths per the path-pattern script, no CI/dependency changes, non-first-time human author, ~0.38 test ratio); Tier 2 is pulled up only by run.go being a pre-existing high-churn/multi-author hotspot despite this PR touching a small slice of it; Tier 3 reflects a PR broader than the issue's narrow criterion but well justified by extensive mutation testing and a reversible, currently opt-in/unreachable-in-production design. Per re-review anchoring, with no new signal justifying a change, the score is preserved at moderate (2). Previous runRisk Assessment: moderate (2/5) DetailsTier 1 signals are unchanged from the prior review (same 8-file/992-line diff, large blast radius but zero protected/security-sensitive paths, no CI/dependency changes, non-first-time human author, ~0.38 test ratio); Tier 2 is pulled up mainly by internal/cli/run.go being a pre-existing repo-wide churn/multi-author hotspot despite this PR touching only a small slice of it, while new steer-specific files have no comparable history; Tier 3 reflects a PR larger than the issue's narrow validation criterion but well justified by extensive tests and a currently-unreachable-in-production (steering off by default), reversible design. Per re-review anchoring, the score is preserved at moderate (2). Previous run (2)Risk Assessment: moderate (2/5) DetailsRe-running Tier 1 against the actual 989-line, 8-file diff (not the prior review's 10-line doc-only snapshot) yields change-size=5 (BLAST_RADIUS=large), but every other Tier 1 signal is low (0 protected paths, 0 security-sensitive paths per the tier1 script, no CI/dependency changes, non-first-time author, 0.38 test ratio); Tier 2 is pulled up only by run.go being a long-standing high-churn/multi-author hotspot in the wider repo history even though this PR touches just 21 of its lines, while the new steer-related files have no comparable history; Tier 3 shows the diff is larger than the issue's single narrow criterion but is well justified by extensive new tests and an additive, reversible design. Composite lands at moderate (2), matching the prior assessment's numeric score but for a materially different reason -- a genuinely larger, security-adjacent code change whose risk is kept in check by strong test coverage and a reversible rollback profile, not an unchanged doc-only diff. Previous run (3)Risk Assessment: moderate (2/5) DetailsSince the prior moderate (2) assessment, the only change is a doc-only edit (+10/-8) to an ADR with no recent commit activity, no additional authors, and no fix/revert history, leaving Tier 1/2/3 characteristics unchanged from the prior run, so per re-review anchoring the score is preserved at moderate (2). Previous run (4)Risk Assessment: moderate (2/5) DetailsA large diff (900 lines, blast-radius=large) is offset by low Tier 1 risk elsewhere (no protected/security-sensitive paths, no CI/dependency changes, non-first-time non-bot author, moderate test ratio); Tier 2 is elevated only via the single pre-existing touched file (run.go, a high-churn multi-author hub) whose usual co-change companions are not part of this PR; Tier 3 is low since the linked issue frames this as optional hardening for an off-by-default feature, giving good rollback safety — composite moderate (2), standard review adequate. |
|
Fixed in e07a57e: ADR 0101's Decision paragraph now says the receipt is the runner's own comment under the job token, the queued run exits on finding its id in one from that identity, and the status comment's marker copy is informational only. The env-strip hardening for a caller that re-exports |
|
🤖 Finished Review · ✅ Success · Started 5:05 PM UTC · Completed 5:21 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $4.61 |
Superseded by updated review
1e9b03a to
5f742b7
Compare
…fore The previous commit defanged each context body in renderContext, and buildText then ran security.SanitizeAgentText over the assembled text. The sanitizer strips invisible characters, so a token split by one — a zero-width space inside "[/work-item-context]", a soft hyphen inside "Amendments", a zero-width space before the "@" of "Instruction from @" — matched none of the patterns, and was then reassembled intact by the pass that ran after them. Probed against SanitizeAgentText directly: each of the three comes out as the whole token, with one finding. The context block is now sanitized first and defanged second, in one place in buildText, so there is nothing left for a later pass to put back together. Its findings are added to the returned count, because the block is still sanitized, just earlier, and the caller's "N finding(s) stripped" warning has to keep counting them. The final pass still covers the header and the amendments and does nothing to text that is already clean. The heading pattern also missed CRLF. A comment composed in GitHub's web UI arrives with \r\n line endings, (?m) anchors $ before \n only, and \r was not in the trailing class, so "Amendments\r" was never quoted. The sanitizer does not normalize line endings, so the pattern now allows \r. ActionsReader's comment claimed the runner gates steering to GitHub "for the same reason" these methods stay off forge.Client. It doesn't: the runner's gate is about GitLab queueing pipelines rather than cancelling them. The comment now says the runner gates it too, for its own reason. Tests: one comment with every token split by an invisible character, plus CRLF, asserted on the composed text (each fence delimiter appears once, the runner's own; no heading line and no attributed prefix; findings reported). A second test covers a plain CRLF heading. Mutation-checked: restoring the defang-then-sanitize order fails the first, and dropping \r from the class fails the second. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
The ADR framed its context and decision in terms of another, unmerged ADR and borrowed its vocabulary. That cost maintainers clarity and tied this record to a proposal that may not merge. The Context now states the problem from today's cancel-in-progress behaviour; the Decision states the two changes in this work's own terms — preserve the run in flight, then steer it — and the polling rationale stands on its own rather than as a rebuttal. No cross-reference to the other ADR remains. The rest of the ADR was already current from the review rounds and is unchanged. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
ADR 0113 was 441 lines with thirteen subsections of mechanics under the Decision. The repo's own rule is under 80 lines of content, with over 100 a red flag, and byte-level contracts in docs/normative. It now decides one thing and links the rest. The mechanics move to docs/contributing/steering.md intact — same headings, same prose, same tables — promoted from ### to ##, with the ADR-relative links repointed and a short intro and contents list added in the style of the neighbouring guides. Nothing in them is rewritten: this is a move, so the text keeps whatever the review rounds settled on. The envelope is a different kind of artifact. Its opening line and section markers are matched by a second repository, fullsend-ai/agents, which cannot be updated atomically with this one, so they are a versioned contract rather than a decision or a mechanic. They go to docs/normative/steer-envelope/v1 beside the other normative specs, stating the two tiers separately: the opening line, which the agent definitions match on and which is therefore deliberately never defanged inside work-item content, and the five structural tokens, which the runner guarantees are runner-authored by defanging them in an untrusted body. The sanitize-then-defang ordering is part of that contract, since a token split by an invisible character is reassembled by a sanitizer that runs afterwards. What stays in the ADR is the decision: the opt-in steer: block, the queued run as the notification rather than the worker, provenance over authorization, the receipt that lets the queued run skip, authenticated receipts as the precondition for enabling steering anywhere, and steering requiring preserving and not the reverse. The five bullets on why the runner polls the platform rather than the forge stay as the decision's rationale, one line each. Context now starts from what preserving alone leaves standing and builds on ADR 0101 rather than restating the cancellation problem that ADR decides. 100 lines of content, from 429. AGENTS.md gets a row for the new guide, and the architecture.md entry for ADR 0113 is tightened to one bullet in the style of its neighbours and worded to sit beside ADR 0101's. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Most of the 46 "ADR 0113" mentions cite the decision and are still right. These seven cited a section that moved. The provenance check numbers and the threat table they map to are in steering.md now, so provenance.go and its test name that file instead of an ADR section. The default of 2 for max_steers is in the configuration section, which the watcher test must keep matching. The envelope's opening line is in docs/normative/steer-envelope/v1, which is what steer_session.go and the codex test that pins the literal should send a reader to. runtime-implementation.md's Steerer row and harness-reference.md's steer entry both describe a contract the ADR no longer carries; each now links the guide as well. No behaviour change: comments and docs only. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Two corrections to the split. The defang table in the normative envelope spec was imprecise in the places a second repository would have to match it. Each row now says whether it is matched anywhere in the body or only line-anchored, and the two line-anchored rules have their edges written out: leading whitespace is allowed and is not kept in the quoted line, trailing whitespace and a carriage return after "Amendments" are allowed and are kept, and "Work-item context" must end on a word boundary, so "Work-item context." is quoted and "Work-item contexts" is not. Every row was checked against neutralizeEnvelopeMarkers rather than read off the regex. The trimmed ADR still said the queued run "reviews head B again". The A..B vocabulary came from the per-stage section, which moved to the guide, so the letter referred to nothing. It now says the new head. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Cancelling the run is ADR 0101's decision; this ADR decides steering. The filename keeps its slug, since the number is what the 46 references in code and docs cite and the ADR-number lint keys on it. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
…erved ADR 0101 removed the FULLSEND_PRESERVE_RUNS variable: every stage job now runs with cancel-in-progress: false, so the condition steerEligible was guarding against — steering a run that the concurrency group would cancel anyway — can no longer arise. The gate, its helper, its test, and the seven workflow env entries that carried the variable into the runner go; the contributor guide and harness reference say the harness steer block is the only switch. Steering itself stays opt-in until the receipt is authenticated and the default flips in the PRs above this one. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
ListWorkflowRunsSince and ListIssueCommentsSince lived on the GitHub client only, which the forge abstraction rule forbids: a missing operation is added to forge.Client, not worked around with a package-local interface. Add both to the interface; GitLab returns forge.ErrNotSupported, as it does for other reads it has no caller for, and the fake filters its fixtures by timestamp. steerwatch keeps its narrow ActionsReader and ItemReader, now as test seams over a subset of forge.Client. Assisted-by: Claude (fix), Codex (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
The preserve-the-run decision this one builds on is ADR 0101, so the steering decision moves to 0113 and the two sort in the order they stack. Every reference to either number in this change follows. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
fb09ad9 to
0f9bb0c
Compare
Closes #7006, which ADR 0113 makes a precondition for enabling steering anywhere. The receipt told a queued run its work was already done, and it was authenticated by two public strings: a marker inside a body carrying the status tags. Both are App-authored, and the App is also the identity the agent's own output is posted under — so an injection that induced the agent to emit those strings, or a post-script shelling out to `gh`, produced a receipt that passed. The failure is a silently dropped update, not a wasted one, which is the direction the skip check must never fail in. The credential that closes it already existed. The runner captures the Actions job token at run.go:906, before minting swaps GH_TOKEN for the role token, and the sandbox only ever receives the role token. So the job token's identity is one nothing inside the sandbox can post as. The runner now posts the receipt as its own comment under that token — the marker plus a line naming the absorbed runs — and the skip check honours markers from that login alone. The login is resolved from the token rather than hardcoded, since it differs on GHES. The marker is still written into the terminal status comment, because it is useful to a reader, but nothing skips on it any more. That let the body-shape requirement go. It existed only as a proxy for authenticity, and it would now reject the genuine receipt, which carries no status tags. Authorship is the whole of the check, which is why the reader must be built on the job token: hand it the role token and it resolves the App login and trusts exactly what it is meant to refuse. No permission change. Every job that runs `fullsend run` already grants the job token issues: write, and the four that can hold a pull request also grant pull-requests: write. harness-dispatch grants neither but runs `fullsend dispatch`, never an agent. Writing is best-effort and only an outright success writes one: a failed post costs one queued run redoing finished work, where failing the run would throw away work that succeeded. One receipt per run, not per steer — the validation loop's markers are merged first. GitLab writes none: its job token cannot post notes, so the skip check stays fail-open as it is today. Tests: #7006's criterion both ways — an App-authored receipt naming the current run does not skip, a job-token one does — plus the token pinned on both the writer and the reader, no receipt on failure, cancellation or skip, one per run across iterations, and the best-effort path. Mutation-checked, each reverted after. Restoring the old gap (the reader also accepting an App-authored status body) fails the criterion test, AppAuthoredReceiptDoesNotSkip. Building the reader on the role token fails ReadsWithTheJobToken; building the writer on it fails UsesTheJobToken. Ignoring the author entirely fails six tests across both packages. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
…t lacks Two review findings on #7376, both confirmed against the source. A receipt after every successful run. steerMarkerFrom always sets HeadSHA, BuildSteerMarker renders a head-only marker, and the writer gated on the marker string being non-empty — so every successful run on a steering enabled repository posted a comment announcing that it had absorbed nothing. The head-only marker on the status comment was deliberate and stays; a standalone receipt asserting a queued run may skip has nothing to assert when nothing was absorbed. SteerMarker.ConsumedRuns is now the one answer to "did this run absorb anything" — the filtering the builder already did, lifted to where the receipt decision can share it, since a slice of nothing but zeroes is non-empty and records nothing. The receipt identity could coincide with the agent's. The claim is that the sandbox cannot post as the receipt author, and two paths broke it. With minting skipped — no mint URL, or no role — GH_TOKEN is never swapped, so the captured job token stays in os.Environ(), which childScriptEnv hands to the post-script. A post-script shelling out to gh is the exact forgery path the receipt exists to close. The receipt credential is now the job token only when minting swapped it, and only when it differs from the role token byte for byte: roleToken is read from GH_TOKEN after minting, so equality proves no swap happened whatever the minted flag claims. Otherwise it is empty and the writer and skip check both turn off, the fail-open GitLab already has. Separately, the action's github_token input defaults to github.token but is an input, so a caller can pass an App installation token that resolves to the same login the role token posts under — a different credential, same identity, and the agent's own comments then carry the trusted author. The reader resolves both logins and refuses to skip when they match. That costs one API call on a path that runs once per run. Reading the Actions API is deliberately not held to this bar: those reads prove no authorship, so the watcher keeps the job token either way. Only the receipt's identity has to be unreachable. The author check proves the comment came from a workflow job token of this repository, not from this run — every job's default GITHUB_TOKEN shares one login. That is a maintainer-controlled boundary and is now stated as such rather than implied. Corroborating the marker against the Actions API would not narrow it, since the run id it names is public. Tests: a head-only marker and unusable ids post nothing; no receipt without the mint swap or when the two credentials are the same string; a perfect receipt from a shared identity does not skip, case-insensitively; both logins resolved, and failing to resolve either fails open. Mutation-checked, each reverted after. Dropping the consumed-ids guard fails NotForAHeadOnlyMarker. Ignoring minted fails SteerReceiptToken and NotWithoutTheMintSwap. Ignoring the shared-credential case fails NotWhenTheCredentialIsSharedWithTheAgent. Neutering the login comparison fails SameIdentityNeverSkips. Also moves steerReceiptTimeout up to the constants block, moves a fail-open preamble onto the test it describes, and drops a paragraph left over from the deleted body-shape check. The role token is read through envGHToken() rather than os.Getenv, which main's source scan requires and which matters here beyond consistency: envGHToken deliberately does not fall back to GITHUB_TOKEN or `gh auth token`. On Actions that fallback returns the workflow token, which is the job token — so a generic reader growing one would make steerReceiptToken's two arguments the same string, collapse the receipt and agent identities, and switch the skip check off. It would fail safe, since a collapsed identity refuses to skip, but for a reason nobody could see from the code. The scan's run.go exception says so too. A later review round found one more way to claim work that was never published. An agent that exits 0 while its transcript reports an error has lastExitCode forced to 1 and its post-script skipped — and the post-script is what publishes the output. Without a validation loop nothing turns that into a non-nil runErr, so the run reads as a clean success and, before this, receipted. The terminal status comment says "success" there too and always has; that is survivable for a comment that only reports and not for a receipt that tells another run to do nothing. The receipt gate is therefore deliberately stricter than the status comment, which is the one place the two disagree, and the doc comment says which and why. The receipt post also no longer dereferences the created comment without a nil check: the live client never returns (nil, nil), but the interface does not promise it and this runs inside a defer on an already-successful run, where a panic would take that run down. Mutation-checked, each reverted after. Dropping the consumed-ids guard fails NotForAHeadOnlyMarker. Ignoring minted fails SteerReceiptToken and NotWithoutTheMintSwap. Ignoring the shared-credential case fails NotWhenTheCredentialIsSharedWithTheAgent. Neutering the login comparison fails SameIdentityNeverSkips. Ignoring the transcript error fails TranscriptErrorWithheldTheOutput, and removing the nil guard fails NilCommentDoesNotPanic. Assisted-by: Claude (fix), Codex gpt-5.6-sol (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
The Decision still opened by saying the terminal status comment carries the processing receipt and a queued run skips on the id it finds there. That is the mechanism as it stood before the receipt was authenticated, and it contradicted the two sentences directly below it, which already said the job token is the channel and the runner holds it. It now says what the code does: the runner posts the receipt as its own comment, a queued run that finds its own id in one exits without starting the agent, and the status comment keeps an informational copy of the marker that the skip check does not honour. Same ten lines, so the ADR stays at its content ceiling. The sentence on the channel absorbed the identity clause the opening sentence would otherwise have repeated, and the forged-receipt consequence lost a clause that restated the sentence before it. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
46aed00 to
015e163
Compare
|
🤖 Finished Review · ✅ Success · Started 10:50 PM UTC · Completed 11:14 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $11.35 |
There was a problem hiding this comment.
Note: The following review comments could not be posted on the diff (GitHub returned 422) and are included here instead:
internal/cli/run.go(file-level): Line 5526 · [low] auth-bypass
mintAgentToken still only swaps GH_TOKEN, never GITHUB_TOKEN; childScriptEnv (run.go:4190-4191) still forwards os.Environ() to the post-script largely unchanged, stripping only TRACEPARENT and the OIDC deny-list, not GITHUB_TOKEN. Neither function is touched by this PR. With steerReceiptToken's minted && jobToken != roleToken gate and steerAlreadyHandled's EqualFold identity refusal, and with LatestSteerMarker no longer requiring terminal-status body shape, a bare github-actions[bot]-authored marker is now sufficient to authenticate a receipt -- so the one residual that still matters is a second copy of the job token surviving under another env-var name (e.g. an operator's own env:/runner_env re-exporting ${{ github.token }} as GITHUB_TOKEN or similar) into the post-script's environment. action.yml maps only GH_TOKEN on every step and GitHub Actions does not auto-inject secrets.GITHUB_TOKEN as a process env var by default, so this is a maintainer-controlled misconfiguration, not a default-path bypass, and it is not introduced or regressed by this PR -- it has been raised and rated low across multiple prior review rounds on this PR stack, and this round's re-verification against the current PR-head code (via an adversarial challenger pass) confirms nothing has changed that assessment.
Suggested fix: Optional defense-in-depth, not required to land this PR: on a successful mint, overwrite or unset GITHUB_TOKEN the same way as GH_TOKEN (save/restore in mintCleanup), and/or strip childScriptEnv entries whose value equals the captured job token. Document in the CLI/action docs that callers must not re-export github.token/GITHUB_TOKEN on the fullsend run step.
Superseded by updated review
0f9bb0c to
3fabcb2
Compare
|
🤖 Finished Retro · ✅ Success · Started 3:11 PM UTC · Completed 3:24 PM UTC Commit: Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $2.29 |
|
PR #7376 (fullsend-ai/fullsend, 'authenticate the steer receipt with the job token') was a human-authored, AI-assisted change by @waynesun09 addressing issue #7006 — not an autonomous triage→code agent PR (branch Main finding: the review agent's security sub-agent independently detected the same underlying vulnerability mechanism as the third-party Qodo bot (job token can equal role token when minting is skipped, defeating the receipt's trust boundary) but scoped its analysis only to fullsend-ai/fullsend and downgraded it to a non-default-path 'misconfiguration' not reachable in production. Qodo, which did an explicit cross-repo scan, found that fullsend-ai/.fullsend's QualityFlow workflow already has this exact live misconfiguration (same minted token reaches both agent execution and receipt authoring) and rated it High/security. The author fixed the generic in-repo check (which happens to neutralize the QualityFlow instance too), but the QualityFlow workflow itself was never touched and no issue tracks it — this is a structural cross-repo-visibility gap in the review agent, not a one-off miss, so I filed a proposal for it in fullsend-ai/agents. I checked for duplicates first: #298 (general multi-repo context-loading design) and #4166 (post-hoc aggregation of independently-found cross-repo bot misconfigurations) are related but don't cover this specific gap (proactively checking known sibling-repo consumers when reviewing a trust-boundary change), so this is a new, narrower proposal that references #298. Secondary observation (not a new proposal — duplicate found): one review round (run 35125865647) hit the challenger sub-agent returning an empty Proposals filed |
Closes #7006. Third PR of the stack; base is #6959.
The skip check lets a queued run exit when the run in flight already absorbed its update. Until now it authenticated the receipt by two public strings plus App authorship — and the agent and the post-script hold the same App identity, so anything inside the sandbox could forge one. ADR 0113 therefore made authenticated receipts a precondition for enabling steering. This PR satisfies it.
The mechanism rests on one fact. The runner captures the GitHub Actions job token before minting swaps
GH_TOKENfor the role token; only the role token ever enters the sandbox. So a comment posted with the job token carries an identity nothing in the sandbox can produce.Threat model, as code. Who can post as the App: the agent and any post-script, since both hold the role token. Who can post as the job token: the runner, and only when two conditions hold that the code now checks rather than assumes — minting actually swapped the job token out of the environment (with minting skipped, the post-script inherits it), and the captured credential differs from the role token byte for byte (the action's
github_tokeninput accepts any token, including an App token that would make the two identities one).steerReceiptTokenreturns empty unless both hold, which turns writer and reader off together; the reader additionally resolves both logins and refuses to skip when they match. One boundary is documented rather than narrowed: every workflow job token in a repository posts as the samegithub-actions[bot]login, so the author check proves a receipt came from a workflow of this repository, not from this run — a maintainer-controlled boundary, and the run id is public, so Actions corroboration would not narrow it.Writer. After a successful run that consumed at least one steer — a head-only marker posts nothing, since with steering on by default every successful run would otherwise add an "absorbed nothing" comment — the receipt is posted as its own comment with the job token — marker plus one human line — deferred so it sees the same final state the status comment reports. Best-effort: a failed post warns and the run still succeeds. No receipt on failure, cancellation or failed validation. One per run. GitLab posts nothing and its skip check stays fail-open exactly as today. The marker still goes into the terminal status comment for observability, as #7006 allows, but nothing skips on it any more.
Reader. Built on the job token; the honoured author is that token's login resolved via
GetAuthenticatedUser, never hardcoded. The old body-shape check — marker must sit inside a terminal status body — was a proxy for authenticity and would have rejected the genuine receipt; authorship is now the whole check. That means the control rests on the reader's resolved login differing from the App's, which is why a test pins the reader's token, not only the writer's.Verification. #7006's criterion in both directions: a syntactically perfect receipt posted through the App — status tags, terminal tag, marker naming the current run — does not skip; the job-token receipt does. Ten mutations across three rounds, each failing named tests: restoring App-authored acceptance; building the reader on the role token (initially passed everything, which exposed the most important line as untested — now pinned by
TestCheckSteerAlreadyHandled_ReadsWithTheJobToken); building the writer on the role token; ignoring the author; dropping the consumed-ids guard; ignoring the minted flag; ignoring the shared-credential case; a login comparison that never refuses; ignoring a transcript-reported error; and removing the nil-comment guard.Permissions, verified rather than assumed. Every job that runs
fullsend rungrants the job tokenissues: write, and the four that can hold a pull request also grantpull-requests: write, so no workflow change.harness-dispatchlacksissues: writebut runsfullsend dispatch, never an agent, and posts nothing.One residual worth stating.
/userand/appreturn 403 for an Actions token, so the login resolves through the GraphQL viewer query. No unit test can prove that string equals the author GitHub records on a comment the same token posted. If they ever differ, every receipt is silently ignored — the safe direction, but invisible. The writer therefore logs the author it received on the create call; the first live run shows a mismatch immediately, and that live run belongs before the default flips in the next PR. Recorded as a follow-up, not folded in: stripping environment entries whose value equals the captured job token from the child-script environment, against a caller that re-exportsgithub.tokenunder another name.Stacked: #7007 → #6959 → this. Steering-on-by-default follows.
Third round (restacked onto #6959's
5f742b7ba, on main). A run whose agent exits 0 while its transcript reports an error has its post-script skipped — and the post-script is what publishes the work — yet the receipt saw a clean success and would have told the queued run to skip work nobody published.shouldPostSteerReceiptnow takes that flag, so the invariant is: a receipt is posted only if the post-script ran. This deliberately diverges from the terminal status comment, which stays optimistic in that case; a status comment reports and can afford that, a receipt instructs and cannot. Composition with #6959's per-shipped-iteration rule was worked through both branches of the post-loop sweep: receipt and publication stay in lockstep either way. Also guarded: the receipt's author log dereferenced the created comment, inside a defer on a run that had already succeeded. Recorded as follow-ups, not folded in:--no-post-scriptalso skips the post-script and the gate does not test it (unreachable today — action.yml refuses to expose the flag and local runs never mint, so the receipt path is off); the reader honours the newest receipt only, so a receipt posted between an earlier one and the queued run's check can shadow it, costing a redundant run and never a dropped update.