Skip to content

test(agentsapi): expect rescoped retries after steering to succeed - #168569

Merged
steipete merged 1 commit into
mainfrom
fix/agentsapi-steering-terminal-status
Oct 10, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/agentsapi-steering-terminal-status

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Related: #168337 (inherited failure), #168394, #168014, #161444

What Problem This Solves

Fixes: extensions/agentsapi/agentsapi-attempt.test.ts fails on main (3 of 12) because three retry-after-steering cases still expect an admission failure that #168394 intentionally removed.

User Impact

No user-visible change. Clears an inherited main failure that PRs such as #168337 currently carry.

Why This Change Was Made

#161444 made same-run Agents API retries survive accepted steering by keeping the prepared prompt history. At that time, confirming which run consumed a steering message rewrote that row and rotated the transcript generation. Retries that changed scope (new run ID, reset native binding, new context budget) therefore reread history and failed with Current-turn transcript admission identity changed. Those three cases recorded that failure as the expected outcome.

#168394 (fixes #168014) made steering confirmation keep the running turn's admission. The rescoped retries now reread the same admission-fenced prefix and succeed, which is the behavior #161444 was working toward. The test now asserts that contract:

  • same run reuses the retained history (no reread);
  • new run, reset binding, and new budget reread once, finish ok, and still see only the prior history (not widened, no hook-mutation leakage);
  • cancelled and revoked are unchanged.

Production code is unchanged. The retained-history path still matters because every other in-place transcript rewrite still rotates the generation.

Evidence

  • Reproduced on current main (9c37dbf3e90b): the original file fails 3 of 12 with the same signature recorded for fix(ui): retain test coverage when files use TSX #168337 (expected failed, received ok).
  • With this change on the same base: 12 of 12 pass. pnpm test extensions/agentsapi/agentsapi-attempt.test.ts --maxWorkers=1 took 2 min 4 s wall on a loaded Mac (load ~30, mostly worker preparation); the six retry cases took 1.3–8.9 s each under that load.
  • Causal A/B: reverting only fix: preserve context-engine advancement after steering #168394's generation guard in rewriteSqliteTranscriptEventRowsInTransaction makes the original test pass 12 of 12 and makes this updated test fail exactly the three rescoped cases (expected { kind: 'failed', … } to deeply equal { kind: 'ok' }). The guard was restored afterward.
  • PR CI on this exact head ran the file in checks-node-changed-extensions-config (job 114271287353): 12 of 12 passed; the six retry cases took 236–467 ms each. openclaw/ci-gate is green.
  • Testbox (run 38073003390, Linux) on this head reran fix(ui): retain test coverage when files use TSX #168337's exact original commands: agentsapi 12/12 (34 s wall with pnpm test … --maxWorkers=1, 27 s with the CI runtime policy), memory backoff 6/6, and the models e2e 8/8 after pnpm build qaRuntime. pnpm check:changed passed every lane for this file (format, ratchets, plugin boundaries, extension-test typecheck). Its only red was the repo-wide dead-export scan, on tools/solid-lint/index.mjs (already fixed on main by 61621f7) and two sessions-channel-fixture.test-support.ts stubs from feat: choose when sessions can send and receive messages #162316. This PR touches neither.
  • The test adds no timers, sleeps, or new fixtures; it only adds one vi.spyOn on SessionManager.openModelContextAsync, which agentsapi-attempt.ts calls in exactly one place.
  • Codex autoreview (P2 threshold): scoped-clean, no actionable findings.
  • Pre-commit formatting passed; scoped oxfmt check passed.

The other inherited failures from #168337's list are already fixed on main and need no PR (both pass in the Testbox run above): manager-search-reindex-backoff.test.ts by 0a687e8 (#168465; it seeds fresh content because unchanged chunks reuse embeddings) and cli-json-stdout.models.e2e.test.ts by d0e1bbc.

#168394 stopped steering confirmation from rotating the transcript
generation, so the foreground admission stays valid. Retries after
accepted steering with a new run, a reset native binding, or a new
context budget now reread the same admission-fenced prefix and finish
ok instead of failing with "Current-turn transcript admission identity
changed". Assert that contract: same-run retries reuse retained history,
rescoped retries reread once without widening it, and cancelled or
revoked retries keep their terminal outcomes.
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Updates Agents API retry tests to expect successful retries after steering when the run, native binding, or context budget changes.

Example: After accepting “Use the updated result.” as steering, retry with a 32,000-token context budget.

  • Before: The test expects an admission failure, although production returns success.
  • After: The test expects success and verifies that rereading history includes only the earlier request.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, correct test repair with exact-head CI support; behavioral evidence is an in-process harness, and no additional live proof is required for this test-only change.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR changes no shipped behavior; its harness exercises the real attempt and transcript owners with mocked provider operations.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Obsolete assertions report failures for successful retries after accepted steering.
Reason: Restores useful coverage for an intentional merged contract without changing runtime behavior or adding a new policy.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs obsolete test expectations after the merged steering fix, preserves meaningful coverage, and introduces no actionable defect.

Priority: P2
Reviewed head: fb9732034d2f8de5ec8f4225f8d325ffac52b237

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Agents API attempt owner prepares bounded transcript history for prompt hooks, runs the native session, and returns the terminal outcome and reply; these tests exercise retries through that owner with real transcript storage and mocked provider operations.

flowchart LR
  A[Retry fixture] --> B[Agents API attempt]
  B --> C[Retained history]
  B --> D[Admission fenced transcript read]
  C --> E[Prompt hooks]
  D --> E
  E --> F[Native session fixture]
  F --> G[Terminal and history assertions]
Loading

Technical review

Best possible solution:

Merge the focused expectation repair while retaining the existing retry-history and interruption coverage.

Do we have a high-confidence way to reproduce the issue?

Current source explains the obsolete failure expectations, and the PR reports a targeted production-revert comparison; no tests were run during this read-only review.

Is this the best way to solve the issue?

This is the appropriate repair because the successful retry behavior is intentional and already merged, while the updated assertions continue checking bounded history and interruption outcomes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 171df4e1c5a0.

Provenance checked

  • Retry-after-steering expectations changes intended behavior with a stated reason (8c2379b: Retain bounded history for same-run retries while rescoped retries reread strict admissions; steering confirmation then invalidated those admissions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Sarah Fortune: Raw commit 8c2379b adds extensions/agentsapi/agentsapi-attempt.test.ts:245 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8c2379be3505; files: extensions/agentsapi/agentsapi-attempt.test.ts)
  • Peter Steinberger: Raw commit b0e5f30 adds src/config/sessions/session-accessor.sqlite-transcript-store.ts:508 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b0e5f302dd8d; files: src/config/sessions/session-accessor.sqlite-transcript-store.ts)

PR surface

Tests -7. Total -7 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 6 13 -7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 6 13 -7

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repairs a concrete main-branch test failure with no production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T17:33:24.957Z sha fb97320 :: needs maintainer review before merge. :: none

Reviewed October 10, 2026, 2:14 PM ET / 18:14 UTC (Revision 2).

@steipete
steipete merged commit aec6e7a into main Oct 10, 2026
104 of 105 checks passed
@steipete
steipete deleted the fix/agentsapi-steering-terminal-status branch October 10, 2026 18:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…penclaw#168569)

openclaw#168394 stopped steering confirmation from rotating the transcript
generation, so the foreground admission stays valid. Retries after
accepted steering with a new run, a reset native binding, or a new
context budget now reread the same admission-fenced prefix and finish
ok instead of failing with "Current-turn transcript admission identity
changed". Assert that contract: same-run retries reuse retained history,
rescoped retries reread once without widening it, and cancelled or
revoked retries keep their terminal outcomes.

Co-authored-by: Peter Steinberger <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 11, 2026
…168569)

#168394 stopped steering confirmation from rotating the transcript
generation, so the foreground admission stays valid. Retries after
accepted steering with a new run, a reset native binding, or a new
context budget now reread the same admission-fenced prefix and finish
ok instead of failing with "Current-turn transcript admission identity
changed". Assert that contract: same-run retries reuse retained history,
rescoped retries reread once without widening it, and cancelled or
revoked retries keep their terminal outcomes.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit aec6e7a)
RomneyDa pushed a commit that referenced this pull request Oct 14, 2026
…168569)

#168394 stopped steering confirmation from rotating the transcript
generation, so the foreground admission stays valid. Retries after
accepted steering with a new run, a reset native binding, or a new
context budget now reread the same admission-fenced prefix and finish
ok instead of failing with "Current-turn transcript admission identity
changed". Assert that contract: same-run retries reuse retained history,
rescoped retries reread once without widening it, and cancelled or
revoked retries keep their terminal outcomes.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit aec6e7a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: agentsapi P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant