Skip to content

fix(cli): authenticate the steer receipt with the job token - #7376

Closed
waynesun09 wants to merge 98 commits into
steer-followup-runsfrom
steer-receipts
Closed

waynesun09 wants to merge 98 commits into
steer-followup-runsfrom
steer-receipts

Conversation

@waynesun09

@waynesun09 waynesun09 commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

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_TOKEN for 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_token input accepts any token, including an App token that would make the two identities one). steerReceiptToken returns 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 same github-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 run grants the job token issues: write, and the four that can hold a pull request also grant pull-requests: write, so no workflow change. harness-dispatch lacks issues: write but runs fullsend dispatch, never an agent, and posts nothing.

One residual worth stating. /user and /app return 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-exports github.token under 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. shouldPostSteerReceipt now 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-script also 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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Authenticate steer receipts with the GitHub Actions job token

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Authenticate steering receipts using GitHub Actions job-token authorship.
• Post one best-effort receipt only after successful runs consume steers.
• Reject App-authored forgeries while preserving GitLab’s fail-open behavior.
Diagram

sequenceDiagram
    actor AR as Active Runner
    participant SB as Agent Sandbox
    participant API as GitHub API
    participant WI as Work Item
    actor QR as Queued Runner
    AR->>SB: Run with role token
    SB-->>AR: Return consumed runs
    AR->>API: Post with job token
    API->>WI: Store receipt comment
    QR->>API: Resolve token login
    API-->>QR: Return author login
    QR->>API: List comments
    API->>WI: Read timeline
    WI-->>API: Return comments
    API-->>QR: Return comments
    QR->>QR: Validate author and run ID
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Cryptographically sign receipts
  • ➕ Authentication would not depend on the platform comment author.
  • ➕ Signed payloads could be verified across multiple forge implementations.
  • ➖ Requires secure signing-key provisioning and rotation.
  • ➖ Adds signature format, verification, and compatibility complexity.
  • ➖ A signing secret must still remain isolated from the sandbox.
2. Use a dedicated receipt credential
  • ➕ Could use narrowly scoped permissions dedicated to receipt comments.
  • ➕ Makes the receipt identity explicit and independent of the workflow job identity.
  • ➖ Adds credential provisioning and lifecycle management.
  • ➖ May complicate GitHub Enterprise deployment and repository onboarding.
  • ➖ Provides little additional benefit while the existing job token remains runner-only.

Recommendation: Use the PR’s job-token authorship approach. It reuses an existing runner-only credential, dynamically supports github.com and GHES identities, and fails open when authentication or posting is unavailable. Signing or a dedicated credential would offer stronger separation but introduce substantial key-management and rollout complexity without improving the stated sandbox threat boundary.

Files changed (7) +472 / -135

Bug fix (3) +153 / -67
run.goDefer receipt posting until the final run outcome +13/-0

Defer receipt posting until the final run outcome

• Registers receipt posting before other deferred lifecycle handlers so it executes last. The receipt is emitted only after final status and post-script outcomes are known.

internal/cli/run.go

steer.goWrite and authenticate receipts with the job token +106/-11

Write and authenticate receipts with the job token

• Builds both receipt reader and writer clients from the GitHub Actions job token, resolves its login dynamically, and posts one human-readable receipt per successful run. Posting is bounded, best-effort, disabled for GitLab, and skipped when no steer was consumed.

internal/cli/steer.go

steermarker.goTrust receipt authorship instead of terminal-comment shape +34/-56

Trust receipt authorship instead of terminal-comment shape

• Changes marker selection to accept the latest parseable marker from the resolved job-token author without requiring terminal status tags. App-authored status markers remain observable but no longer authorize a skip.

internal/statuscomment/steermarker.go

Tests (2) +246 / -43
steer_test.goVerify secure receipt credentials and lifecycle conditions +206/-13

Verify secure receipt credentials and lifecycle conditions

• Adds regression coverage proving App-authored markers cannot skip queued runs while job-token receipts can. Tests pin reader and writer credentials, one-receipt aggregation, success-only posting, best-effort failures, and GitLab or missing-token behavior.

internal/cli/steer_test.go

steermarker_test.goTest author-based steer marker authentication +40/-30

Test author-based steer marker authentication

• Updates marker tests for bare job-token receipts and distinct receipt/App identities. Regression cases ensure perfectly formed App-authored status and agent-output markers remain untrusted.

internal/statuscomment/steermarker_test.go

Documentation (2) +73 / -25
0101-steer-the-running-agent-on-work-item-updates.mdRecord job-token receipts as the steering authentication channel +5/-3

Record job-token receipts as the steering authentication channel

• Documents that GitHub Actions job-token authorship satisfies the ADR’s prerequisite for enabling steering because the sandbox never receives that token.

docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md

steering.mdDocument authenticated receipt lifecycle and failure behavior +68/-22

Document authenticated receipt lifecycle and failure behavior

• Explains separate job-token-authored receipt comments, author-based validation, best-effort posting, and success-only emission. It also records the remaining runner-token boundary and GitLab’s unchanged fail-open behavior.

docs/contributing/steering.md

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:01 PM UTC · Completed 4:25 PM UTC

Commit: f62e4c0 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $11.85

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://9a455748-site.fullsend-ai.workers.dev

Commit: 015e16326a69f9ce4a65fb5a574b67e907d3922f

@qodo-code-review

qodo-code-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Accepted architecture history changes ✗ Dismissed 📜 Skill insight § Compliance
Description
docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md is already Accepted, but its
Decision section now names the job token as the chosen receipt-authentication channel and declares
the precondition satisfied. Because this records a new mechanism and rationale rather than a status
update, cross-reference, or typo fix, later readers can no longer distinguish the original accepted
decision from its subsequent implementation.
Code

docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md[R72-73]

+That channel is the GitHub Actions job token: the runner holds it, the sandbox never receives it,
+and the receipt is posted and read under its identity, so this precondition is satisfied.
Relevance

●●● Strong

Team has accepted findings rejecting substantive edits to accepted ADRs; this directly changes the
Decision record.

PR-#6769
PR-#2277

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
ADR 0101 is marked Accepted, while the added lines substantively extend its Decision section with
the selected credential and a conclusion that the precondition is now satisfied. The cited rules
prohibit substantive changes to an accepted ADR beyond status changes, cross-references, short
connecting notes, and typo or formatting fixes.

Rule 1062057: Restrict modifications to accepted ADRs on main
docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md[1-20]
docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md[64-73]
Skill: writing-adrs

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
ADR 0101 was already accepted, but its Decision section is being extended with the subsequently selected authentication mechanism. Preserve the accepted decision as historical context and record the new mechanism separately.

## Fix Focus Areas
- docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md[69-73]

## Recommended Fix
Remove the substantive mechanism declaration from ADR 0101. Create a new ADR for authenticating steer receipts with the GitHub Actions job token, then add only a brief cross-reference from ADR 0101 to that new decision.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Sandbox can forge steer receipts ✓ Resolved 🔗 Cross-repo conflict ⛨ Security
Description
checkSteerAlreadyHandled and postSteerReceipt trust o.jobToken as a sandbox-inaccessible
identity, even though it comes from the generic github_token/GH_TOKEN and can remain unchanged
when optional role-token minting is skipped. In .fullsend QualityFlow the same minted coder App
token reaches both the receipt logic and agent execution, while omitted minting lets post-scripts
inherit GH_TOKEN, so sandbox-controlled code can create a marker under the trusted author and
cause a queued run to skip.
Code

internal/cli/steer.go[529]

+	handled, err := steerAlreadyHandled(ctx, steerMarkerClient(o.jobToken), o.statusRepo, o.statusNum, steerRunID())
Relevance

●● Moderate

Security concern is plausible, but no close precedent confirms acceptance; the PR explicitly targets
this threat model.

PR-#7200

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The action documents github_token as a general API token, exports it through GH_TOKEN, and
captures it in run.go for the new receipt reader and writer to trust. Minting is optional and can
return without replacing GH_TOKEN, while childScriptEnv inherits the process environment and
excludes only OIDC variables, leaving post-scripts with the credential whose login is the sole
receipt authenticator. Independently, the .fullsend QualityFlow workflow passes its minted coder
App token through github_token while also exposing that token to agent setup and the run
environment, disproving the assumption that sandbox-controlled execution cannot post comments as the
trusted receipt author.

action.yml[25-28]
action.yml[411-424]
internal/cli/run.go[901-906]
internal/cli/steer.go[523-529]
internal/cli/steer.go[519-529]
internal/cli/steer.go[583-600]
internal/cli/run.go[901-920]
internal/cli/run.go[4135-4163]
action.yml[44-49]
External repo: fullsend-ai/.fullsend, .github/workflows/qualityflow.yml [146-152]
External repo: fullsend-ai/.fullsend, .github/workflows/qualityflow.yml [198-203]
External repo: fullsend-ai/.fullsend, .github/workflows/qualityflow.yml [213-228]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The steer receipt reader and writer assume the captured job token is inaccessible to sandbox- and script-controlled execution, but cross-repository callers can supply an App token through `github_token` that is also exposed to the agent, and optional minting can leave the original `GH_TOKEN` available to post-scripts. Introduce an explicit protected receipt-credential contract and prevent receipt authentication whenever the trusted credential is exposed to controlled execution.

## Fix Focus Areas
- action.yml[25-28]
- action.yml[411-424]
- internal/cli/run.go[901-920]
- internal/cli/run.go[4135-4163]
- internal/cli/steer.go[519-529]
- internal/cli/steer.go[583-600]
- .github/workflows/qualityflow.yml[198-228]

## Recommended Fix
Add a distinct action input and environment variable for the receipt credential, defaulting to the workflow job token for same-repository runs. Update `.fullsend` cross-repository workflows to provide a dedicated comment-capable credential whose identity differs from every token exposed to the sandbox, and do not silently fall back to an overridden `github_token` when steering is enabled. Track whether the role token was successfully minted and enable receipt reading and posting only when the credential-isolation precondition is satisfied; alternatively, explicitly remove the original job token from every agent- or script-controlled environment before allowing steering. Keep the skip check fail-open when this precondition is not met.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Successful runs spam empty receipts ✓ Resolved 🐞 Bug ≡ Correctness
Description
postSteerReceipt treats any nonempty marker as evidence that a steer was consumed, but
BuildSteerMarker also returns a marker when only HeadSHA is set. On successful pull-request
runs, steerSession.marker supplies the watcher's initial head even with no acknowledged
deliveries, so steering-enabled runs post a standalone “absorbed no follow-up runs” comment on every
success.
Code

internal/cli/steer.go[R587-589]

+	marker := statuscomment.BuildSteerMarker(m)
+	if marker == "" {
+		return
Relevance

●●● Strong

This is a deterministic correctness bug: head-only markers create misleading receipts despite no
consumed runs.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
steerMarkerFrom always copies the watcher head into the marker, while Watcher.Head documents
that this remains the run-start head when nothing moved. BuildSteerMarker therefore produces a
nonempty head-only marker, and the new posting code accepts it; steerReceiptLine then explicitly
renders the misleading no-follow-up-runs message.

internal/cli/steer.go[383-407]
internal/steerwatch/watcher.go[240-245]
internal/statuscomment/steermarker.go[47-78]
internal/cli/steer.go[583-600]
internal/cli/steer.go[618-628]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Successful pull-request runs can post a steer receipt even when they absorbed no follow-up runs because a head-only marker is nonempty.

## Fix Focus Areas
- internal/cli/steer.go[583-590]
- internal/cli/steer.go[394-407]
- internal/statuscomment/steermarker.go[47-78]

## Recommended Fix
Before building or posting the receipt, require at least one valid consumed run ID. Add a regression test using a marker with a nonempty head and no consumed IDs, verifying that no comment is posted.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Busy work items rerun unnecessarily 🐞 Bug ☼ Reliability
Description
checkSteerAlreadyHandled relies on ListIssueComments, whose GitHub implementation stops after
page 100 of 100 comments. Once an item has more than 10,000 comments, a receipt posted after that
cutoff is absent from the supplied timeline and the queued run falls through to execute again.
Code

internal/cli/steer.go[529]

+	handled, err := steerAlreadyHandled(ctx, steerMarkerClient(o.jobToken), o.statusRepo, o.statusNum, steerRunID())
Relevance

● Weak

A close pagination-limit finding was rejected, indicating bounded API pagination is not treated as
required here.

PR-#5853

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed skip path calls ListIssueComments and searches only that returned collection. The
forge client requests 100 comments per page but has a hard page-100 loop bound, so newer comments on
an item with over 10,000 comments cannot reach LatestSteerMarker.

internal/cli/steer.go[494-513]
internal/forge/github/github.go[2863-2925]
internal/statuscomment/steermarker.go[131-143]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new skip check reads receipts through a comment-list API that returns at most the first 10,000 comments. On a work item above that limit, newer receipt comments are invisible and the skip check unnecessarily starts the queued run.

## Fix Focus Areas
- internal/cli/steer.go[494-513]
- internal/forge/github/github.go[2888-2925]

## Recommended Fix
Add a newest-first comment-listing path, or otherwise paginate from the newest comments, for receipt lookup. Continue until a matching receipt is found or the relevant receipt window is exhausted, rather than silently truncating after page 100.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 70 rules
✅ Cross-repo context — repo relationships
  Explored: repo: fullsend-ai/.fullsend (sha: 7c163cad)
  Explored: repo: fullsend-ai/agents (sha: 6ffe9c77)
Review mode: 🧠 Deep: This security-sensitive authentication change spans multiple runtime paths, credential boundaries, receipt parsing, lifecycle defers, and platform behavior, creating several independent high-impact defects a single pass could miss.

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread internal/cli/steer.go Resolved
Comment thread internal/cli/steer.go Resolved
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [auth-bypass] internal/cli/run.go:5526 — 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 confirms nothing has changed that assessment.
    Remediation: 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.
Previous run

Review

Findings

Low

  • [auth-bypass] internal/cli/run.go:5526 — mintAgentToken only overwrites GH_TOKEN (run.go:5526); GITHUB_TOKEN is not swapped, compared, or stripped from childScriptEnv (run.go:4190). That's accurate, but it is not a default-path bypass: GitHub Actions does not auto-inject secrets.GITHUB_TOKEN/github.token as a process environment variable — it must be explicitly mapped into a step's env: block. action.yml never sets GITHUB_TOKEN (every step uses only GH_TOKEN: ${{ inputs.github_token }}), and none of the reusable-workflow callers set it either. In the production chain, the post-script therefore inherits GH_TOKEN=<role token> and no GITHUB_TOKEN at all after a successful mint; steerReceiptToken's minted && jobToken != roleToken gate does the swap check this PR relies on. The remaining gap is the same already-disclosed residual this PR itself documents elsewhere: an operator's own harness config (or runner_env) explicitly re-exporting the captured job token under another env-var name, including a self-set GITHUB_TOKEN. That's a maintainer-controlled misconfiguration, not GitHub's default behavior, and it isn't introduced by this PR — mintAgentToken, childScriptEnv, and action.yml are all unchanged by this diff. This exact residual (job token reachable only if an operator re-exports it) has been raised and rated low across multiple prior review rounds on this PR; nothing here changes that assessment.
    Remediation: 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.
Previous run (2)

Review

Findings

Medium

  • [incorrect-doc] docs/contributing/steering.md:316 — This PR's own new prose contradicts the implementation it ships. Line 316 says "One receipt per run, not per steer: the validation loop merges every iteration's consumed run ids into one marker." The identical claim appears in the postSteerReceipt doc comment at internal/cli/steer.go:643 ("the marker is the union across every validation-loop iteration"). shippedSteerMarker (internal/cli/steer.go:715-720) actually returns only the validated iteration's marker (or the last iteration's, absent a validation loop) — it does not union or merge consumed run ids across iterations. TestPostSteerReceipt_OnePerRun pins this: an iteration that absorbed run 101 but then lost validation is not receipted; only the shipped iteration's runs are. The "one receipt per run" clause is correct; the "merges/unions every iteration" clause is not, and describes behavior backwards from what ships. The code and tests are the safe direction (a failed-validation iteration's absorbed updates are never falsely receipted as done, which would otherwise silently drop those updates for a queued run) — so this is a documentation/comment accuracy issue rather than a functional defect, but it directly misdescribes the receipt's core safety invariant in the PR's own new design documentation.
    Remediation: Rewrite both the docs/contributing/steering.md:316 sentence and the internal/cli/steer.go:643 doc comment to match shippedSteerMarker's actual behavior, e.g.: "One receipt per run, not per steer: the receipt carries only the consumed run ids from the iteration whose output actually shipped, rather than merging across validation iterations."

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (3)

Review

Findings

Low

  • [logic-error] internal/cli/steer.go:609 — steerReceiptToken treats the job token as sandbox-unreachable once minting has swapped GH_TOKEN. On this repository's default deployment that holds: action.yml's "Run fullsend" step sets only GH_TOKEN: ${{ inputs.github_token }} in its env: block (no GITHUB_TOKEN, no $GITHUB_ENV write), and none of the reusable workflow callers pass GITHUB_TOKEN either — GitHub Actions does not auto-inject secrets.GITHUB_TOKEN into a step's environment. mintAgentToken's os.Setenv("GH_TOKEN", ...) mutates the process's environ in place, so childScriptEnv/postScriptEnv (built from os.Environ() afterward) see the swapped role token under GH_TOKEN, not the original job-token bytes. The gap is real only if an operator's harness config explicitly re-exports the job token under another env-var name — a maintainer-controlled misconfiguration analogous to the already-documented "any workflow in this repo can post as github-actions[bot]" residual boundary this same PR discloses in docs/contributing/steering.md, not a bug reachable through this PR's own code or default wiring. Unchanged since the prior review; severity preserved. Note: the previously-flagged medium fail-open issue (mint skipped without verifying the job token differs from the role token) is now addressed — steerReceiptToken requires minted && jobToken != roleToken, and steerAlreadyHandled refuses to skip when the two logins match.
    Remediation: Optional defense-in-depth as a follow-up, not required for this PR: strip environment entries whose value equals the captured job token from childScriptEnv/postScriptEnv (at least GITHUB_TOKEN), and note in the CLI/action documentation that callers must not re-export github.token as GITHUB_TOKEN on the fullsend run step.

  • [sub-agent-failure] N/A — The challenger sub-agent returned an empty adjudicated_findings array for a non-empty input set (the single finding above), moving the finding it received to removed_findings with a technical justification. Per protocol, an empty adjudicated_findings result for a non-empty input is treated as a challenger failure rather than a legitimate full removal, so this review falls back to the pre-challenger finding set (the logic-error finding above is retained rather than removed).

Verification of prior findings

The medium-severity documentation-staleness finding from the prior review (ADR 0101, lines 64-65 describing the pre-#7006 mechanism) has been fixed in this revision: the Decision section now correctly describes the runner posting the receipt as its own job-token-authenticated comment, with the terminal status comment retaining only an informational marker copy that the skip check does not honour. Confirmed by independent re-read of docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md and cross-check against docs/contributing/steering.md and the current implementation (postSteerReceipt, LatestSteerMarker).

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)

Review

Findings

Medium

  • [documentation-staleness] docs/ADRs/0101-steer-the-running-agent-on-work-item-updates.md:64 — The Decision section still reads "After the run, its terminal status comment carries a processing receipt naming the follow-up runs it consumed, and a queued run that finds its own id listed exits without starting the agent." That describes the pre-Optional hardening: authenticate steer receipts so a forged one cannot suppress a queued run #7006 mechanism. This PR already edited the very next two sentences (lines 72-73) to name the GitHub Actions job token as the authenticating channel, and docs/contributing/steering.md plus the current code (postSteerReceipt, LatestSteerMarker) now agree that the receipt is a separate, job-token-authenticated comment — the terminal status comment's marker copy is explicitly not honoured by the skip check any more. Lines 64-65 were left contradicting the paragraph's own next sentence and the rest of the PR.
    Remediation: In the same Decision paragraph this PR already touched, annotate lines 64-65 so they match the implementation: the runner posts the processing receipt as a separate job-token-authenticated comment; the terminal status comment may retain an informational marker copy that the skip check does not honour. Keep it a brief annotation — ADR 0101 is Accepted, so this should stay a minor correction rather than a Decision rewrite.

Low

  • [logic-error] internal/cli/steer.go:606 — steerReceiptToken treats the job token as sandbox-unreachable once minting has swapped GH_TOKEN. On this repository's default deployment that holds: action.yml's "Run fullsend" step sets only GH_TOKEN: ${{ inputs.github_token }} in its env: block (no GITHUB_TOKEN, no $GITHUB_ENV write), and the reusable-code.yml/reusable-review.yml/reusable-fix.yml/reusable-triage.yml callers don't pass GITHUB_TOKEN either — GitHub Actions does not auto-inject secrets.GITHUB_TOKEN into a step's environment. mintAgentToken's os.Setenv("GH_TOKEN", ...) mutates the process's environ in place, so childScriptEnv/postScriptEnv (built from os.Environ() afterward) see the swapped role token under GH_TOKEN, not the original job-token bytes. The gap is real only if an operator's harness config explicitly re-exports the job token under another env-var name (e.g. a caller setting env: GITHUB_TOKEN: ${{ github.token }} on the uses: step, or a runner_env override) — a maintainer-controlled misconfiguration analogous to the already-documented "any workflow in this repo can post as github-actions[bot]" residual boundary this same PR discloses in docs/contributing/steering.md, not a bug reachable through this PR's own code or default wiring.
    Remediation: Optional defense-in-depth as a follow-up, not required for this PR: strip environment entries whose value equals the captured job token from childScriptEnv/postScriptEnv (at least GITHUB_TOKEN), and note in the CLI/action documentation that callers must not re-export github.token as GITHUB_TOKEN on the fullsend run step.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (5)

Review

Findings

Medium

  • [fail-open] internal/cli/steer.go:526 — The receipt's whole security property is that the job token's identity is distinct from the role token that enters the sandbox, but neither checkSteerAlreadyHandled nor postSteerReceipt verifies that. Both gate only on o.jobToken != "". In run.go, steerJobToken is captured from GH_TOKEN before mintAgentToken runs; if minting is skipped (mintAgentToken returns minted=false without error when mintURL is empty, and the caller only warns), GH_TOKEN is never swapped, so o.roleToken (captured afterwards, also from os.Getenv("GH_TOKEN")) equals o.jobToken byte-for-byte. In that state the sandbox holds the same credential the skip check authenticates against, so a post-script or a prompt-injected agent using the role token could post a comment the check honours as a genuine receipt — exactly the failure ADR 0101 forbids (a silently dropped update). Production dispatch workflows currently always thread mint-url through, so this is a misconfiguration path rather than a live exploit today, but nothing in the code enforces the precondition the design depends on.
    Remediation: In checkSteerAlreadyHandled and postSteerReceipt, fail open (skip the check / do not post) unless the job token is verified distinct from the role token — e.g. o.jobToken != o.roleToken, or require a minted flag to be true. Add a test pinning that when jobToken == roleToken (mint skipped), a syntactically perfect receipt from that shared identity does not cause a skip, and postSteerReceipt does not post one either.

Low

  • [auth-bypass] internal/statuscomment/steermarker.go:136 — LatestSteerMarker authenticates solely by comment author login resolved from the job token. On github.com, every workflow job's default GITHUB_TOKEN posts as the same github-actions[bot] login, so a comment from any other workflow in the same repository is a live receipt candidate if it happens to contain the marker syntax. The ADR/docs disclose the risk of this runner's own job token leaking out of its own process, but not this repo-wide shared-login trust boundary. This is a residual design boundary rather than a defect in the new check itself.
    Remediation: Document that any GITHUB_TOKEN-authored comment in the repository is a live receipt candidate, or narrow the check (e.g. corroborate the run id via the Actions API rather than trusting author + marker syntax alone).

  • [documentation-format] internal/cli/steer_test.go:276 — The two-line "fail open in every direction" comment originally documented TestSteerAlreadyHandled_FailsOpen. New tests were inserted directly after it, so it now reads as the doc comment for TestSteerAlreadyHandled_AppAuthoredReceiptDoesNotSkip instead, and TestSteerAlreadyHandled_FailsOpen (now ~170 lines further down) is left with no leading doc comment.
    Remediation: Move the fail-open preamble down to immediately precede func TestSteerAlreadyHandled_FailsOpen.

  • [documentation-format] internal/cli/steer_test.go:740 — TestSteerAlreadyHandled_IgnoresAgentAuthoredMarker's doc comment stacks two contradictory rationales: the old one ("only scope tells it apart from a real receipt") and the new one ("The body shape no longer matters — what disqualifies it is that the App is not the identity the runner's job token posts under."). The first paragraph is leftover text from the deleted isTerminalStatusBody check and should have been replaced rather than retained.
    Remediation: Remove the stale first paragraph, keeping only the updated identity-based explanation.

  • [code-organization] internal/cli/steer.go:614 — const steerReceiptTimeout is declared after postSteerReceipt (which uses it), rather than in the file's top-level constants block (steerTokenMargin, steerTokenLife, steerTurnEndBuffer) or immediately before its first use, which is the pattern the rest of the file follows.
    Remediation: Move const steerReceiptTimeout up to the top-level constants block, or immediately before postSteerReceipt.

  • [naming-convention] internal/cli/steer_test.go:462 — In TestSteerAlreadyHandled_FailsOpen, the subtest is still named "the app login cannot be resolved", stale terminology from before this PR's refactor — the corresponding production error text was changed from "resolving the app login" to "resolving the job token's login".
    Remediation: Rename the subtest to "the job token's login cannot be resolved".


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

waynesun09 added a commit that referenced this pull request Sep 16, 2026
…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>
@waynesun09

Copy link
Copy Markdown
Member Author

Addressed in 98eb06b: the receipt credential is now gated in code on the mint swap having happened (jobToken != roleToken, plus the minted flag), the reader refuses a receipt whose author identity equals the role token's, the repo-wide github-actions[bot] boundary is stated in the reader's doc comment and in steering.md rather than narrowed (the run id is public, so Actions corroboration would not narrow it), and the four doc-comment/ordering nits are done. Also fixed from the other review: a head-only marker no longer posts a receipt on every successful run.

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:34 PM UTC · Completed 5:01 PM UTC

Commit: 98eb06b · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $10.88

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Sep 16, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Tier 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 run

Risk Assessment: moderate (2/5)

Details

Tier 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)

Details

Re-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)

Details

Since 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)

Details

A 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.

fullsend-ai-review[bot]

This comment was marked as outdated.

fullsend-ai-review[bot]

This comment was marked as outdated.

@waynesun09

Copy link
Copy Markdown
Member Author

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 github.token as GITHUB_TOKEN is recorded as a follow-up rather than folded in here, as suggested.

@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 5:05 PM UTC · Completed 5:21 PM UTC

Commit: e07a57e · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $4.61

@fullsend-ai-review
fullsend-ai-review Bot dismissed stale reviews from themself September 16, 2026 17:21

Superseded by updated review

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Sep 16, 2026
@waynesun09
waynesun09 force-pushed the steer-followup-runs branch 2 times, most recently from 1e9b03a to 5f742b7 Compare September 16, 2026 19:01
…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>
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>
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:50 PM UTC · Completed 11:14 PM UTC

Commit: 015e163 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $11.35

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@waynesun09

Copy link
Copy Markdown
Member Author

Replaced by #7456, the same receipt decision as its own PR in the restructured stack (#7007 → #6959 → #7447 → #7451 → #7456), with ADR 0120 recording it. Nothing here is lost: every commit was ported there.

@waynesun09 waynesun09 closed this Sep 18, 2026
@fullsend-ai-retro

fullsend-ai-retro Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 3:11 PM UTC · Completed 3:24 PM UTC

Commit: 015e163 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $2.29

@fullsend-ai-retro

Copy link
Copy Markdown

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 steer-receipts doesn't follow the agent/{issue}-{slug} convention). It closed unmerged on 2026-09-18 after the author restructured the underlying stack; all commits were ported into a renumbered follow-up (#7456), so no work was lost. The fullsend review agent (fullsend-ai/agents@main, harness/review.yaml) ran 8 review cycles across pushes over ~7 hours, correctly tracked fixed-vs-open findings each round, and approved the final commit; CI was clean throughout. No human ever left a review comment or formal approval/changes-requested — only the author's own replies — so autonomy-increasing analysis is inconclusive per the autonomy-readiness skill's silent-approval rule (this also wasn't a fully autonomous PR to begin with).

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 adjudicated_findings array while placing its rejected finding into a populated, well-justified removed_findings field. Current protocol treats any empty adjudicated_findings as a sub-agent failure regardless of removed_findings content, so it fell back safely (no finding was lost) but logged a low-severity 'sub-agent-failure' noise entry on the PR even though the challenger's reasoning looked sound. This exact defect is already tracked at fullsend-ai/agents#675 ('Challenger empty-result fallback prevents valid exoneration of single-finding reviews'); this run's transcript is corroborating evidence that the removed_findings-populated variant of the failure mode still recurs and could sharpen that issue's fix. No new issue filed for this.

Proposals filed

This branch was successfully deployed

1 active and 1 inactive deployments
dev — 015e1632 Deployed Sep 16, 2026 by waynesun09 via behaviour #13033
site-preview — 015e1632 Deployed Sep 16, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fullsend-no-fix Skip bot-triggered fix agent runs ready-for-merge All reviewers approved — ready to merge risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional hardening: authenticate steer receipts so a forged one cannot suppress a queued run

1 participant