Skip to content

fix: Gateway regression tests fail after runtime context labeling changes - #168961

Merged
obviyus merged 7 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-168843
Oct 12, 2026
Merged

obviyus merged 7 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-168843

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 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.
$ 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)
Reproduction proof script
#!/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

AI-assisted: built with Codex

@clawsweeper

clawsweeper Bot commented Oct 11, 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The fixture’s catch-all response requests another exec, increasing effectCalls to 2.
  • After: The fixture acknowledges the notice, leaving effectCalls at 1 and replay-effects.txt containing one line.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused fixture repair with relevant shipped-Gateway evidence, preserved behavioral assertions, and no actionable introduced findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied terminal traces exercise a built Gateway through WebSocket clients and loopback provider HTTP, showing carrier exclusion, persisted provider review, and one requester effect across restart; the maintainer additionally observed the standalone blocked-notice path, and the affected files remain unchanged after the subsequent merge.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Maintainers encounter false Gateway regression failures when fixtures select runtime scaffolding or treat a blocked-delivery notification as a completion retry.
Reason: The linked maintainer report and maintainer-authored fixture repair establish value and direction; the remaining changes preserve the existing product contracts.

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
Reviewed head: d3ea1c55b82570963bba2be24e95c8da1e21884c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +1, Tests +92. Total +93 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 3 158 66 +92
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 159 66 +93

Review metrics

Metric Value Why it matters
Production versus test LOC Production +1; tests +158/-66, net +92 The production addition exposes an existing helper; test growth mostly records boundary observations without adding duplicate scenarios.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #168843
Summary: The canonical issue reports these fixture selectors; a merged PR fixes basic current-label matching, while this PR retains additional fixture work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The repair improves Gateway regression reliability without changing user runtime behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 execution lanes are retired.

History

Review history (8 earlier review cycles)
  • reviewed 2026-10-11T07:04:53.666Z sha 2ead72fa51417680926ff7fdf75b6cbb1ab272d6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T09:14:54.336Z sha b7b8071 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T20:24:50.935Z sha ed1bc51 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T22:58:44.818Z sha a1d733d :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T00:03:09.053Z sha 989de96 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T00:11:01.038Z sha 989de96 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T00:23:41.311Z sha 9be89d0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-12T02:02:22.398Z sha 3b9f83e :: needs maintainer review before merge. :: none

Reviewed October 11, 2026, 10:16 PM ET / October 12, 2026, 02:16 UTC (Revision 9).

@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-168843 branch from 2ead72f to b7b8071 Compare October 11, 2026 09:07
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Oct 12, 2026
obviyus added a commit that referenced this pull request Oct 12, 2026
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]>
obviyus added a commit that referenced this pull request Oct 12, 2026
…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]>
@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Pushed 3b9f83e985 (maintainer edit): the completion-replay fixture now answers the durable "Subagent completion delivery is blocked" notice.

  • Cause: after restart, that notice can run as its own model turn. The fake model's catch-all branch treated it as a completion retry and emitted a second exec, so effectCalls became 2 (CI job 114612897667). Whether it failed depended on timing: the notice is sometimes folded into the next prompt.
  • Proof: before the change, 2 of 3 local runs failed at line 159. After it, 3 of 3 passed with effectCalls=1 and the effect file unchanged; in one run the notice ran as its own request, the exact failure path.
  • The producer (subagent-completion-mutation.kernel.ts:217-233) predates this PR; this is a fixture fix only.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 12, 2026
obviyus added a commit that referenced this pull request Oct 12, 2026
…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
@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Maintainer override (Ayaan approved landing). ClawSweeper is ready on d3ea1c55b8. Every fixture lane this PR targets is green on this head: gateway-rpc-chat, completion-replay, provider-review, plus the qa-lab lanes fixed on main by #169450, #169451, #169475, #169476 and #169478.

The only red job, checks-node-compact-small-7 (test/scripts/eager-import-closure.test.ts, "resolves wrapper package exports…": duplicate src/chat/sender-identity.ts, src/sessions/input-provenance.ts, src/sessions/user-turn-transcript.metadata.ts), is inherited from main:

  • Pinned base: locally, this head and its main parent 52200cffda2 (main without this PR) give the same result, 3 failed / 14 passed of 17.
  • This PR touches only test fixtures and one qa-lab test export, none of those source files.

The main merge resolved the conflicts with #168401's fixture edits by keeping this PR's shared isInternalRuntimeContextCarrierText predicate instead of three local copies. Thanks @sunlit-deng.

@obviyus
obviyus merged commit 6ce48cb into openclaw:main Oct 12, 2026
120 of 123 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…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]>
RomneyDa pushed a commit that referenced this pull request Oct 16, 2026
…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)
RomneyDa pushed a commit that referenced this pull request Oct 16, 2026
…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.
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three Gateway e2e tests fail on main: fixtures still match the old runtime-context envelope

2 participants