Repository navigation
fix(sessions): let a fallback run after the turn was dispatched without a projection - #206969
Conversation
…ut a projection - A turn already sent to a provider without a model prompt projection is frozen as its transcript text; a later fallback candidate's capture no longer writes or throws. - Covers an inter-session turn whose embedded primary failed and whose Codex fallback refused with "Model prompt projection must be captured before provider dispatch".
|
🦞👀 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. |
…ws an unprojected dispatch - A harness that marks the turn sent without capturing, then an embedded fallback with hook context, failed with the post-dispatch capture error; skip projecting instead of throwing.
|
Codex review: passed. What this changesAllows fallback attempts to continue when an earlier candidate dispatched the user turn without capturing a model prompt projection. Example: An embedded candidate sends a forwarded sessions_send turn, hits a rate limit, and falls back to Codex.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a current fallback failure with a small recorder-owned fix, and source review found no definite introduced bug. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe transcript recorder preserves admitted user text and optional model-facing projections; embedded and Codex attempts consume that state before sending provider requests. flowchart TD
A[Admitted user turn] --> B[Transcript recorder]
B --> C[Embedded candidate]
C --> D[Provider failure]
D --> E[Fallback candidate]
E --> B
B --> F[Unchanged transcript and provider dispatch]
Technical reviewBest possible solution: Keep the recorder-owned no-write outcome and the embedded consumer adjustment as the focused fallback repair. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the failure when an unprojected recorder is marked dispatched and a fallback captures; the author reports matching production failure and red-before/green-after tests, which this read-only review did not execute. Is this the best way to solve the issue? The change fixes the shared recorder contract without adding another owner, preserves existing frozen projections, and updates the embedded consumer for the newly valid no-projection result. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aa2bed94c387. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +6, Tests +83. Total +89 across 6 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 27, 2026, 5:04 PM ET / 22:04 UTC. |
… who builds the prompt (#207022) ## Problem #206969 stopped a fallback model from failing a turn that an earlier model had already sent without a frozen model prompt (a "projection"). It did that by tolerating the missing projection for every harness. That tolerance also hid real gaps in the embedded runner, which is supposed to freeze every turn before sending it: - An inter-session message (`sessions_send`) whose text was unchanged was sent without a projection. This is the case that failed a production turn. - A turn that compaction removed from the request (a keyless turn) was sent without a projection. ## Fix - Harnesses declare who builds the prompt with a new optional field, `promptProjection: "captures" | "external"`. The default is `"external"`, so undeclared third-party harnesses behave as before. - The built-in embedded harness declares `"captures"`. Codex declares `"external"`, because its app-server builds its own turn input. - The harness lifecycle records the declaration for one attempt only. The first send locks it in, and an attempt that never sent clears it. - After a `"captures"` send, a late capture is an error again. The #206969 tolerance now applies only to `"external"` sends. - The embedded runner makes that true. Unchanged inter-session text is now frozen too. Before the first send of an attempt, a turn that the prompt transform could not project is frozen as its own transcript text, so no fallback ever re-captures it. - The new field is documented in `docs/plugins/sdk-agent-harness/core-ownership.md`. ## User impact None visible on the normal path. A turn the embedded runner sends now always carries the text the provider received, so a later fallback on any harness replays the same bytes. Third-party harnesses that do not declare the field keep the current behavior. ## Evidence - Red on main, green here: - The compacted keyless turn is frozen before dispatch, and the retained turn keeps no projection. - Inter-session turns are stored with their sent envelope (plain, forwarded and hook bodies). - A built-in (`"captures"`) send without a projection makes a later capture throw; an undeclared harness keeps the tolerance. - An attempt that never sent cannot apply its `"captures"` declaration to a later send outside the lifecycle. - Projection and fallback suites on both routes pass: embedded submit, context and boundary, the recorder, the harness lifecycle, and the Codex app-server prompt projection. Co-authored-by: Ayaan Zaidi <[email protected]>
…ut a projection (#206969) On a production deployment, one user turn failed with "All models failed": two fallback models refused it with `Model prompt projection must be captured before provider dispatch`. The turn was a forwarded inter-session message (`sessions_send`). The primary model ran on the embedded runner, sent the turn unchanged without a model prompt projection (by design for unchanged inter-session text), and then hit a rate limit. The fallback models ran on the Codex harness. Its capture step only checks whether a projection already exists, so it tried to freeze one after the turn had already reached a provider. The transcript recorder correctly refused the write and threw, so every Codex fallback failed and the user got no answer. The transcript recorder owns the "capture before dispatch" rule. A turn that was already sent without a projection is now treated as frozen at its transcript text: a later candidate's capture or prepare makes no write and returns the message unchanged. A dispatch that races a capture write still throws, as before. The embedded runner, which threw when capture returned no projection, now keeps the transcript text for that turn. Production code: +7 / −4. A fallback candidate no longer fails a turn that an earlier candidate already sent without a projection, on any harness (Gateway and `openclaw agent`). The stored turn keeps the text the first provider received. - New test `extensions/codex/src/app-server/run-attempt.prompt-projection.test.ts` ("runs after an earlier candidate dispatched the turn without a projection"). It fails on main with the production error and passes with this change. - New test `src/agents/embedded-agent-runner/run/attempt-prompt-submit.projections.test.ts` ("sends the transcript text when an earlier candidate dispatched without a projection"): a harness that sends without capturing, then an embedded fallback with hook context. It fails on main (the fallback never reaches the provider) and passes with this change. - Updated recorder contract test `src/sessions/user-turn-transcript.test.ts`: a sent turn is still never given a projection; capture now resolves without one instead of throwing. - Projection suites on both routes pass: `attempt-prompt-submit.projections.test.ts` and `attempt-prompt-context.test.ts` (embedded), and `run-attempt.prompt-projection.test.ts` (Codex). On such a fallback, Codex still sends its own hook-wrapped prompt for that attempt; the stored canonical text stays the transcript text. This matches how Codex treated every turn before projections existed. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d22090c) Backport adaptation: Use the release Codex started-thread fixture rather than importing the adjacent main-only Codex test helper and existing-projection test. Codex ingress checked at d32063f96c app-server-protocol/src/protocol/v2/turn.rs:181 and app-server/src/request_processors/turn_processor.rs:575. Co-authored-by: RomneyDa <[email protected]>
… who builds the prompt (#207022) ## Problem #206969 stopped a fallback model from failing a turn that an earlier model had already sent without a frozen model prompt (a "projection"). It did that by tolerating the missing projection for every harness. That tolerance also hid real gaps in the embedded runner, which is supposed to freeze every turn before sending it: - An inter-session message (`sessions_send`) whose text was unchanged was sent without a projection. This is the case that failed a production turn. - A turn that compaction removed from the request (a keyless turn) was sent without a projection. ## Fix - Harnesses declare who builds the prompt with a new optional field, `promptProjection: "captures" | "external"`. The default is `"external"`, so undeclared third-party harnesses behave as before. - The built-in embedded harness declares `"captures"`. Codex declares `"external"`, because its app-server builds its own turn input. - The harness lifecycle records the declaration for one attempt only. The first send locks it in, and an attempt that never sent clears it. - After a `"captures"` send, a late capture is an error again. The #206969 tolerance now applies only to `"external"` sends. - The embedded runner makes that true. Unchanged inter-session text is now frozen too. Before the first send of an attempt, a turn that the prompt transform could not project is frozen as its own transcript text, so no fallback ever re-captures it. - The new field is documented in `docs/plugins/sdk-agent-harness/core-ownership.md`. ## User impact None visible on the normal path. A turn the embedded runner sends now always carries the text the provider received, so a later fallback on any harness replays the same bytes. Third-party harnesses that do not declare the field keep the current behavior. ## Evidence - Red on main, green here: - The compacted keyless turn is frozen before dispatch, and the retained turn keeps no projection. - Inter-session turns are stored with their sent envelope (plain, forwarded and hook bodies). - A built-in (`"captures"`) send without a projection makes a later capture throw; an undeclared harness keeps the tolerance. - An attempt that never sent cannot apply its `"captures"` declaration to a later send outside the lifecycle. - Projection and fallback suites on both routes pass: embedded submit, context and boundary, the recorder, the harness lifecycle, and the Codex app-server prompt projection. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 4266586) Backport adaptation: Applies cleanly after the batch fallback-projection fix; retain the source harness declaration and transcript freeze unchanged. Co-authored-by: RomneyDa <[email protected]>
…ut a projection (#206969) ## Problem On a production deployment, one user turn failed with "All models failed": two fallback models refused it with `Model prompt projection must be captured before provider dispatch`. The turn was a forwarded inter-session message (`sessions_send`). The primary model ran on the embedded runner, sent the turn unchanged without a model prompt projection (by design for unchanged inter-session text), and then hit a rate limit. The fallback models ran on the Codex harness. Its capture step only checks whether a projection already exists, so it tried to freeze one after the turn had already reached a provider. The transcript recorder correctly refused the write and threw, so every Codex fallback failed and the user got no answer. ## Fix The transcript recorder owns the "capture before dispatch" rule. A turn that was already sent without a projection is now treated as frozen at its transcript text: a later candidate's capture or prepare makes no write and returns the message unchanged. A dispatch that races a capture write still throws, as before. The embedded runner, which threw when capture returned no projection, now keeps the transcript text for that turn. Production code: +7 / −4. ## User impact A fallback candidate no longer fails a turn that an earlier candidate already sent without a projection, on any harness (Gateway and `openclaw agent`). The stored turn keeps the text the first provider received. ## Evidence - New test `extensions/codex/src/app-server/run-attempt.prompt-projection.test.ts` ("runs after an earlier candidate dispatched the turn without a projection"). It fails on main with the production error and passes with this change. - New test `src/agents/embedded-agent-runner/run/attempt-prompt-submit.projections.test.ts` ("sends the transcript text when an earlier candidate dispatched without a projection"): a harness that sends without capturing, then an embedded fallback with hook context. It fails on main (the fallback never reaches the provider) and passes with this change. - Updated recorder contract test `src/sessions/user-turn-transcript.test.ts`: a sent turn is still never given a projection; capture now resolves without one instead of throwing. - Projection suites on both routes pass: `attempt-prompt-submit.projections.test.ts` and `attempt-prompt-context.test.ts` (embedded), and `run-attempt.prompt-projection.test.ts` (Codex). ## Not covered On such a fallback, Codex still sends its own hook-wrapped prompt for that attempt; the stored canonical text stays the transcript text. This matches how Codex treated every turn before projections existed. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d22090c) Co-authored-by: RomneyDa <[email protected]>
…ut a projection (openclaw#206969) ## Problem On a production deployment, one user turn failed with "All models failed": two fallback models refused it with `Model prompt projection must be captured before provider dispatch`. The turn was a forwarded inter-session message (`sessions_send`). The primary model ran on the embedded runner, sent the turn unchanged without a model prompt projection (by design for unchanged inter-session text), and then hit a rate limit. The fallback models ran on the Codex harness. Its capture step only checks whether a projection already exists, so it tried to freeze one after the turn had already reached a provider. The transcript recorder correctly refused the write and threw, so every Codex fallback failed and the user got no answer. ## Fix The transcript recorder owns the "capture before dispatch" rule. A turn that was already sent without a projection is now treated as frozen at its transcript text: a later candidate's capture or prepare makes no write and returns the message unchanged. A dispatch that races a capture write still throws, as before. The embedded runner, which threw when capture returned no projection, now keeps the transcript text for that turn. Production code: +7 / −4. ## User impact A fallback candidate no longer fails a turn that an earlier candidate already sent without a projection, on any harness (Gateway and `openclaw agent`). The stored turn keeps the text the first provider received. ## Evidence - New test `extensions/codex/src/app-server/run-attempt.prompt-projection.test.ts` ("runs after an earlier candidate dispatched the turn without a projection"). It fails on main with the production error and passes with this change. - New test `src/agents/embedded-agent-runner/run/attempt-prompt-submit.projections.test.ts` ("sends the transcript text when an earlier candidate dispatched without a projection"): a harness that sends without capturing, then an embedded fallback with hook context. It fails on main (the fallback never reaches the provider) and passes with this change. - Updated recorder contract test `src/sessions/user-turn-transcript.test.ts`: a sent turn is still never given a projection; capture now resolves without one instead of throwing. - Projection suites on both routes pass: `attempt-prompt-submit.projections.test.ts` and `attempt-prompt-context.test.ts` (embedded), and `run-attempt.prompt-projection.test.ts` (Codex). ## Not covered On such a fallback, Codex still sends its own hook-wrapped prompt for that attempt; the stored canonical text stays the transcript text. This matches how Codex treated every turn before projections existed. Co-authored-by: Ayaan Zaidi <[email protected]>
… who builds the prompt (openclaw#207022) ## Problem openclaw#206969 stopped a fallback model from failing a turn that an earlier model had already sent without a frozen model prompt (a "projection"). It did that by tolerating the missing projection for every harness. That tolerance also hid real gaps in the embedded runner, which is supposed to freeze every turn before sending it: - An inter-session message (`sessions_send`) whose text was unchanged was sent without a projection. This is the case that failed a production turn. - A turn that compaction removed from the request (a keyless turn) was sent without a projection. ## Fix - Harnesses declare who builds the prompt with a new optional field, `promptProjection: "captures" | "external"`. The default is `"external"`, so undeclared third-party harnesses behave as before. - The built-in embedded harness declares `"captures"`. Codex declares `"external"`, because its app-server builds its own turn input. - The harness lifecycle records the declaration for one attempt only. The first send locks it in, and an attempt that never sent clears it. - After a `"captures"` send, a late capture is an error again. The openclaw#206969 tolerance now applies only to `"external"` sends. - The embedded runner makes that true. Unchanged inter-session text is now frozen too. Before the first send of an attempt, a turn that the prompt transform could not project is frozen as its own transcript text, so no fallback ever re-captures it. - The new field is documented in `docs/plugins/sdk-agent-harness/core-ownership.md`. ## User impact None visible on the normal path. A turn the embedded runner sends now always carries the text the provider received, so a later fallback on any harness replays the same bytes. Third-party harnesses that do not declare the field keep the current behavior. ## Evidence - Red on main, green here: - The compacted keyless turn is frozen before dispatch, and the retained turn keeps no projection. - Inter-session turns are stored with their sent envelope (plain, forwarded and hook bodies). - A built-in (`"captures"`) send without a projection makes a later capture throw; an undeclared harness keeps the tolerance. - An attempt that never sent cannot apply its `"captures"` declaration to a later send outside the lifecycle. - Projection and fallback suites on both routes pass: embedded submit, context and boundary, the recorder, the harness lifecycle, and the Codex app-server prompt projection. Co-authored-by: Ayaan Zaidi <[email protected]>
…projection Release adaptation of #206969 (eca1051, cherry-picked from d22090c) for 2026.11.12. On main the capture lives inside a per-target loop, so the upstream change uses `continue`. The v2026.11.11 owner handles a single projection target, so the clean textual merge produced a `continue` outside any loop and the module no longer compiled. Skip only the runtime projection replacement for that target instead, which keeps the transcript text exactly as the upstream fix intends. Co-authored-by: RomneyDa <[email protected]>
* fix: show Claude CLI document uploads only once in chat * fix: show Claude CLI document uploads only once in chat OpenClaw-Publication: 4555cb04-bff2-43b3-aff8-ec271d6567b2 * fix: keep Claude document uploads on the message that sent them * fix: preserve the released message queue result contract Release adaptation: Use an optional accepted-input observer instead of widening queueMessage's released Promise<void> contract. Reuse the stable steering and transcript-rewrite handlers; leave source admission, native image steering, config, and all SQLite schemas unchanged. The existing history index columns also carry exact document correlation. Keep the released model-hook test layout. Companion audit through be407a4: no later #203866 reference. PRs #208535 (Claude compacted fork summaries), #206158 (native subagent status), and #205663 (image dimensions) are separate. PRs #208252 (Codex source), #207022 (embedded prompt dispatch), #206969 (fallback), #205963 (Copilot question policy), and 50a7368 (snooze) do not own this path. SHA mentions in #204700 and #204685 are update/qualification records, not follow-ups. (cherry picked from commit 269f884) Co-authored-by: RomneyDa <[email protected]>
Problem
On a production deployment, one user turn failed with "All models failed": two fallback models refused it with
Model prompt projection must be captured before provider dispatch.The turn was a forwarded inter-session message (
sessions_send). The primary model ran on the embedded runner, sent the turn unchanged without a model prompt projection (by design for unchanged inter-session text), and then hit a rate limit. The fallback models ran on the Codex harness. Its capture step only checks whether a projection already exists, so it tried to freeze one after the turn had already reached a provider. The transcript recorder correctly refused the write and threw, so every Codex fallback failed and the user got no answer.Fix
The transcript recorder owns the "capture before dispatch" rule. A turn that was already sent without a projection is now treated as frozen at its transcript text: a later candidate's capture or prepare makes no write and returns the message unchanged. A dispatch that races a capture write still throws, as before. The embedded runner, which threw when capture returned no projection, now keeps the transcript text for that turn.
Production code: +7 / −4.
User impact
A fallback candidate no longer fails a turn that an earlier candidate already sent without a projection, on any harness (Gateway and
openclaw agent). The stored turn keeps the text the first provider received.Evidence
extensions/codex/src/app-server/run-attempt.prompt-projection.test.ts("runs after an earlier candidate dispatched the turn without a projection"). It fails on main with the production error and passes with this change.src/agents/embedded-agent-runner/run/attempt-prompt-submit.projections.test.ts("sends the transcript text when an earlier candidate dispatched without a projection"): a harness that sends without capturing, then an embedded fallback with hook context. It fails on main (the fallback never reaches the provider) and passes with this change.src/sessions/user-turn-transcript.test.ts: a sent turn is still never given a projection; capture now resolves without one instead of throwing.attempt-prompt-submit.projections.test.tsandattempt-prompt-context.test.ts(embedded), andrun-attempt.prompt-projection.test.ts(Codex).Not covered
On such a fallback, Codex still sends its own hook-wrapped prompt for that attempt; the stored canonical text stays the transcript text. This matches how Codex treated every turn before projections existed.