Skip to content

fix: stop repeating unchanged session state in every chat turn - #206766

Merged
obviyus merged 4 commits into
mainfrom
core/transcript-fidelity
Nov 27, 2026
Merged

obviyus merged 4 commits into
mainfrom
core/transcript-fidelity

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Every chat turn on the embedded runtime adds a hidden runtime-context block to the conversation, with state snapshots: active exec sessions, active subagents, media-generation tasks, approved executables and the current date. Since #198100 these blocks stay in history on every route, so the model keeps seeing every earlier copy. The snapshots were re-sent on every turn even when nothing had changed, so each turn added the same 715–1,066 bytes again. By turn 8 of a plain chat, these repeated snapshots were 49–75% of the message history. They cost context on every later request.

User Impact

Long sessions keep less repeated state in context. A chat turn where nothing changed adds no snapshot bytes. The model still sees the current state: a snapshot is sent again as soon as it changes (for example, when an exec session ends it gets "No active exec-tool sessions"), and after compaction, on a fresh session, or on a route that clears turn-scoped updates, every snapshot is sent in full. Earlier history stays byte-for-byte unchanged, so prompt caching behaves the same. No config, schema or stored-format change.

Why This Change Was Made

  • buildRuntimeFactsContext now owns one rule: send a snapshot only if it differs from the latest copy the request already carries. A snapshot the request does not carry counts as unknown and is sent in full, including its empty form.
  • Snapshot identity comes from the headings each producer renders, exported next to the producer. No new stored field: the latest copy is read from the stored carrier, either from its producer fragments or from a projected system update.
  • The diff base is what the request really sends. Routes that do not retain carriers send no earlier copies. The route that clears turn-scoped system updates (clear_at: "next_user_message" on Anthropic) drops those copies. That route fact moves into one function in transcript-policy.ts, which both callers use.
  • includeEmptySnapshots is no longer derived from appendOnlyRuntimeContext in the embedded path. The CLI runner, the worker launch descriptor and the Codex app-server turn context have the same repetition with different owners; they are not changed here.
  • I did not make snapshots transient (sent with the current request only and never stored). Prefix-binding Claude models bind each thinking block to the exact prefix before it (fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events #136782), so removing or moving an earlier carrier breaks reasoning replay. It would also undo the append-only contract from fix(agents): keep every session prefix append-only on every route #198100.
  • Related direction: fix(agents): source metadata changes invalidate the reusable prompt prefix #172313 moves generated inbound metadata out of the system prompt into turn carriers. This change keeps those carriers from re-recording unchanged state.

Evidence

  • Regression test, red on main and green here: attempt-prompt-context.test.ts "does not replay unchanged state snapshots into the next turn's history". On main the turn-2 carrier repeats the temporal, subagent and exec snapshots.
  • New tests for the edge cases:
    • a retry within one turn adds no second copy;
    • the first turn after compaction sends every snapshot, empty forms included;
    • a route that clears turn-scoped updates gets the snapshots again, and a route that keeps them does not;
    • the reader handles both stored carrier forms (runtime-facts-prompt.test.ts).
  • Touched and consumer tests green: prompt context, runtime facts, internal runtime context, media hint cache boundary, agent-tools.prefix-stability, subagent active context and catch-up, transcript policy, context advancement, tool-result truncation, runtime marker. pnpm check:changed green after one assertion-ratchet fix.
  • History bytes per turn, main vs this branch. Built product (openclaw agent --local and a scratch Gateway), 8-turn chat and 8-turn code task, isolated state, provider requests recorded at a TLS proxy. Message bytes of each turn's first request:
Route Surface Turn 8 main → branch Change
Anthropic Messages (fake provider) --local chat 7,544 → 2,364 B −69%
Anthropic Messages (fake provider) Gateway chat 10,942 → 6,511 B −40%
Anthropic Messages (fake provider) --local code 12,741 → 7,561 B −41%
Anthropic Messages (fake provider) Gateway code 16,133 → 11,702 B −27%
OpenAI gpt-5.4-mini, Completions route (served via Responses) --local chat 10,113 → 4,402 B −56%
OpenAI gpt-5.4-mini, Completions route Gateway chat 13,365 → 8,842 B −34%
OpenAI gpt-5.4-mini, Completions route --local code 14,378 → 9,489 B −34%
OpenAI gpt-5.4-mini, Completions route Gateway code 18,157 → 12,938 B −29%
OpenAI gpt-5.4-mini, Responses (embedded) --local code 35,330 → 21,837 B −38%
OpenAI gpt-5.4-mini, Responses (embedded) --local chat carriers 5,680 → 710 B (total varies with encrypted reasoning)
OpenAI gpt-5.4-mini, Responses (embedded) Gateway (previous_response_id) per-turn carrier delta 1,013 → 380 B
  • Prefix stability: byte-prefix breaks were 0 on main and 0 on this branch for every full-request pair on all routes above. Real OpenAI cache loss per session was unchanged within noise (for example 820 → 844 and 2,147 → 1,882 tokens).
  • The remaining Gateway carrier bytes per turn are the per-turn deferred-tool grant and the inbound sender block, which this change does not touch.
  • Not measured: real Anthropic routes with in-history system updates (direct API-key prefix-binding models). They are covered by the cleared-route test only.

- Each turn compared nothing and re-sent every state snapshot (exec sessions, subagents, media tasks, approved executables, temporal context), so the retained carrier repeated identical state in history on every turn.
- buildRuntimeFactsContext now omits a snapshot that equals the latest copy the request already carries, identified by producer headings. A snapshot the request does not carry (new session, after compaction, route that clears turn-scoped updates) is sent in full.
- includeEmptySnapshots no longer couples to appendOnlyRuntimeContext in the embedded path.
@clawsweeper

clawsweeper Bot commented Nov 27, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Nov 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR omits unchanged runtime-state snapshots from new embedded chat turns while retaining earlier transcript messages.

Example: Two consecutive chat turns on November 27 have no active exec sessions or subagents.

  • Before: Both turns append the same date and empty-state snapshots.
  • After: The second turn omits those snapshots when their earlier copies remain in the request.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful measured optimization with a concrete compaction lifecycle defect and confirmed fixture failures; existing transcript shapes and stored preferences remain unchanged.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR supplies built CLI and isolated Gateway measurements using recorded requests on real OpenAI routes and a synthetic Anthropic route, demonstrating reduced repeated carrier bytes and unchanged measured prefixes; direct Anthropic in-history behavior remains test-covered only.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Long chats spend increasing context on identical runtime-state snapshots retained from earlier turns.
Reason: Measured context reduction has clear value, and the maintainer-authored direction preserves existing transcript and configuration contracts.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this worthwhile, maintainer-authored PR open: snapshot deduplication addresses current-main waste, but automatic compaction can invalidate its comparison history, and the new helper breaks shared runner test fixtures.

Reviewed head: 2fcb87904cdf2df398421782f134dad0779dffb3

Before merge

  • Refresh omitted snapshots after automatic compaction (P2) - Snapshot filtering runs before AgentSession.prompt performs its automatic compaction check at src/agents/sessions/agent-session-prompting.ts:333–363. For example, an unchanged running exec-a snapshot can exist only in an early carrier and therefore be omitted here; threshold compaction then removes that carrier before dispatch. The pending carrier is already fixed, and the context-replacement callback only updates accounting and skill delivery, so the outgoing request lacks the current exec snapshot until another turn prepares it again. Recompute the delta against post-compaction history through the existing lifecycle owner. The added compaction test supplies already-compacted input and cannot catch this ordering.
  • Update the shared transcript-policy mock for the new export (P2) - This new call is reached by runner suites using attempt-spawn-workspace.session-mocks.test-support.ts, whose complete transcript-policy mock exports only resolveTranscriptPolicy. Vitest throws before those tests reach their behavior assertions. Current-head CI reports this exact failure across five runner shards. Preserve the real helper through a partial mock, or provide the matching export in the shared fixture, then rerun its consumers.

Findings

  • [P2] Refresh omitted snapshots after automatic compaction — src/agents/runtime-facts-prompt.ts:81-90
  • [P2] Update the shared transcript-policy mock for the new export — src/agents/embedded-agent-runner/run/attempt-history-prepare.ts:286-289

Tests

  • Missing end-to-end proof: The supplied runs do not exercise automatic compaction between snapshot comparison and provider dispatch.
Agent review details

How this fits together

Embedded prompt preparation combines session history with execution, subagent, media, and temporal facts, then submits the resulting context through provider transports.

flowchart LR
  A[Session history] --> C[Prompt preparation]
  B[Runtime fact producers] --> C
  C --> D[Snapshot comparison]
  D --> E[Pending turn carrier]
  A --> F[Automatic compaction]
  E --> G[Provider request]
  F --> G
Loading

Technical review

Best possible solution:

Keep comparison in the existing runtime-facts owner, refresh its result when compaction removes comparison history, and update the shared runner mock.

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

Current main unconditionally returns runtime snapshots on each turn, and the PR supplies built-product before/after measurements plus a reported red-on-main regression; no target code was executed during this review.

Is this the best way to solve the issue?

Comparing existing carrier contents avoids new persisted state and preserves append-only history, but comparison must remain valid through automatic compaction before dispatch.

Full review comments:

  • [P2] Refresh omitted snapshots after automatic compaction — src/agents/runtime-facts-prompt.ts:81-90
    Snapshot filtering runs before AgentSession.prompt performs its automatic compaction check at src/agents/sessions/agent-session-prompting.ts:333–363. For example, an unchanged running exec-a snapshot can exist only in an early carrier and therefore be omitted here; threshold compaction then removes that carrier before dispatch. The pending carrier is already fixed, and the context-replacement callback only updates accounting and skill delivery, so the outgoing request lacks the current exec snapshot until another turn prepares it again. Recompute the delta against post-compaction history through the existing lifecycle owner. The added compaction test supplies already-compacted input and cannot catch this ordering.
    Confidence: 0.97
  • [P2] Update the shared transcript-policy mock for the new export — src/agents/embedded-agent-runner/run/attempt-history-prepare.ts:286-289
    This new call is reached by runner suites using attempt-spawn-workspace.session-mocks.test-support.ts, whose complete transcript-policy mock exports only resolveTranscriptPolicy. Vitest throws before those tests reach their behavior assertions. Current-head CI reports this exact failure across five runner shards. Preserve the real helper through a partial mock, or provide the matching export in the shared fixture, then rerun its consumers.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Retained runtime-context carriers keeps the original intent (bf0b800: Preserve the exact earlier request prefix on every provider route; fix(anthropic): Fable 5.1 sessions lose reasoning after model switches and runtime events #136782 also documents why removing carriers can invalidate retained thinking.)
  • Typed fragments and explicit empty snapshots keeps the original intent (cd9913f: Keep host context distinct from user instructions and supersede stale retained state; the PR continues using producer fragments and sends changed or unknown empty snapshots.)
  • Temporal facts outside the stable prompt keeps the original intent (6a9bcca: Avoid invalidating the reusable system prefix at midnight while supplying current date and timezone.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/runtime-facts-prompt.test.ts src/agents/embedded-agent-runner/run/attempt-prompt-context.test.ts --maxWorkers=1
  • pnpm test src/agents/sessions/agent-session-compaction-headroom.test.ts src/agents/sessions/agent-session-small-context-compaction.test.ts --maxWorkers=1
  • pnpm test src/agents/embedded-agent-runner/run/attempt.sessions-yield.test.ts --maxWorkers=1
  • pnpm test src/agents/agent-tools.prefix-stability.test.ts --maxWorkers=1
  • pnpm check:changed

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit bf0b800 adds src/agents/transcript-policy.ts:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf0b8002c2b9; files: src/agents/transcript-policy.ts)
  • Peter Steinberger: Raw commit 2d0d99f adds src/agents/internal-runtime-context.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2d0d99fe08d8; files: src/agents/internal-runtime-context.ts)
  • Dallin Romney: Raw commit cd9913f adds src/agents/internal-runtime-context.ts:34 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: cd9913f1b110; files: src/agents/internal-runtime-context.ts)

PR surface

Source +133, Tests +108, Docs +8. Total +249 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 10 155 22 +133
Tests 4 131 23 +108
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 294 45 +249

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add merge-risk: 🚨 session-state: Automatic compaction can remove the only retained copy of runtime state after this PR has omitted its replacement from the pending turn.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • merge-risk: 🚨 session-state: Automatic compaction can remove the only retained copy of runtime state after this PR has omitted its replacement from the pending turn.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • 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.

Reviewed November 27, 2026, 10:35 AM ET / 15:35 UTC.

- The attempt harness mock replaced the whole transcript-policy module, so the moved clearsTurnScopedSystemUpdates export was missing.
- A fresh request now carries the empty subagent snapshot; update the runtime-facts attempt expectation.
@obviyus

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: checks-ui-e2e (2/3) and openclaw/ci-gate on head 162c734.

# PR #206766 head 162c7344572e; main run 46015922569
checks-ui-e2e (2/3)	ui/src/e2e/chat-flow.model-picker-refresh.e2e.test.ts	MAIN-ALSO
  • openclaw/ci-gate is red only because of that job. All other checks pass.

@obviyus
obviyus merged commit f1841bc into main Nov 27, 2026
129 of 132 checks passed
@obviyus
obviyus deleted the core/transcript-fidelity branch November 27, 2026 16:11
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…law#206766)

## What Problem This Solves

Every chat turn on the embedded runtime adds a hidden runtime-context block to the conversation, with state snapshots: active exec sessions, active subagents, media-generation tasks, approved executables and the current date. Since openclaw#198100 these blocks stay in history on every route, so the model keeps seeing every earlier copy. The snapshots were re-sent on every turn even when nothing had changed, so each turn added the same 715–1,066 bytes again. By turn 8 of a plain chat, these repeated snapshots were 49–75% of the message history. They cost context on every later request.

## User Impact

Long sessions keep less repeated state in context. A chat turn where nothing changed adds no snapshot bytes. The model still sees the current state: a snapshot is sent again as soon as it changes (for example, when an exec session ends it gets "No active exec-tool sessions"), and after compaction, on a fresh session, or on a route that clears turn-scoped updates, every snapshot is sent in full. Earlier history stays byte-for-byte unchanged, so prompt caching behaves the same. No config, schema or stored-format change.

## Why This Change Was Made

- `buildRuntimeFactsContext` now owns one rule: send a snapshot only if it differs from the latest copy the request already carries. A snapshot the request does not carry counts as unknown and is sent in full, including its empty form.
- Snapshot identity comes from the headings each producer renders, exported next to the producer. No new stored field: the latest copy is read from the stored carrier, either from its producer fragments or from a projected system update.
- The diff base is what the request really sends. Routes that do not retain carriers send no earlier copies. The route that clears turn-scoped system updates (`clear_at: "next_user_message"` on Anthropic) drops those copies. That route fact moves into one function in `transcript-policy.ts`, which both callers use.
- `includeEmptySnapshots` is no longer derived from `appendOnlyRuntimeContext` in the embedded path. The CLI runner, the worker launch descriptor and the Codex app-server turn context have the same repetition with different owners; they are not changed here.
- I did not make snapshots transient (sent with the current request only and never stored). Prefix-binding Claude models bind each thinking block to the exact prefix before it (openclaw#136782), so removing or moving an earlier carrier breaks reasoning replay. It would also undo the append-only contract from openclaw#198100.
- Related direction: openclaw#172313 moves generated inbound metadata out of the system prompt into turn carriers. This change keeps those carriers from re-recording unchanged state.

## Evidence

- **Regression test, red on main and green here:** `attempt-prompt-context.test.ts` "does not replay unchanged state snapshots into the next turn's history". On main the turn-2 carrier repeats the temporal, subagent and exec snapshots.
- **New tests for the edge cases:**
  - a retry within one turn adds no second copy;
  - the first turn after compaction sends every snapshot, empty forms included;
  - a route that clears turn-scoped updates gets the snapshots again, and a route that keeps them does not;
  - the reader handles both stored carrier forms (`runtime-facts-prompt.test.ts`).
- **Touched and consumer tests green:** prompt context, runtime facts, internal runtime context, media hint cache boundary, `agent-tools.prefix-stability`, subagent active context and catch-up, transcript policy, context advancement, tool-result truncation, runtime marker. `pnpm check:changed` green after one assertion-ratchet fix.
- **History bytes per turn, main vs this branch.** Built product (`openclaw agent --local` and a scratch Gateway), 8-turn chat and 8-turn code task, isolated state, provider requests recorded at a TLS proxy. Message bytes of each turn's first request:

| Route | Surface | Turn 8 main → branch | Change |
|---|---|---|---|
| Anthropic Messages (fake provider) | `--local` chat | 7,544 → 2,364 B | −69% |
| Anthropic Messages (fake provider) | Gateway chat | 10,942 → 6,511 B | −40% |
| Anthropic Messages (fake provider) | `--local` code | 12,741 → 7,561 B | −41% |
| Anthropic Messages (fake provider) | Gateway code | 16,133 → 11,702 B | −27% |
| OpenAI gpt-5.4-mini, Completions route (served via Responses) | `--local` chat | 10,113 → 4,402 B | −56% |
| OpenAI gpt-5.4-mini, Completions route | Gateway chat | 13,365 → 8,842 B | −34% |
| OpenAI gpt-5.4-mini, Completions route | `--local` code | 14,378 → 9,489 B | −34% |
| OpenAI gpt-5.4-mini, Completions route | Gateway code | 18,157 → 12,938 B | −29% |
| OpenAI gpt-5.4-mini, Responses (embedded) | `--local` code | 35,330 → 21,837 B | −38% |
| OpenAI gpt-5.4-mini, Responses (embedded) | `--local` chat | carriers 5,680 → 710 B (total varies with encrypted reasoning) | |
| OpenAI gpt-5.4-mini, Responses (embedded) | Gateway (`previous_response_id`) | per-turn carrier delta 1,013 → 380 B | |

- **Prefix stability:** byte-prefix breaks were 0 on main and 0 on this branch for every full-request pair on all routes above. Real OpenAI cache loss per session was unchanged within noise (for example 820 → 844 and 2,147 → 1,882 tokens).
- The remaining Gateway carrier bytes per turn are the per-turn deferred-tool grant and the inbound sender block, which this change does not touch.
- **Not measured:** real Anthropic routes with in-history system updates (direct API-key prefix-binding models). They are covered by the cleared-route test only.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 29, 2026
…205987)

## Class: completion is published before required maintenance finishes

Fleet run `4de610c8-e63d-4336-8e85-a76379cfd934` committed and served the new core, but its completion notice preceded the failed plugin result. The bug is ordering, not the core's status.

The modern Gateway-ready owner now settles once **after** required plugin work and sends one final notice afterward. A failed plugin remains a failed step, not a failed core update or a rollback trigger. Existing CLI following and capability-consent behavior remain; the failed-status/early-exit/backoff experiment is removed.

CLI completion, status, Doctor history and the Control UI reuse the existing `renderUpdateRunSummary` over recorded facts. Running results keep their phase; succeeded results name the installed after-version; skipped results keep their existing reason headline, never a guessed serving state. Failed work names its step and exact recovery command. Startup refusal diagnostics, structured failure facts, rollback compensation reasons, recorded signal output and profile-specific recovery commands remain visible. Existing discriminators distinguish repair and reconciled-history records from core updates. Background completion never rewrites the shared trial, preserving a newer pending trial and restart resumption.

## What this deletes

- `renderUpdateRunReport`, its private recovery hints and cause module.
- Routine Markdown completion publication/refresh, automatic `reportPath` output, and artifact-only admission/options plumbing.
- Obsolete completion-export tests and renderer-only assertions. Ledger, recovery, authority, privacy and step-detail assertions remain on their retained data owners.
- The abandoned failed-status classifier, campaign/retry exceptions, early-return CLI path and associated UI/test allocation.

**Kept deliberately:** explicit consent-gated **Report update failure** GitHub preview/submission, its reservation/receipt authority and sanitized issue artifacts. The remaining `update-failure-report*` code serves that user feature and triage, not routine completion. Identity/recovery and legacy result/sentinel projections remain because those manual-report and sentinel consumers still use them.

No new status, state store, flag, stored-record shape or launcher format.

## Size

`tokei` on this PR's **20 production files**, excluding tests/support/harnesses, against integrated main `6ac896f4cbb8bc29940c625cb1e2b19990e87284`:

| | Before | After | Net |
| --- | ---: | ---: | ---: |
| Production code lines | 7,758 | 7,148 | **−610** |
| Test/support lines | | | **−1,257** |

## Verification

- The earlier base Gateway-owner regression exposed the premature terminal write before plugin settlement. Final owner tests pin delayed settlement, unchanged successful core status, exact plugin recovery, one acknowledged final notice, newer-trial preservation and restart resumption.
- **Earlier focused AWS replay GREEN:** nine observed prepare/status/progress regression cases passed in99s; core and CLI-update types, scoped lint (zero warnings/errors) and format passed. https://crabbox.openclaw.ai/portal/runs/run_e5a8682ccf98bb7765b9d075be801705 . Exact qualified source was `5c6686ad20f50377f6affdec0d948f362dc37851`, tree `5ed1cb6e544fbd93604eea566b550f0c722842c8`, normal carrier `d2821086c00e55c8de35d00d7a4418168ca25a2d`; lease released with `--wait`. This is not claimed as an exact-head run after the later shared-summary/UI refinements.
- **Final pushed head:** `79182af301a6166914840dab9a705f4fa5c72fbd`. Restores the existing installed-runtime admission receipt before stop-and-repair advice, keeps historical summaries informational, and types the captured handoff notice without weakening assertions. Three requested files passed once: guidance32/32, handoff19/19, UI view15/15 (**66/66**). https://crabbox.openclaw.ai/portal/runs/run_ea4006e0b21e09bfbd763abe6e25929a . Qualified source was `985dd796d1` plus those two frozen restores, tree `45fe9f49c964b39806b431cde018432ed6e472fc`, normal carrier `81d874a77bb7de2f72307cca91f827db71ec7850`. Exact AWS lease released with `--wait`, exit0. Final-head CI remains the landing gate.
- **Repair candidate:** `1f223e15a20a04a27a4f745af81fb11b106d9d40`. Plain integrated main `6ac896f4cbb8bc29940c625cb1e2b19990e87284` passed all39 CLI tests on hydrated AWS4CPU/7730MiB, including the #205898 restart-wire case in31ms: https://crabbox.openclaw.ai/portal/runs/run_97637e77b460fbb7176bd261693cabd1 . B's timeout came from its local ledger fixture using a remote run ID; the fixture is corrected without changing main's captured connection contract.
- **Node regression batch:** nineteen files on repair predecessor `eede`, 481passed/4failed/1skipped; core types, scoped lint and format passed. https://crabbox.openclaw.ai/portal/runs/run_fbcf26ce68d5a5a539f63f6ee793237a . The four residuals were an early-return saved-notice recognition bug, two assertions pinning retired reconciled wording, and a native-refusal assertion reading a clipped excerpt instead of its retained structured cause. All are corrected without changing generic ledger storage.
- **Final-head residual proof:** summary18/18, abandoned-repair rows2/2 and native-start refusal1/1 passed; core and CLI-update types plus scoped format passed. https://crabbox.openclaw.ai/portal/runs/run_f4e633ac557bce484d1939c03cf88b3f . Source tree `9112e46c2b3081aab02b3dc9a0dfc1e0c06da55f`, normal carrier `82470c4669b7cc502049fa978dc5ed37defb6c6a`, AWS4CPU/7730MiB. Scoped lint did **not** run: its normal SDK declaration preparation failed first with TypeScript/vscode-jsonrpc `ERR_STREAM_DESTROYED`. No retry or bypass; current-head CI remains the lint gate.
- Historical failed-status screenshots, broad partial qualification and prior reviews describe the superseded design, **not** this head.
- No new upgrade source, death proof, harness test or Linux product campaign is added. Superseded remote proof jobs were cancelled and all their leases released with `--wait`.
- The ready-time settlement owner tests passed on integrated `9aba`: `gateway-trial.test.ts`18/18. Later output refinements do not change that settlement policy. Frozen `01b` UI reproduction observed unit14pass/1fail and E2E8pass/2fail. On repair predecessor `eede`, unit15/15, UI/pages/E2E types and scoped lint/format passed. Final `f087` passed both changed E2E cases (standalone repair history; warning advice and keyboard-accessible output), UI/pages/E2E types, scoped lint and format: https://crabbox.openclaw.ai/portal/runs/run_13701071e15057d5ac5c4ac5e927c65d . Source tree `3c734ef709a186303996517ecad54c5e5d4a0e9c`; exact lease released with `--wait`. The other8 E2E cases passed on `eede` and were intentionally not repeated.
- **Accepted budget cost:** exact `1f223` CI measures chat boot gzip **1,336,500→1,337,028 (+528 B)**, requests21→21; startup+1 B. Base already exceeds its cap, so normal tolerance is64 B (464 B excess). https://github.com/openclaw/openclaw/actions/runs/45885636780/job/140136424955 . Cause: `update-run-projection.ts` synchronously imports the shared summary for the existing card/view projection; the existing async result boundary already imports it dynamically. Ayaan accepted this cost for this PR through Main; no new async plumbing or budget config. Main applies the performance-only override at merge; every other gate remains required.
- **Final-head budget receipt (`79182`):** chat boot gzip **1,336,744→1,337,247 (+503 B)**, requests21→21; startup+1 B, normal tolerance64 B. https://github.com/openclaw/openclaw/actions/runs/45895112042/job/140167696819 . This is below the accepted predecessor's +528 B cost; same synchronous-summary cause, no new plumbing/config. Remaining CI gates are still pending.
- **Latest pushed head: `be86da0464892c10cbe7207ff98228eb1e81758a` (test-only delta).** The shared notice mock uses its production signature; no cast or weakened notice assertion remains. Healthy final recovery without an installed-runtime admission receipt explicitly expects update-again/no-stop advice. Two affected files passed once (**81/81**: handoff19, post-update62), focused Gateway/CLI-update types and lint passed: https://crabbox.openclaw.ai/portal/runs/run_c8784e2fe001772ae88bae53af8d9747 . Qualified source was `79182` plus the frozen test edits; only generic-type wrapping changed mechanically afterward, normal commit hooks passed. No production/budget change.
- The prior ratchet failure is infrastructure: its GitHub annotation says the hosted runner lost communication, leaving the baseline-ratchet step without a verdict. Its log fetch returned BlobNotFound/404. No old-head rerun was accepted or needed; this head's normal CI runs the ratchet again.
- **Latest pushed head: `bf3ab61efbb9dba856bfc4d651c7fc77f44549f2` (one exact-copy test assertion).** Requested same-guest owner-file comparison: plain main `993d0b77`13/13 passed ([run](https://crabbox.openclaw.ai/portal/runs/run_4983803c6c82c64295d7d513ac8b52cd)); `be86`12/13 passed ([run](https://crabbox.openclaw.ai/portal/runs/run_51b38ba2049d66bdf6437b89731bf787)), failing only the expected generic details tail. The actual last notice correctly preserves `commands.restart=false` and its app/operator remedy. This commit changes only the exact expected string, retaining acknowledgement, no-update and last-call/context assertions; no mock runtime or production change. No extra local rerun: new-head CI verifies the migrated expectation.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit ed8b883)

Release adaptation: Port Gateway run/notice timing and the existing maintenance result contract only; retain beta.2 CLI, Doctor and UI summary surfaces and explicit failure reports. Fold in #208074 abort/grace follow-up where applicable.

Later same-path commits from the pinned scan (separate behavior unless named as folded/selected below): 974d792 fix: keep update status quiet and app-managed updates honest (#208359); 186e941 fix: restore the dependency check on main (#207741); dae01a9 fix: keep other agents running when one store is refused (#208364); c9f7a98 fix: keep container Gateway commands from rolling back host updates (#208271); edb6820 fix: let the Gateway restart while boot plugin maintenance is running (#208074); bb37856 fix: keep Windows WebChat connected during config reloads (#208109); 516166c fix: exit once when gateway run rejects an argument after an update (#208068); 07e96dc fix: restart the Gateway after real plugin repairs (#208207); bd48ff6 fix: avoid restarting the Gateway for plugin timestamp changes (#208119); 259f71c fix: stop Linux service starts from copying the whole agent database (#207969); 7cb8975 fix: keep forked Claude chats separate after a Gateway crash (#208048); 6d300d3 fix: restart launcher-managed Gateways after exit 78 (#207972); 90ff668 fix: stop treating limited access as an Inbox alert (#207737); ec39a90 fix(whatsapp): retain sender for explicit current-message reactions (#190121); 86ca412 fix: show the saved quota reset when chat skips its only model (#207210); c4a675f fix: avoid reloading unchanged plugins after Gateway boot (#207949); 13c67a1 fix: let updates back up deeply nested databases (#207756); e2fcd4d fix: acknowledge updates when the Gateway first becomes ready (#207819); 8933edd fix: name safe recovery when agent schema markers disagree (#207705); 19e9dd6 fix(gateway): keep Linux legacy lock recovery explicit (#207340); 54b5989 test(update): move startup diagnostics to the live CLI (#207589); fbf1aae fix: give safe update ownership guidance and restore legacy result delivery (#207640); 0cbe433 test(gateway): move update admission tests to the current handler (#207545); a922203 refactor(update): remove native post-activation Doctor subprocess (#207585); c72bd9a fix(anthropic): show Claude CLI quota usage from the native login (#207543); 7ac87ad fix: avoid taking service-account ownership during updates (#207563); b3902a2 fix(update): allow in-place updates without a full state copy (#207448); 9fa8d14 refactor: trim redundant gateway test journeys (#207311); 2cf1cb6 test(cli): remove unused private fixture state (#207431); ece7a74 improve(workboard): apply the Control UI glossary and style to Workboard copy; 1c89587 fix: update system service packages without root state changes (#207304); dfd17d0 fix(docker): avoid pre-boot Doctor delays on container recreation (#207200); b616036 refactor(subagents): simplify ACP spawn relay ownership (#207023); 93ca762 improve: reduce allocations when preparing session rows (#207109); adb3716 fix(update): surface boot plugin repair advisories (#207163); f79ef8c fix: finish updates of 2026-11-17 main checkouts automatically on Linux and macOS (#207062); 3c4362b fix(update): preserve exception causes in failure history (#207085); 20c92a4 fix: converge plugins after every Gateway boot (#206926); 3078862 fix(update): clean up rejected Git update worktrees (#207040); 9993328 refactor(subagents): simplify kill claim and ownership handling (#207025); 97815bd refactor(subagents): consolidate registry cleanup and publication guards (#207064); e94f799 refactor(subagents): centralize requester turn matching (#206584); 819935f refactor(test): trim unused plugin fixture setup (#206982); 8ae0874 improve(gateway): avoid redundant cleanup for empty legacy auth stores (#206867); 4849bb7 fix(browser): report crashed tabs as tab-scoped failures (#194682); ea77ca3 refactor: report update failures from recorded runs (#206700); b19387e fix(test): cover SIGBREAK during pending update recovery (#206860); 18e53d8 fix: finish Linux upgrades after a legacy Gateway crashes (#206530); 8bd1863 chore(test): remove unused plugin contract fixture setup (#206812); f1841bc fix: stop repeating unchanged session state in every chat turn (#206766); f9a8f18 fix: clear the update warning after a retired model is repaired (#204778); 4d7e00b fix: let started participant runs and requests finish after an access change (#206747); 35cd392 improve: use less memory when waiting for an agent reply (#206733); 9845bf5 fix(test): keep readiness abort fixtures alive until stopped (#206660); 461f650 fix(ci): keep startup helpers internal (#206649); f89ae43 refactor(subagents): use cleanup and terminal owners in sweeps (#206533); a882e0f fix(agents): preserve task answers when sessions are reused (#126263); ccb6d81 fix: finish core updates when the Gateway is ready (#206560); 74f02b4 fix: refuse root updates of a system service that runs as another account (#206343); 01032b1 fix(update): keep acknowledged run IDs when status is unavailable (#206562); 3ce0582 refactor(subagents): centralize collector replay decisions (#206471); c2cfab0 chore: consolidate repeated test fixtures and guards (#198739); 219b6b0 perf(agents): render the system prompt from one manifest and halve it (#206537); 360e306 refactor(test): remove mocked outbound staging fixtures (#184863); cbdd907 fix: finish release updates after a slow launcher response (#206503); 81fc833 refactor(subagents): own dormant child Stop decisions (#206479); 91d4912 fix(update): stop using foreign recovery records as admission (#206295); 6feeb50 fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341); be3c73e fix(subagents): finish claimed stops after session rotation (#206405); 5e5bb6e fix(update): round status inspection timeouts (#206250); 41afc0f fix(update): keep successful plugin reload warnings advisory (#206372); 6d86389 fix: finish healthy Git updates after an older verifier exits; da6ec1a fix(update): bound release CLI Gateway waits (#206252); d9a36b3 improve: skip unrelated harness discovery for isolated model calls (#206323); bcdb2ef improve(cli): skip channel and web discovery for model credentials (#206240).
Later PR-number mentions: none Later commit-SHA mentions: none
Pinned PR grep: ed8b883 fix(update): settle after plugins and share one completion summary (#205987)

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

agents Agent runtime and tooling docs Improvements or additions to documentation impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant