Skip to content

fix(chat): fence delayed history at terminal retirement - #140379

Merged
steipete merged 2 commits into
mainfrom
codex/fix-native-advertised-history
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-native-advertised-history

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A completed run advertised by another client could reappear as active when older chat history arrived after its terminal session update. The native composer then disabled sending and restored stale streaming text.

Why This Change Was Made

Invalidate run snapshots at the existing terminal-retirement owner and route accepted lifecycle terminals through it. Preserve sequence rejection, pending cleanup, local request failures and the legacy session-stream distinction. This removes a duplicate terminal assignment and branch, reducing production code by one line.

User Impact

Completed runs stay settled when delayed history arrives in native chat. The existing recap test gains 14 lines while retaining every prior assertion.

Evidence

Hosted BEFORE proof compiled the unchanged production and failed only the three new assertions: pending count 1, stale streaming text and disabled sending. The shared suite ran 1,670 Swift Testing cases in 126 suites; XCTest reported 60 cases, two live-audio skips and no failures.

Both production files pass formatting and strict lint. All 14 local canonical checks pass. One managed source-review invocation returned no findings across three automatic passes; its first pass withheld confidence pending the later evidence. Native AFTER passes the exact unchanged regression method and all 1,670 shared Swift Testing cases. The macOS app suite also passes 2,074 tests; its separate two-case isolation supplement and one-case health render are recorded independently from skipped probes. Exact-head PR CI passed 20 jobs with 21 skipped. BEFORE used serial execution and AFTER parallel; Xcode/Swift matched, while runner macOS versions differed. No live-audio or skipped-probe coverage is claimed. The test-only baseline workflow also exposed unrelated locale, cron-picker and docs-test failures, retained separately; its overall run was not green. No local native application or saved user state was used.

Extend the existing terminal recap case with delayed history and visible run-state assertions. Production remains unchanged for the isolated before-fix proof.
Keep advertised completed runs settled by invalidating run snapshots at their shared terminal owner. Preserve accepted sequence handling, pending cleanup, and the legacy session-stream distinction.
@clawsweeper

clawsweeper Bot commented Sep 6, 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 size: XS maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 19:03
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 3:59 PM ET / 19:59 UTC.

ClawSweeper review

What this changes

The native chat UI invalidates older run snapshots when a run finishes, preventing delayed history from restoring stale streaming text and disabling Send.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: fetched main and v2026.9.2 lack the terminal-retirement snapshot fence. No introduced correctness or security defect was found, and the prior review contains no unresolved findings.

Priority: P2
Reviewed head: cdc3bdf372cc3cdfd8dc93d9ff2e62926cb4b6f8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression assertions and no identified blocking defect; linked execution results remain author-reported.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and changes no authority boundary. Its captured evidence reports native test execution of terminal retirement followed by delayed history; this is supplemental regression coverage, not a live application demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and changes no authority boundary. Its captured evidence reports native test execution of terminal retirement followed by delayed history; this is supplemental regression coverage, not a live application demonstration.
Evidence reviewed 9 items Terminal retirement owns the repair: Terminal retirement now advances the run-snapshot generation before recording terminal state. Sequence acceptance still rejects nonpositive, stale, and already-terminal events.
Delayed-history failure mechanism: History captures runOwnershipGeneration, and run-snapshot application rejects a mismatched generation before applying session metadata or adopting an in-flight run. Previously, advertised-only retirement did not change the pending-run set or advance that generation, while a terminal session snapshot could release the tombstone.
Lifecycle and cleanup compatibility: Accepted nonlegacy lifecycle terminals reach terminal retirement. Sequenced legacy session streams retain their existing distinction. Pending cleanup cancels existing run tasks, and haptics remain conditional on the run actually having been pending.
Findings None None.
Security None None.

How this fits together

The shared Apple chat view model combines Gateway lifecycle events and asynchronous chat-history responses. Its run-state reconciliation controls streaming text, pending activity, and whether the composer can send another message.

flowchart TD
  A[Gateway terminal event] --> B[Validate session and run]
  B --> C[Retire run and advance generation]
  D[Delayed history response] --> E[Compare snapshot generation]
  C --> E
  E --> F[Ignore stale run state]
  F --> G[Keep composer available]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Other +13. Total +13 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 25 12 +13
Total 3 25 12 +13

Review metrics

None.

Technical review

Best possible solution:

Keep stale run-state rejection at terminal retirement, using the existing generation guard while allowing ordinary transcript reconciliation to continue.

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

Yes, from source: capture history for an advertised run, process its terminal session snapshot, then apply the older in-flight snapshot. The extended regression exercises this ordering; this review did not execute it.

Is this the best way to solve the issue?

Yes. Advancing the existing snapshot generation at the shared terminal owner closes the gap without adding another reconciliation mechanism or changing persisted state.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes a bounded native-chat ordering defect that can incorrectly restore completed activity and disable sending.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and changes no authority boundary. Its captured evidence reports native test execution of terminal retirement followed by delayed history; this is supplemental regression coverage, not a live application demonstration.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T19:08:58.340Z sha cdc3bdf :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 800ee0c into main Sep 6, 2026
128 checks passed
@steipete
steipete deleted the codex/fix-native-advertised-history branch September 6, 2026 20:08
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 6, 2026
…rol-ui

* origin/main:
  docs: remove the empty release-sections nav group (#140427)
  fix(tooling): omit Codex machine squash credit (#140420)
  chore(ui): refresh control ui locales (#140384)
  refactor(plugin-sdk): reuse native approval input contracts (#140415)
  fix: silent model WebSocket streams hang past the idle timeout (#140335)
  perf(ai): avoid unused text extraction for image results (#140409)
  fix(ui): distinguish failed GitHub status checks from disconnected accounts (#140333)
  refactor(cron): share runtime feedback schema fields (#140408)
  fix: avoid duplicate cloud worker teardown during recovery (#140377)
  fix(cli): show executable approval scope (#138386)
  refactor(ui): reuse shared requirement records (#140407)
  test(gateway): table-drive device token lifecycle checks (#140403)
  fix(chat): fence delayed history at terminal retirement (#140379)
  test(skills): compare large upload bytes natively (#140402)
  refactor(delivery): reuse the canonical rendered batch plan type (#140386)
  docs(start): repair the first-run path from landing page to first channel (#140390)

# Conflicts:
#	docs/.i18n/glossary.zh-CN.json
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
)

* test(chat): capture advertised-run history regression

Extend the existing terminal recap case with delayed history and visible run-state assertions. Production remains unchanged for the isolated before-fix proof.

* fix(chat): fence delayed history at terminal retirement

Keep advertised completed runs settled by invalidating run snapshots at their shared terminal owner. Preserve accepted sequence handling, pending cleanup, and the legacy session-stream distinction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant