Repository navigation
fix: Gateway regression tests fail after runtime context labeling changes - #168961
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR reuses QA Lab’s runtime-context recognizer in three Gateway fixtures, adds diagnostic traces, and handles blocked-completion notices without issuing another tool effect. Example: The restarted Gateway delivers “Subagent completion delivery is blocked:” as a separate model turn.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it retains useful, maintainer-supported fixture repairs beyond the basic carrier fix now on main, with no actionable introduced defect found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway E2E fixtures send WebSocket requests through an isolated Gateway and inspect serialized provider requests, session state, and tool effects across restart. flowchart LR
A[WebSocket test client] --> B[Isolated Gateway]
B --> C[Provider serialization]
C --> D[Loopback provider fixture]
E[Shared carrier recognizer] --> D
D --> B
B --> F[Session state and tool effects]
F --> G[Regression assertions]
Technical reviewBest possible solution: Retain the shared recognizer and blocked-notice fixture response while preserving all existing behavioral assertions. Do we have a high-confidence way to reproduce the issue? The reported base failures match the inspected serialized-input selectors, and the maintainer records before/after reproduction of the blocked-notice failure; this read-only review ran no tests. Is this the best way to solve the issue? Reusing the existing QA recognizer and teaching the fixture to acknowledge a real notification repairs fixture ownership without weakening whitespace, authority, persistence, or effect assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b77dd5c6557. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +92. Total +93 across 4 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (8 earlier review cycles)
Reviewed October 11, 2026, 10:16 PM ET / October 12, 2026, 02:16 UTC (Revision 9). |
2ead72f to
b7b8071
Compare
Related: #168843 ## What Problem This Solves Fixes duplicate user turns in `chat.history` when a message starts with an inline directive such as `/think high` and continues with an ordinary prompt. ## User Impact One `chat.send` produces one user-history entry, preserving the original prompt and its whitespace. Standalone slash commands, native command errors, and their delivered replies keep their existing history behavior. Existing transcripts are not rewritten. ## Why This Change Was Made Regression introduced by #169026 (`289d859c2babddd9f5aee9dda96fbb94c5107f70`): command mirroring classified a delivered inline acknowledgement by the inbound message's `/` prefix. The normal user-turn owner had already persisted `<run>:user`; command mirroring then persisted the same input again under `command-input:[channel,account,conversation,run]`, with array content instead of string content. The inline-reply producer now records private `inlineCommandReply` metadata. Both block and final transcript-mirror admission honor that ownership fact instead of creating another command exchange. There is no content-based dedupe or text-parser heuristic. A focused suite protects producer metadata and both delivery paths; its existing producer case moved out of an oversized suite without removing assertions. No overlap with Pash/Sarah changes. ## Evidence - Before: the whitespace Gateway RPC test failed on main-based `ed1bc51edb0`, expecting one user message and receiving two identical prompts (string and text-block-array shapes). The two persisted identities were traced to normal turn admission and the command mirror introduced by #169026. - After: `preserves model-input whitespace independently from canonical chat history` passed through the real Gateway and mock provider (two turns, exact whitespace assertions, one history entry per turn). The temporary fixture from #168961 was used, with its replay assertion adjusted to the stable model-prompt projection introduced by #167938; none of those fixture changes are in this PR. - The other eight `gateway-rpc-chat.e2e.test.ts` cases passed in the full-file run. - Four focused unit suites passed: 202 tests, including producer metadata, block/final mirror exclusion, and existing standalone command coverage. - Runtime build, `tsgo:core`, formatting, line-cap growth ratchet, and oxlint on the other four changed files passed. The initial raw oxlint invocation reported the pre-existing over-cap `dispatch-from-config.choose-route.ts`; this file has no counted-line growth. - Independent source review: no remaining findings. Merge danger: **two-way door**. Reverting restores the old inline-acknowledgement mirroring behavior. No schema, stored-data migration, or configuration changes; the blast radius is transcript mirroring of inline command acknowledgements. Co-authored-by: Ayaan Zaidi <[email protected]>
…169451) Related: #168961 ## What Problem This Solves Fixes the QA vision-offload proof failing because it expects the retired developer-role runtime carrier. This is an explicitly requested main CI repair; #168961 updates other runtime-context fixtures but does not touch this scenario. ## User Impact No product behavior changes. The end-to-end proof still requires exactly one image-model request followed by one text-only model request and one visible reply. ## Why This Change Was Made Current Responses serialization carries labeled runtime context as a user-role message. Expect that exact role sequence and explicitly require the current `OpenClaw runtime context:` label. Preserve image counts, model selection, request ordering, image prompt/summary, and single-delivery assertions. ## Evidence Baseline: `5889e62f4902b8f3fa4b6eb2cecbbd26f5b8ceb0`. - Before: the active-model request was `[developer, user, user]`; the fixture expected `[developer, user, developer]` and failed. - After: `vision-channel-offload.e2e.test.ts` passed (1/1), including the added label check and all existing offload/single-reply assertions. - Built `qaRuntime` once and reused prebuilt dist. - `pnpm tsgo:test:root`: all four shards passed; changed-file Oxlint/Oxfmt and line-cap ratchet passed. - Independent autoreview: scoped-clean at P2, no actionable findings. Proof command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/media/vision-channel-offload.e2e.test.ts` (executed alongside the independent memory fixture test). Co-authored-by: Ayaan Zaidi <[email protected]>
|
Pushed
|
…mpaction V2) (#168401) Closes #168088. Related: #168164. ## What Problem This Solves With ChatGPT sign-in, every automatic compaction in OpenClaw ran a client-side summary: separate summarization requests with 0 cached tokens, and a lossy text summary in place of the conversation. Codex compacts the same route server-side ("remote compaction V2"): the next normal model request carries a trailing `{"type":"compaction_trigger"}` item, and the provider returns one opaque `compaction` item that stands in for the history. ## Fix - **Request:** automatic compaction on the ChatGPT route (preflight before a turn, and mid-turn between tool rounds) sends V2 as the next normal request, through the same attempt pipeline and native ChatGPT stream, with `compaction_trigger` appended last. Tools, instructions, parameters, cache key and the full input prefix are the turn's own, so the compaction request reads the warm prompt cache. - **Result:** exactly one non-empty `compaction` item is accepted, only after a successful terminal response and never after an abort. Collection resets for each provider attempt. - **Checkpoint:** real user messages are retained newest-first within 64k tokens, plus the item, matching Codex `compact_remote_v2.rs`. Users retained from an earlier window stay eligible, so repeated compactions keep them. - **Fallback:** every fallback to client compaction logs a WARN with its reason. Overflow recovery, `/compact <focus>` and manual `/compact` stay client-side; manual V2 needs session-writer ownership work and is a follow-up. - **Fixed during live testing** (each with a regression that fails on the defect): 1. V2 never ran: the compact request was checked before the async provider adapter dispatched it. 2. V2 ran only in the managed client; real ChatGPT turns use the native stream. V2 now runs there. 3. Replay normalization dropped the checkpoint turn as an empty failed turn, so the next request grew back to full history. It now keeps successful compaction checkpoints; error turns and suppression markers are still dropped. ## User Impact ChatGPT sign-in sessions compact server-side with no extra summarization requests. Compaction reads 87–100% of its input from cache, and later turns stay at about 14–22k input tokens instead of about 91k. `params.responsesCompactEndpoint: false` turns it off. ## Evidence Live, real ChatGPT OAuth login, `openai/gpt-6-astra`, isolated Gateway, synthetic corpus, three facts seeded before compaction. The host was loaded, so wall times are upper bounds. | Compaction | Compaction input / cached / output | Wall | Input before → after | Next user turn input / cached | Recall | |---|---:|---:|---:|---:|---:| | Preflight | 90,999 / 73,856 / 885 | 20.2 s | 90,999 → 22,308 | 22,439 / 22,144 | 3/3 | | Mid-turn, first | 91,075 / 82,560 / 575 | 12.3 s | 91,075 → 13,904 | 14,121 / 12,928 | 3/3 | | Mid-turn, second | 76,486 / 58,880 / 716 | 17.4 s | 76,486 → 14,476 | 14,709 / 14,336 | 3/3 | Request parity, compaction request vs the preceding normal turn: | Compaction | Tools | Instruction chars | Input prefix | Cached vs previous input | |---|---|---|---|---:| | Preflight | 6 → 6 | 35,857 → 35,857 | 26/26 items identical | 89.3% | | Mid-turn, first | 6 → 6 | 35,855 → 35,855 | 26/26 items identical | 99.8% | | Mid-turn, second | 6 → 6 | 35,855 → 35,855 | 39/39 items identical | 86.7% | The tool schemas, instructions, parameters and cache-key hashes were identical in all three. The final head sent exactly 3 `compaction_trigger` requests, all HTTP 200, and no client-summary requests. **Client comparison (same route, before this change):** one client compaction of a 117.9k-token session took two summary calls (9,777 input, 0 cached, 961 output, 24.4 s). The next turn read 33,967 input with 12,800 cached. Trigger points were not matched to the V2 runs, so this is a reference, not a head-to-head benchmark. **Tests:** fetch-boundary regressions across the managed and native ChatGPT streams cover: - request parity; - failed, cancelled and incomplete terminal responses; - aborts; - duplicate or empty items; - multilingual retention; - two consecutive persisted compactions; - the async-dispatch case and replay normalization through the real `SessionManager`. Negative controls fail on each defect. tsgo core/src/packages pass; `check-changed` passes. ## Release-landing follow-ups (2026.10.2) - **ClawSweeper P2 fix (budget anchor), commit e902124:** V2 used to price the outgoing request with the conservative preflight estimator. That estimator counts unchanged instructions twice, because measured usage already includes them. The V2 boundary now uses the same accounting as the mid-turn precheck it replaces: - The shared code is `resolveProjectedRequestPressure`, split out of `checkMidTurnPrecheck`. - The stream guard's request observation now returns the matching measured predecessor. The foreground request is observed before V2 decides, so both price the same anchor. A checkpoint request is then observed again as its own request. - Requests with no anchor keep the conservative estimate. - Regression test: `chatgpt-v2-compaction.test.ts` "prices a matching measured prefix once before deciding to compact". It uses the 15,000-token / 12,000-char / 24,576 numbers from `attempt-midturn-precheck.test.ts`. It fails on the previous head (the boundary throws `MidTurnPrecheckSignal`) and passes now. - Production LOC: +45/-27. Most of that is the function split plus contract comments. - **Test-only fixture fix, commit 018c9bc:** three Gateway e2e fixtures counted the labeled `OpenClaw runtime context:` carrier as a user turn: `gateway-rpc-chat`, `gateway-provider-review-product-proof` and `gateway-completion-replay`. These fail the same way on `main` (#168843; same fix as #168961). - **Rollback to v2026.10.1:** that release's replay normalization drops the empty, zero-usage V2 checkpoint carrier. The raw transcript is never rewritten, so v2026.10.1 replays the full raw history, and its own client compaction applies if that history is too large. Rollback loses no data; it just loses the provider checkpoint. The stored checkpoint format already shipped in v2026.10.1, and its reader ignores the added optional `outputTokens` (details in the compatibility comment). ### Unrelated failures that also happen on `main` (proof scoped to the tests involved) Both failures reproduce on a clean `origin/main` checkout at `ce5b795128e` with no PR code. Checking out commits around one change shows that both start at 5843d60 (#168539, "route transcript appends through the session actor"): | Test | `5843d60c^` | `5843d60c` | `origin/main` `ce5b795128e` | |---|---|---|---| | `src/agents/embedded-agent-runner.prompt-cache.test.ts` | 4/4 pass | 2 fail (`SqliteTranscriptMutationConflictError` from `appendSessionManagerActor`) | 2 fail | | `test/gateway-steer-fifo.e2e.test.ts` | 7/7 pass | 3 fail (1 model request where 2 are expected) | 3 fail | - #168981 independently reports the prompt-cache failure on clean main. - #169006 (steering diagnostics) landed and did not fix the steer-fifo failures. - CI selects these tests for this PR only through the shared embedded-runner files. Neither failing path is touched here. ### Local proof on the current head All runs below were local and focused on the touched files: - `chatgpt-v2-compaction`: 13/13. - The other affected `src/agents/embedded-agent-runner/run/` unit files: 208/208. These are `attempt-midturn-precheck`, `attempt-prompt-submit.*`, `attempt-stream-*`, `preemptive-compaction*`, `attempt-execution-phase`, `attempt-prompt-preflight` and `attempt-context-guards`. - `agent-runner.runreplyagent.e2e`: 231/231. - The 3 repaired Gateway e2e files: all passed. - `node scripts/check-changed.mjs -- <touched files>` exited 0. That run includes `tsgo` for core and core tests. - Codex protocol check (read directly in `../codex`): `codex-rs/core/src/compact_remote_v2_attempt.rs:70-84` and `compact_remote_v2.rs:65,398-450`. ### Unrelated failures on the current head (b3a7405, which merges `origin/main` at `ff6f58a8c32`) The two failures above (prompt-cache and steer-fifo) no longer fail on this head; main has since landed actor-append fixes. Two other unrelated failures remain: 1. **`src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts`** (5 tests, `checks-node-changed-compact-large-4`): - Fails the same way on a clean `origin/main` checkout at `ff6f58a8c32`, and passes at `bdcbb2d8870` (10/10). - `git bisect` names `e63b5a01cf26` as the first bad commit: #168992, "perf(agents): reduce repeated SQLite work during agent preparation". - This PR does not touch native harness auth. 2. **`extensions/codex/src/app-server/run-attempt.steering-settlement.test.ts`** (`checks-node-changed-extensions-bundle-3`, 180s hook timeout): - Also fails on the unrelated PR #169026 (CI run 38137511377). - Passes locally (2/2) on this head, on clean `origin/main` `ff6f58a8c32`, and on this branch merged with that main. - This PR touches no `extensions/codex` files. Two other failures were flaky: `build-artifacts` (`sqlite-sessions-transcripts-flip-proof.built-cli`) and `gateway-completion-replay`. Each passed on rerun, and each passes locally after `pnpm build` on this head. Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Dallin Romney <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
# Conflicts: # test/e2e/qa-lab/runtime/gateway-provider-review-product-proof.e2e.test.ts # test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts # test/gateway-completion-replay.e2e.test.ts
|
Maintainer override (Ayaan approved landing). ClawSweeper is The only red job,
The main merge resolved the conflicts with #168401's fixture edits by keeping this PR's shared |
…69434) Related: openclaw#168843 ## What Problem This Solves Fixes duplicate user turns in `chat.history` when a message starts with an inline directive such as `/think high` and continues with an ordinary prompt. ## User Impact One `chat.send` produces one user-history entry, preserving the original prompt and its whitespace. Standalone slash commands, native command errors, and their delivered replies keep their existing history behavior. Existing transcripts are not rewritten. ## Why This Change Was Made Regression introduced by openclaw#169026 (`afb47c66b96d2408160ca91de63e3cd930403832`): command mirroring classified a delivered inline acknowledgement by the inbound message's `/` prefix. The normal user-turn owner had already persisted `<run>:user`; command mirroring then persisted the same input again under `command-input:[channel,account,conversation,run]`, with array content instead of string content. The inline-reply producer now records private `inlineCommandReply` metadata. Both block and final transcript-mirror admission honor that ownership fact instead of creating another command exchange. There is no content-based dedupe or text-parser heuristic. A focused suite protects producer metadata and both delivery paths; its existing producer case moved out of an oversized suite without removing assertions. No overlap with Pash/Sarah changes. ## Evidence - Before: the whitespace Gateway RPC test failed on main-based `ed1bc51edb0`, expecting one user message and receiving two identical prompts (string and text-block-array shapes). The two persisted identities were traced to normal turn admission and the command mirror introduced by openclaw#169026. - After: `preserves model-input whitespace independently from canonical chat history` passed through the real Gateway and mock provider (two turns, exact whitespace assertions, one history entry per turn). The temporary fixture from openclaw#168961 was used, with its replay assertion adjusted to the stable model-prompt projection introduced by openclaw#167938; none of those fixture changes are in this PR. - The other eight `gateway-rpc-chat.e2e.test.ts` cases passed in the full-file run. - Four focused unit suites passed: 202 tests, including producer metadata, block/final mirror exclusion, and existing standalone command coverage. - Runtime build, `tsgo:core`, formatting, line-cap growth ratchet, and oxlint on the other four changed files passed. The initial raw oxlint invocation reported the pre-existing over-cap `dispatch-from-config.choose-route.ts`; this file has no counted-line growth. - Independent source review: no remaining findings. Merge danger: **two-way door**. Reverting restores the old inline-acknowledgement mirroring behavior. No schema, stored-data migration, or configuration changes; the blast radius is transcript mirroring of inline command acknowledgements. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#169451) Related: openclaw#168961 ## What Problem This Solves Fixes the QA vision-offload proof failing because it expects the retired developer-role runtime carrier. This is an explicitly requested main CI repair; openclaw#168961 updates other runtime-context fixtures but does not touch this scenario. ## User Impact No product behavior changes. The end-to-end proof still requires exactly one image-model request followed by one text-only model request and one visible reply. ## Why This Change Was Made Current Responses serialization carries labeled runtime context as a user-role message. Expect that exact role sequence and explicitly require the current `OpenClaw runtime context:` label. Preserve image counts, model selection, request ordering, image prompt/summary, and single-delivery assertions. ## Evidence Baseline: `11f576b23cf70615ca4504eb12fdba93591b9c8f`. - Before: the active-model request was `[developer, user, user]`; the fixture expected `[developer, user, developer]` and failed. - After: `vision-channel-offload.e2e.test.ts` passed (1/1), including the added label check and all existing offload/single-reply assertions. - Built `qaRuntime` once and reused prebuilt dist. - `pnpm tsgo:test:root`: all four shards passed; changed-file Oxlint/Oxfmt and line-cap ratchet passed. - Independent autoreview: scoped-clean at P2, no actionable findings. Proof command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/media/vision-channel-offload.e2e.test.ts` (executed alongside the independent memory fixture test). Co-authored-by: Ayaan Zaidi <[email protected]>
…mpaction V2) (openclaw#168401) Closes openclaw#168088. Related: openclaw#168164. ## What Problem This Solves With ChatGPT sign-in, every automatic compaction in OpenClaw ran a client-side summary: separate summarization requests with 0 cached tokens, and a lossy text summary in place of the conversation. Codex compacts the same route server-side ("remote compaction V2"): the next normal model request carries a trailing `{"type":"compaction_trigger"}` item, and the provider returns one opaque `compaction` item that stands in for the history. ## Fix - **Request:** automatic compaction on the ChatGPT route (preflight before a turn, and mid-turn between tool rounds) sends V2 as the next normal request, through the same attempt pipeline and native ChatGPT stream, with `compaction_trigger` appended last. Tools, instructions, parameters, cache key and the full input prefix are the turn's own, so the compaction request reads the warm prompt cache. - **Result:** exactly one non-empty `compaction` item is accepted, only after a successful terminal response and never after an abort. Collection resets for each provider attempt. - **Checkpoint:** real user messages are retained newest-first within 64k tokens, plus the item, matching Codex `compact_remote_v2.rs`. Users retained from an earlier window stay eligible, so repeated compactions keep them. - **Fallback:** every fallback to client compaction logs a WARN with its reason. Overflow recovery, `/compact <focus>` and manual `/compact` stay client-side; manual V2 needs session-writer ownership work and is a follow-up. - **Fixed during live testing** (each with a regression that fails on the defect): 1. V2 never ran: the compact request was checked before the async provider adapter dispatched it. 2. V2 ran only in the managed client; real ChatGPT turns use the native stream. V2 now runs there. 3. Replay normalization dropped the checkpoint turn as an empty failed turn, so the next request grew back to full history. It now keeps successful compaction checkpoints; error turns and suppression markers are still dropped. ## User Impact ChatGPT sign-in sessions compact server-side with no extra summarization requests. Compaction reads 87–100% of its input from cache, and later turns stay at about 14–22k input tokens instead of about 91k. `params.responsesCompactEndpoint: false` turns it off. ## Evidence Live, real ChatGPT OAuth login, `openai/gpt-6-astra`, isolated Gateway, synthetic corpus, three facts seeded before compaction. The host was loaded, so wall times are upper bounds. | Compaction | Compaction input / cached / output | Wall | Input before → after | Next user turn input / cached | Recall | |---|---:|---:|---:|---:|---:| | Preflight | 90,999 / 73,856 / 885 | 20.2 s | 90,999 → 22,308 | 22,439 / 22,144 | 3/3 | | Mid-turn, first | 91,075 / 82,560 / 575 | 12.3 s | 91,075 → 13,904 | 14,121 / 12,928 | 3/3 | | Mid-turn, second | 76,486 / 58,880 / 716 | 17.4 s | 76,486 → 14,476 | 14,709 / 14,336 | 3/3 | Request parity, compaction request vs the preceding normal turn: | Compaction | Tools | Instruction chars | Input prefix | Cached vs previous input | |---|---|---|---|---:| | Preflight | 6 → 6 | 35,857 → 35,857 | 26/26 items identical | 89.3% | | Mid-turn, first | 6 → 6 | 35,855 → 35,855 | 26/26 items identical | 99.8% | | Mid-turn, second | 6 → 6 | 35,855 → 35,855 | 39/39 items identical | 86.7% | The tool schemas, instructions, parameters and cache-key hashes were identical in all three. The final head sent exactly 3 `compaction_trigger` requests, all HTTP 200, and no client-summary requests. **Client comparison (same route, before this change):** one client compaction of a 117.9k-token session took two summary calls (9,777 input, 0 cached, 961 output, 24.4 s). The next turn read 33,967 input with 12,800 cached. Trigger points were not matched to the V2 runs, so this is a reference, not a head-to-head benchmark. **Tests:** fetch-boundary regressions across the managed and native ChatGPT streams cover: - request parity; - failed, cancelled and incomplete terminal responses; - aborts; - duplicate or empty items; - multilingual retention; - two consecutive persisted compactions; - the async-dispatch case and replay normalization through the real `SessionManager`. Negative controls fail on each defect. tsgo core/src/packages pass; `check-changed` passes. ## Release-landing follow-ups (2026.10.2) - **ClawSweeper P2 fix (budget anchor), commit e902124:** V2 used to price the outgoing request with the conservative preflight estimator. That estimator counts unchanged instructions twice, because measured usage already includes them. The V2 boundary now uses the same accounting as the mid-turn precheck it replaces: - The shared code is `resolveProjectedRequestPressure`, split out of `checkMidTurnPrecheck`. - The stream guard's request observation now returns the matching measured predecessor. The foreground request is observed before V2 decides, so both price the same anchor. A checkpoint request is then observed again as its own request. - Requests with no anchor keep the conservative estimate. - Regression test: `chatgpt-v2-compaction.test.ts` "prices a matching measured prefix once before deciding to compact". It uses the 15,000-token / 12,000-char / 24,576 numbers from `attempt-midturn-precheck.test.ts`. It fails on the previous head (the boundary throws `MidTurnPrecheckSignal`) and passes now. - Production LOC: +45/-27. Most of that is the function split plus contract comments. - **Test-only fixture fix, commit 018c9bc:** three Gateway e2e fixtures counted the labeled `OpenClaw runtime context:` carrier as a user turn: `gateway-rpc-chat`, `gateway-provider-review-product-proof` and `gateway-completion-replay`. These fail the same way on `main` (openclaw#168843; same fix as openclaw#168961). - **Rollback to v2026.10.1:** that release's replay normalization drops the empty, zero-usage V2 checkpoint carrier. The raw transcript is never rewritten, so v2026.10.1 replays the full raw history, and its own client compaction applies if that history is too large. Rollback loses no data; it just loses the provider checkpoint. The stored checkpoint format already shipped in v2026.10.1, and its reader ignores the added optional `outputTokens` (details in the compatibility comment). ### Unrelated failures that also happen on `main` (proof scoped to the tests involved) Both failures reproduce on a clean `origin/main` checkout at `02040ecbc92` with no PR code. Checking out commits around one change shows that both start at 9657a374 (openclaw#168539, "route transcript appends through the session actor"): | Test | `9657a374^` | `9657a374` | `origin/main` `02040ecbc92` | |---|---|---|---| | `src/agents/embedded-agent-runner.prompt-cache.test.ts` | 4/4 pass | 2 fail (`SqliteTranscriptMutationConflictError` from `appendSessionManagerActor`) | 2 fail | | `test/gateway-steer-fifo.e2e.test.ts` | 7/7 pass | 3 fail (1 model request where 2 are expected) | 3 fail | - openclaw#168981 independently reports the prompt-cache failure on clean main. - openclaw#169006 (steering diagnostics) landed and did not fix the steer-fifo failures. - CI selects these tests for this PR only through the shared embedded-runner files. Neither failing path is touched here. ### Local proof on the current head All runs below were local and focused on the touched files: - `chatgpt-v2-compaction`: 13/13. - The other affected `src/agents/embedded-agent-runner/run/` unit files: 208/208. These are `attempt-midturn-precheck`, `attempt-prompt-submit.*`, `attempt-stream-*`, `preemptive-compaction*`, `attempt-execution-phase`, `attempt-prompt-preflight` and `attempt-context-guards`. - `agent-runner.runreplyagent.e2e`: 231/231. - The 3 repaired Gateway e2e files: all passed. - `node scripts/check-changed.mjs -- <touched files>` exited 0. That run includes `tsgo` for core and core tests. - Codex protocol check (read directly in `../codex`): `codex-rs/core/src/compact_remote_v2_attempt.rs:70-84` and `compact_remote_v2.rs:65,398-450`. ### Unrelated failures on the current head (b3a7405, which merges `origin/main` at `3dc543d9ee8`) The two failures above (prompt-cache and steer-fifo) no longer fail on this head; main has since landed actor-append fixes. Two other unrelated failures remain: 1. **`src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts`** (5 tests, `checks-node-changed-compact-large-4`): - Fails the same way on a clean `origin/main` checkout at `3dc543d9ee8`, and passes at `596e31d1764` (10/10). - `git bisect` names `70e895e21606` as the first bad commit: openclaw#168992, "perf(agents): reduce repeated SQLite work during agent preparation". - This PR does not touch native harness auth. 2. **`extensions/codex/src/app-server/run-attempt.steering-settlement.test.ts`** (`checks-node-changed-extensions-bundle-3`, 180s hook timeout): - Also fails on the unrelated PR openclaw#169026 (CI run 38137511377). - Passes locally (2/2) on this head, on clean `origin/main` `3dc543d9ee8`, and on this branch merged with that main. - This PR touches no `extensions/codex` files. Two other failures were flaky: `build-artifacts` (`sqlite-sessions-transcripts-flip-proof.built-cli`) and `gateway-completion-replay`. Each passed on rerun, and each passes locally after `pnpm build` on this head. Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Dallin Romney <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…nges (openclaw#168961) ## What Problem This Solves Fixes Gateway regression checks that select serialized runtime-context carriers instead of the user turn when provider serialization labels both as user messages. Fixes openclaw#168843 ## Why This Change Was Made The three Gateway fixtures filter carriers with QA Lab’s shared recognizer through its extension API. Their behavioral assertions remain intact, and the output now records the selected turn, provider review pause, and requester effect across restart. ## User Impact No runtime behavior changes. Maintainers can verify that these Gateway regression scenarios select the intended turn and preserve their outcomes through a provider pause and Gateway restart. ## Evidence - Before: base `573046d` reproduced the three selector failures; 8 of 11 tests passed. - After: exact head `b7b8071713d191801004668a2b63127d0001adae` passed all 11 tests against a built Gateway with local WebSocket clients and loopback Responses fixtures. - Runtime traces show one serialized carrier skipped, the review seed persisted as continuable after the provider pause, and the requester effect remained at one call and one file line after restart. ```text $ OPENCLAW_E2E_USE_PREBUILT_DIST=1 pnpm test:e2e:gateway \ test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts \ test/e2e/qa-lab/runtime/gateway-provider-review-product-proof.e2e.test.ts \ test/gateway-completion-replay.e2e.test.ts --reporter=verbose --silent=false [gateway-rpc-chat-runtime-proof] {"turn":1,"gatewayRunStatus":"ok","serializedRuntimeCarriersSkipped":1,"selectedUserTurns":1,"latestPromptSelected":true,"persistedHistoryContainsPrompt":true} [gateway-rpc-chat-runtime-proof] {"turn":2,"gatewayRunStatus":"ok","serializedRuntimeCarriersSkipped":1,"selectedUserTurns":2,"latestPromptSelected":true,"persistedHistoryContainsPrompt":true} [provider-review-runtime-proof] {"phase":"provider-review-pause","seed":"allowed","httpStatus":403,"errorCode":"misalignment_policy_violation","runtimeCarriersSkipped":1,"selectedSeed":true} [provider-review-runtime-proof] {"phase":"gateway-review-seed-paused","gatewayRunStatus":"error","reviewPersisted":true,"canContinue":true,"expectedContinuationReceived":true,"runtimeCarriersSkipped":1} [gateway-completion-replay-provider-proof] {"phase":"requester-selected","serializedRuntimeCarriersSkipped":1,"requesterTurnSelected":true} [gateway-completion-replay-runtime-proof] {"phase":"requester-effect-before-restart","requesterEffectCalls":1,"persistedEffectLines":1,"childDeliveryStatus":"suspended","childSuspendedReason":"permanent_failure"} [gateway-completion-replay-runtime-proof] {"phase":"requester-effect-after-restart","followupStatus":"ok","requesterEffectCalls":1,"persistedEffectLines":1,"effectUnchanged":true} Test Files 3 passed (3) Tests 11 passed (11) ``` <details> <summary>Reproduction proof script</summary> ```bash #!/usr/bin/env bash set -euo pipefail pnpm build:docker OPENCLAW_E2E_USE_PREBUILT_DIST=1 pnpm test:e2e:gateway \ test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts \ test/e2e/qa-lab/runtime/gateway-provider-review-product-proof.e2e.test.ts \ test/gateway-completion-replay.e2e.test.ts --reporter=verbose --silent=false ``` </details> AI-assisted: built with Codex Co-authored-by: Ayaan Zaidi <[email protected]>
…169451) Related: #168961 ## What Problem This Solves Fixes the QA vision-offload proof failing because it expects the retired developer-role runtime carrier. This is an explicitly requested main CI repair; #168961 updates other runtime-context fixtures but does not touch this scenario. ## User Impact No product behavior changes. The end-to-end proof still requires exactly one image-model request followed by one text-only model request and one visible reply. ## Why This Change Was Made Current Responses serialization carries labeled runtime context as a user-role message. Expect that exact role sequence and explicitly require the current `OpenClaw runtime context:` label. Preserve image counts, model selection, request ordering, image prompt/summary, and single-delivery assertions. ## Evidence Baseline: `5889e62f4902b8f3fa4b6eb2cecbbd26f5b8ceb0`. - Before: the active-model request was `[developer, user, user]`; the fixture expected `[developer, user, developer]` and failed. - After: `vision-channel-offload.e2e.test.ts` passed (1/1), including the added label check and all existing offload/single-reply assertions. - Built `qaRuntime` once and reused prebuilt dist. - `pnpm tsgo:test:root`: all four shards passed; changed-file Oxlint/Oxfmt and line-cap ratchet passed. - Independent autoreview: scoped-clean at P2, no actionable findings. Proof command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/media/vision-channel-offload.e2e.test.ts` (executed alongside the independent memory fixture test). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit ba42b57)
…nges (#168961) Fixes Gateway regression checks that select serialized runtime-context carriers instead of the user turn when provider serialization labels both as user messages. Fixes #168843 The three Gateway fixtures filter carriers with QA Lab’s shared recognizer through its extension API. Their behavioral assertions remain intact, and the output now records the selected turn, provider review pause, and requester effect across restart. No runtime behavior changes. Maintainers can verify that these Gateway regression scenarios select the intended turn and preserve their outcomes through a provider pause and Gateway restart. - Before: base `c7a7539` reproduced the three selector failures; 8 of 11 tests passed. - After: exact head `b7b8071713d191801004668a2b63127d0001adae` passed all 11 tests against a built Gateway with local WebSocket clients and loopback Responses fixtures. - Runtime traces show one serialized carrier skipped, the review seed persisted as continuable after the provider pause, and the requester effect remained at one call and one file line after restart. ```text $ OPENCLAW_E2E_USE_PREBUILT_DIST=1 pnpm test:e2e:gateway \ test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts \ test/e2e/qa-lab/runtime/gateway-provider-review-product-proof.e2e.test.ts \ test/gateway-completion-replay.e2e.test.ts --reporter=verbose --silent=false [gateway-rpc-chat-runtime-proof] {"turn":1,"gatewayRunStatus":"ok","serializedRuntimeCarriersSkipped":1,"selectedUserTurns":1,"latestPromptSelected":true,"persistedHistoryContainsPrompt":true} [gateway-rpc-chat-runtime-proof] {"turn":2,"gatewayRunStatus":"ok","serializedRuntimeCarriersSkipped":1,"selectedUserTurns":2,"latestPromptSelected":true,"persistedHistoryContainsPrompt":true} [provider-review-runtime-proof] {"phase":"provider-review-pause","seed":"allowed","httpStatus":403,"errorCode":"misalignment_policy_violation","runtimeCarriersSkipped":1,"selectedSeed":true} [provider-review-runtime-proof] {"phase":"gateway-review-seed-paused","gatewayRunStatus":"error","reviewPersisted":true,"canContinue":true,"expectedContinuationReceived":true,"runtimeCarriersSkipped":1} [gateway-completion-replay-provider-proof] {"phase":"requester-selected","serializedRuntimeCarriersSkipped":1,"requesterTurnSelected":true} [gateway-completion-replay-runtime-proof] {"phase":"requester-effect-before-restart","requesterEffectCalls":1,"persistedEffectLines":1,"childDeliveryStatus":"suspended","childSuspendedReason":"permanent_failure"} [gateway-completion-replay-runtime-proof] {"phase":"requester-effect-after-restart","followupStatus":"ok","requesterEffectCalls":1,"persistedEffectLines":1,"effectUnchanged":true} Test Files 3 passed (3) Tests 11 passed (11) ``` <details> <summary>Reproduction proof script</summary> ```bash set -euo pipefail pnpm build:docker OPENCLAW_E2E_USE_PREBUILT_DIST=1 pnpm test:e2e:gateway \ test/e2e/qa-lab/runtime/gateway-rpc-chat.e2e.test.ts \ test/e2e/qa-lab/runtime/gateway-provider-review-product-proof.e2e.test.ts \ test/gateway-completion-replay.e2e.test.ts --reporter=verbose --silent=false ``` </details> AI-assisted: built with Codex Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 6ce48cb) Backport note (release/2026.10.5): conflicts came from main-only test edits in 52200cf. Took main's version of the two failing fixtures (gateway-provider-review-product-proof, gateway-completion-replay) and kept gateway-rpc-chat.e2e.test.ts unchanged: it passes on this branch, and main's version asserts #167938 replay behavior.
…penclaw#169451) Related: openclaw#168961 ## What Problem This Solves Fixes the QA vision-offload proof failing because it expects the retired developer-role runtime carrier. This is an explicitly requested main CI repair; openclaw#168961 updates other runtime-context fixtures but does not touch this scenario. ## User Impact No product behavior changes. The end-to-end proof still requires exactly one image-model request followed by one text-only model request and one visible reply. ## Why This Change Was Made Current Responses serialization carries labeled runtime context as a user-role message. Expect that exact role sequence and explicitly require the current `OpenClaw runtime context:` label. Preserve image counts, model selection, request ordering, image prompt/summary, and single-delivery assertions. ## Evidence Baseline: `5889e62f4902b8f3fa4b6eb2cecbbd26f5b8ceb0`. - Before: the active-model request was `[developer, user, user]`; the fixture expected `[developer, user, developer]` and failed. - After: `vision-channel-offload.e2e.test.ts` passed (1/1), including the added label check and all existing offload/single-reply assertions. - Built `qaRuntime` once and reused prebuilt dist. - `pnpm tsgo:test:root`: all four shards passed; changed-file Oxlint/Oxfmt and line-cap ratchet passed. - Independent autoreview: scoped-clean at P2, no actionable findings. Proof command: `node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/media/vision-channel-offload.e2e.test.ts` (executed alongside the independent memory fixture test). Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit ba42b57) (cherry picked from commit 257d2cd) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes Gateway regression checks that select serialized runtime-context carriers instead of the user turn when provider serialization labels both as user messages.
Fixes #168843
Why This Change Was Made
The three Gateway fixtures filter carriers with QA Lab’s shared recognizer through its extension API. Their behavioral assertions remain intact, and the output now records the selected turn, provider review pause, and requester effect across restart.
User Impact
No runtime behavior changes. Maintainers can verify that these Gateway regression scenarios select the intended turn and preserve their outcomes through a provider pause and Gateway restart.
Evidence
c7a7539reproduced the three selector failures; 8 of 11 tests passed.b7b8071713d191801004668a2b63127d0001adaepassed all 11 tests against a built Gateway with local WebSocket clients and loopback Responses fixtures.Reproduction proof script
AI-assisted: built with Codex