Skip to content

Account for live exploration roles and unbound receipts on no_agent runs - #80799

Open
rabeckett wants to merge 1 commit into
mainfrom
fix/live-no-agent-exploration-accounting
Open

rabeckett wants to merge 1 commit into
mainfrom
fix/live-no-agent-exploration-accounting

Conversation

@rabeckett

Copy link
Copy Markdown
Collaborator

Fixes #80796

In adaptive routing (#79102), AWF writes its selection receipt (adaptive-selection.jsonl) before the primary agent starts. When the agent then fails during startup or exits without making any LLM request, observeRoutedRun emits no routing.observation, so run.observation is null when applyRun in actions/setup/js/routing_history.cjs processes the run. Previously, applyRun returned early on !run.observation before reading run.receipt or run.prepare, so live no_agent runs left scope.last_role, pair.tests, and state.unexplained untouched.

Concrete example

Suppose AWF selects an untried challenger github-copilot/model-a@high with role: "test" in live mode, and the agent crashes during startup before sending any LLM request (observation: null).

Field after the no_agent run Before After
scope.last_role (bound test receipt) "serve" (share stays open) "test" (share consumed)
pair.tests (bound test receipt) 0 (allowance never spent) 1 (allowance spent, seen updated)
scope.last_role (bound probe receipt) "serve" "probe" (share consumed, pair.tests unchanged)
state.unexplained (absent/unbound receipt, explore_allowed !== false or missing prepare) 0 1 (and last_role: "test")
state.unexplained (absent/unbound receipt, explore_allowed === false) 0 0 (and last_role: "test")
runs.jsonl line (bound test receipt) {"role":null,"pair":null,"counted":false,"note":"no_agent"} {"role":"test","pair":"github-copilot/model-a@high","counted":false,"note":"no_agent"}

Summary of changes

  • actions/setup/js/routing_history.cjs:
    • In applyRun, keep observe-mode !run.observation unchanged (no_agent, no scope creation or role/test/unexplained changes), while letting live-mode !run.observation runs ensure the scope exists (respecting the 4-scope bound) and run the same receipt-binding and prepare exploration accounting (scope.last_role, pair.tests, pair.seen, and state.unexplained). Live no_agent runs return before the incumbent-switch and outcome-recording paths, writing note: "no_agent", role (or null if unbound), pair (selected pair or null), and counted: false.
    • In receiptBound, require receipt.selected to be a non-empty string matching run.pair and require receipt.role to be valid for the mode (serve, test, probe, ordinary in live mode; observe in observe mode), so missing, null-selected, or malformed receipts follow the unbound-receipt path.
  • actions/setup/js/fixtures/routing-history/aw2-reducer.json: sync the updated observe-mode no-agent vector and the six no-agent-live-* oracle vectors from adaptive-routing/oracle.py.
  • actions/setup/js/routing_history.test.cjs: add unit tests covering bound serve (verifying scope.incumbent is not switched) and ordinary receipts, scope-bound eviction on live vs observe no_agent, mismatched and null-selected receipts, and malformed live receipt roles (unknown string, observe, missing, numeric) asserting serialized role: null.

Local validation (head a68906a0b6)

  • eslint (eslint-factory/eslint.config.cjs) on routing_history.cjs and routing_history.test.cjs: passed
  • npx prettier --end-of-line auto --check: passed (committed git blobs verified pure LF)
  • npm run typecheck (tsc --noEmit): passed
  • npx vitest run routing_history.test.cjs: 53/53 passed

Ensure applyRun in actions/setup/js/routing_history.cjs applies scope creation,
receipt binding, last_role, pair.tests, and unexplained accounting on live runs
even when run.observation is null (no_agent), without switching scope.incumbent
or counting a model outcome. Tighten receiptBound to require a non-empty string
selected pair and a valid role for the mode so malformed or null-selected
receipts follow the unbound-receipt path.

Sync the no-agent and six no-agent-live-* oracle vectors in
actions/setup/js/fixtures/routing-history/aw2-reducer.json and add unit tests
covering serve/ordinary receipts, scope bounds, mismatched/null selections, and
malformed live roles.

Fixes #80796

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rabeckett
rabeckett marked this pull request as ready for review November 24, 2026 20:24
Copilot AI adaptive review requested due to automatic review settings November 24, 2026 20:24
@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Reviewed PR #80799 at head a68906a against the applicable adaptive-routing/compiler contract. No specification regression or eligible synchronization was identified; no review action was needed.

Generated by PR Specification Reviewer for #80799 · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.8K · history

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #80799 · codex · routed: gpt61 medium · ~7 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Completed PR #80799 review: no actionable findings; review and continuity record submitted.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · history

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What this change does: It records live routing selections when an agent makes no request. It also checks receipt roles and selected pairs and adds coverage for these cases.

Should fix

  1. Merge the repeated role cases. The serve and ordinary tests build the same run and make the same assertions. Use it.each for the role and incumbent-after values so both cases stay covered without maintaining two copies. Otherwise, future changes to the setup and checks need to be repeated.

Verdict: Ship.

Not checked: correctness, security, performance, or test execution; this review was limited to complexity.

Lean: -20 lines possible.

Generated by ✂️ Ponytail Reviewer for #80799 · codex · routed: gpt61 medium · ~7 AIC · ⌖ ~1 AIC · ⊞ 176
Comment /ponytail to run again

expect(serveResult.state.unexplained).toBe(0);
expect(serveResult.lines).toMatchObject([{ note: "no_agent", role: "serve", pair: CHALLENGER, outcome: null, counted: false }]);

const ordinaryResult = applyRun(state, runs, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should fix: merge the repeated role cases. These serve and ordinary cases build the same run and check the same results, so changes to the setup or assertions must be repeated. Use it.each with the role and incumbent-after value as inputs; both checks remain, with roughly 20 fewer lines to maintain.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-bd0e4564-9b4f-48cd-be68-e75a71956fe9","parents":[],"payload":{"id":"ldg-b587ec27-f6fd-48cf-8ba7-37621d5d1b12","operation":"append","value":{"finding_count":0,"head_sha":"a68906a0b655104e930d9a2f2d53a07618ed2db5","outcome":"aligned"}},"sha":"sha256:0abfdfadf7553a719e9154a7e399119785e0d13bfdd7668091390a46740ae4c2","timestamp":"2026-11-24T20:32:25.666Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the changed lines and added tests. I found no actionable correctness, performance, or maintainability issues blocking this PR.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-8ff88128-47bb-48d8-98e6-2a9e25aa1d03","parents":[],"payload":{"id":"ldg-5126caf0-626b-407a-920d-6d2e6d6e6312","operation":"append","value":{"finding_count":0,"head_sha":"a68906a0b655104e930d9a2f2d53a07618ed2db5","outcome":"no_findings"}},"sha":"sha256:d6b7d82bf1c8d526f08a981ee153990910a5a3d13d56afbef40b1a7d4ba9290a","timestamp":"2026-11-24T20:33:29.472Z","type":"ledger_append","version":1}
History

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Account for live exploration roles and unbound receipts even when the agent makes no requests

1 participant