Repository navigation
fix: retain accepted browser follow-ups across restarts - #133457
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
e99d32f to
26d3850
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:15 PM ET / 23:15 UTC. ClawSweeper reviewWhat this changesThe branch durably records accepted browser chat follow-ups, promotes them only through the live turn owner, and shows their pending or interrupted state in Control UI after a restart. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readinessThe PR remains necessary: #132887 explicitly left durable custody for ordinary browser chat sends as follow-up work. Source and boundary tests support the staged-input design; human release review is still needed for its documented same-version SQLite compatibility boundary. Priority: P1 Review scores
Verification
How this fits togetherControl UI submits a browser message to the Gateway, which stages it in the agent’s SQLite state before acknowledging it. The active turn later promotes that exact input into the transcript, while history responses let the UI reconcile pending and consumed copies. flowchart LR
A[Browser operator] --> B[Gateway chat send]
B --> C[Durable pending input]
C --> D[Live turn admission]
D --> E[Canonical transcript]
C --> F[History receipts]
E --> F
F --> G[Control UI reconciliation]
Decision needed
Why: The implementation and tests support safe convergence, but support policy for operators running an intermediate pending-input-aware build is a release decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +637, Tests +1665, Docs +23, Generated +1, Other +8. Total +2334 across 46 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge only with explicit acceptance of the documented Doctor-mediated upgrade path for intermediate version 19 deployments. Do we have a high-confidence way to reproduce the issue? Yes—source inspection provides a high-confidence path: an accepted browser follow-up is staged, the Gateway restarts before promotion, and history must retain it as interrupted rather than silently dropping or executing it. Is this the best way to solve the issue? Yes—the design repairs custody at the admission and transcript owners, rather than compensating in the UI; its session, lifecycle, and transactional checks are covered by focused boundary tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6cf8e884edbd. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
12016bb to
9a61891
Compare
364da84 to
75d88f6
Compare
|
Merged via squash.
|
|
Live cloud follow-up passed with a real OpenAI API key, The normal New Session → Cloud flow created a managed worktree and executed the marker task remotely. Two inputs submitted while busy survived browser reload, were consumed by one combined transcript event, and left no stale pending copies. The Gateway worktree contained the exact original marker and A/B file bytes. The cloud agent then used Both placements auto-suspended and their old leases were confirmed released. A normal next message provisioned a fresh worker with warm images disabled. That worker verified the original three files and produced a new resume marker. Final read-only checks verified all five files, a distinct replacement lease, the original shared consumption event, and no duplicate combined transcript event. Bootstrap diagnostics discovered during the wider investigation landed separately in #133663: production −5 lines, real interrupted-download proof on AWS, 254 passing owner tests, and green exact-head CI. An initial malformed test-profile shell command was corrected before the successful cloud runs. Its teardown timeout remained durably owned and later reconciled to a confirmed release; no timeout increase or unsafe cleanup shortcut was added. |
) * fix: retain accepted browser follow-ups across restarts * refactor: share pending-input reconciliation bookkeeping * test: align durable input fixtures and shared worker teardown Keep chat fixtures aligned with queue ownership and receipt-aware history requests. Reuse the shared-worker admission cleanup already landed in openclaw#133466 from commit 08c49b7. * test: synchronize chat races with committed admission * docs: defer queued-input release note to release generation * perf: simplify accepted-input reconciliation and batch reads * test: assert recorder message semantics after simplification * test: align custody receipt queries with history batch size
Related: #132887
What Problem This Solves
A Control UI follow-up could be acknowledged while its approved input still existed only in the Gateway's in-memory queue. A restart before transcript append could lose it. Collection could also leave stale browser copies when several inputs became one turn and the browser missed the corresponding events.
What Changes
The existing per-agent pending-input store takes custody before ACK. The existing transcript transaction consumes every collected source when it appends their combined turn. Exact source identities, approved bytes, physical-session identity and live lifecycle authority remain required. History returns bounded, session-scoped consumption receipts so the browser can reconcile missed events.
Restart retains accepted input visibly as Interrupted for explicit resend. It does not restore old callbacks, grants, or worker claims, and it does not automatically replay queued input. Unsubmitted browser drafts keep their existing local ownership. Native steering carries the incoming input's own recorder; queued shutdown uses the canonical restart reason; collection reuses staged approval rather than running the source hook twice.
One bare nullable
consumed_event_id TEXTcolumn is added to the existing table. Agent schema version remains 19, with canonical schema declaration, first-use ensure and the existing Doctor migration owner. The maintainer explicitly accepted this persistence design and forward beta-to-release Doctor boundary, and renewed authorization to simplify, live-test and land. Intermediate pending-aware development builds can reject the extra column despite sharing version 19; arbitrary downgrade compatibility is not promised. No additional database, table, journal, configuration, index, cache, retention or concurrency policy is introduced.Simplification and Performance
The final pass removes 12 production lines. It folds duplicate recorder resolution/callback paths together, batches indexed physical-session and source-row reads, scans history once against bounded source IDs, and retires existing projection entries without reseeding and repeatedly searching them. Single-flight resolution, immutable sorting, media timing, cancellation and exact authority validation remain intact.
Local source-helper measurements—not end-to-end browser or model latency:
Whole-PR LOC: production +844/-209 (net +635); tests/support +1802/-135 (net +1667); generated +10/-1; docs +34/-11. Production growth owns durable admission, atomic multi-source consumption, bounded receipts and lifecycle validation; it reuses the existing store/collector/transcript transaction instead of creating a second service.
Single-source SQLite performance was effectively unchanged. The storage probe confirms one physical-session query per batch and one query for the collected source rows; private operational predicates are still validated at promotion.
Validation
The performance candidate passed 579 UI tests and 116 recorder/media/storage/collector tests, plus corrected scoped lint. Fresh Codex reviews were scoped-clean at the configured P0 threshold. Earlier full-owner coverage includes gateway admission/history/shutdown, native first-turn Stop, direct promotion/recovery, consumed-source retry, source-byte/lifecycle rejection, physical-session isolation and browser receipt coalescing. Admission, collection, native-recorder and UI regressions were observed failing against pre-fix production code.
Actual Doctor validation upgraded synthetic frozen beta schema 17 data to schema 19, preserved exact transcript bytes and labels, made repeat migration a no-op, and passed cold-reopen integrity/foreign-key checks. Frozen historical schema helpers proved pre-pending reader use and an old-owned write, expected rejection by an intermediate pending-aware reader, and successful candidate reopen. This is historical schema-gate proof, not full historical CLI execution.
The first performance CI run exposed immutable-sort/shadowing lint violations and four tests coupled to the old recorder callback argument count. These are corrected while retaining message-content and invocation-count assertions. A subsequent merge-ref run exposed a stale hard-coded release list after main added a release. The test now derives translated release routes from canonical English navigation while still checking group names, index-first ordering, uniqueness and exact locale parity. This reuses the maintainer repair from #133565 (
e755ce0a5992): the old fixture failed on the CI docs config, and the corrected full six-test suite passed against that same config. After main’s history-batch change, CI found two remaining 100-message literals in this PR’s new receipt-coalescing test. Both are updated to 400 without changing receipt assertions or runtime behavior. The failing full UI job otherwise passed 12,976 tests; the corresponding Node shard passed 4,512. A local attempt through the shared dependency tree exited before tests with a Vitest worker error; no shared dependencies were changed, and all 579 tests in the five affected UI files passed in the isolated native checkout on finale7f546c2f95. The upstream lifecycle/cloud Stop integration passed 138 tests across 9 files, including browser admission, exact cleanup ownership, pending cancellation, queue lifecycle and consumed-source retries. The two-literal correction passed fresh scoped Codex review (P0, confidence 0.99).Final exact-head CI33340813771 passed on
e7f546c2f95063410286f30f47ff0dd328c23c42: 193 jobs succeeded, 7 were skipped, and none failed or remained pending.Live Proof and Limits
Earlier real OpenAI proof passed local session creation, normal composer follow-up, A/B collection into one C, reload reconciliation, SIGKILL retention and explicit resend through the normal composer. The inspected synthetic captures below show candidate states before and after consumption/recovery, not a pre-fix build.
Fresh real OpenAI proof on the CI-built performance candidate passed: A/B were durably accepted before consumption, browser reload showed both, collection assigned both the same committed event and wrote both marker files, and reload had no stale pending copies. After SIGKILL/restart, a third input remained Interrupted with no marker or automatic execution. Explicit resend through the normal composer wrote the exact marker and completed; reload kept the original Interrupted input. The build is GitHub merge
99209b345947from CI33338160264, whose only failure was the stale docs fixture described above. Temporary provider credentials were removed. The final history integration refresh retains main’s 400-message startup/refresh and 1,000-message older-page limits together with bounded custody receipt IDs. Range-diff confirms only the two corresponding test expectation resolutions; the docs fixture repair is now identical upstream and drops from this PR. Fresh full-branch Codex review before that mechanical refresh was scoped-clean at P0 (confidence 0.96). On75d88f67186(before the final two test-literal corrections), the actual Doctor 17→19 migration, repeated no-op, exact transcript/label preservation, candidate cold reopen and integrity/FK checks all passed again. Frozen historical reader-helper/open-use/candidate-reopen proof passed with the documented intermediate-reader refusal. Final exact-head CI is recorded below. Root CHANGELOG entries are release-generated; this body carries the release-note context.Cloud execution is not proved. Three earlier AWS attempts failed before worker enrollment/model execution, including temporary public-tunnel archive interruption. Leases were inspected as released; an additional cleanup attempt timed out and independent instance deletion was not proved. Follow-ups: improve bootstrap phase/error diagnostics, prove stable archive ingress, and repair Crabbox cleanup target selection. No blind retry, timeout increase or UI bypass is included here.
The test Gateway was still draining after 60 seconds and was force-terminated after completed proof. Source review confirms plain SIGTERM allows 315 seconds for active work, so this observation does not prove a hang or timeout. The logs did not identify the remaining process-work owner; improved drain diagnostics are a separate follow-up. Only task-owned processes were stopped.
A separate live cold retry of an already-consumed source was not completed because browser control timed out; deterministic no-replay tests cover it. The latest live fixture also exposed tool-call-shaped text in one model response and a sluggish Debug event view; these are recorded as separate provider-output/Debug-performance follow-ups, not attributed to this persistence change.
Synthetic Browser Evidence
Accepted A/B and completed combined turn
Restart retention and explicit recovery