Repository navigation
fix(ui): keep page drafts and data through reconnects - #174059
Conversation
|
🦞👀 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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ee1440f5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function invalidateCronMutation(state: CronState) { | ||
| // Already-dispatched writes may finish, but retired replies cannot change a retained draft. | ||
| activeCronMutations.delete(state); | ||
| state.cronBusy = false; |
There was a problem hiding this comment.
Keep ambiguous cron writes non-retryable until settlement
When cron.add or cron.run reaches the Gateway but the socket drops before its response, the page invokes this function; clearing cronBusy immediately re-enables the retained action after reconnect even though the first write may still commit. Retrying can create duplicate schedules or execute a task twice, so preserve an uncertain/settling state until authoritative reconciliation or use an idempotency key.
AGENTS.md reference: AGENTS.md:L106-L106
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: Ambiguous write settlement predates this change and transport closure already rejects the request, so reliable retry reconciliation requires a separate Gateway operation identity contract rather than a UI busy flag.
| const message = createMemo(() => | ||
| !props.connected | ||
| ? t("activity.currentWork.disconnected") | ||
| : props.error | ||
| ? t("activity.currentWork.loadFailed") | ||
| : !props.result || (rows().length === 0 && props.incomplete) | ||
| ? t("activity.currentWork.loading") | ||
| : rows().length === 0 | ||
| ? t("activity.currentWork.empty") | ||
| : null, | ||
| rows().length > 0 | ||
| ? null | ||
| : !props.connected | ||
| ? t("activity.currentWork.disconnected") | ||
| : props.error | ||
| ? t("activity.currentWork.loadFailed") |
There was a problem hiding this comment.
Surface Current Work refresh failures with retained rows
When a reconnect or refresh fails after Current Work already has rows, the owner now retains those rows and sets props.error, but this early rows().length > 0 branch returns null before checking that error. The stale rows therefore remain visible with neither an error nor the Retry control, making the failed refresh indistinguishable from current data.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5a266a1: Current Work now shows refresh failure and Retry alongside retained rows, with a reconnect regression proving successful recovery without losing the filter draft.
| : previousState | ||
| ? { ...previousState, [pageStatus]: "error" } | ||
| ? pageKind === "refresh" | ||
| ? previousState | ||
| : { ...previousState, [pageStatus]: "error" } |
There was a problem hiding this comment.
Surface failed Run Inspector reconnect refreshes
If the automatic audit.run.inspect refresh after reconnect fails with an ordinary transport or server error, this branch restores the exact prior ready state without recording any error or retry state. Once connected again, the retained evidence appears successfully refreshed and the inspector's existing Retry UI is unreachable.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5a266a1: Run Inspector now records reconnect refresh failures and exposes its existing recovery action alongside retained evidence, with a regression exercising successful retry.
| <MemoryImport | ||
| connected={gateway.read().snapshot.phase === "connected"} | ||
| canAdmin={hasOperatorAdminAccess(gateway.read().snapshot.hello?.auth ?? null)} | ||
| canAdmin={gateway.read().snapshot.phase !== "connected" || canAdmin()} | ||
| agents={listSelectableAgents(agents.read().agentsList?.agents ?? [])} |
There was a problem hiding this comment.
Preserve the disconnected state on cold Memory Import loads
On a cold load while the Gateway is unavailable, this caller forces canAdmin to true even though there is no cached plan or draft. Because the view now gates only on canAdmin, it renders an empty normal workspace with disabled controls instead of the prior disconnected explanation; preserve retained content only when there is something to retain, otherwise show the disconnected state.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5a266a1: Cold offline Memory Import now shows the disconnected explanation while previously authorized workspaces retain their plans and drafts through reconnects.
| reconnect() { | ||
| const interrupted = state.loading; | ||
| attempt += 1; | ||
| scope = capture(); | ||
| state.loading = false; | ||
| if (state.entry && scope && (interrupted || state.messages.length === 0)) { | ||
| void load(state.failedCursor); |
There was a problem hiding this comment.
Resume interrupted transcript pagination after reconnect
If a load-more request is in flight when the connection drops, the disconnected call records interrupted but cannot reload because capture() returns no scope and then clears loading. On the connected call, interrupted is consequently false and existing messages make this condition skip failedCursor, so the interrupted page is never automatically resumed despite the reconnect path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: Interrupted pagination keeps its cursor and Show earlier remains available after reconnect, so automatic replay is a recoverable convenience outside this retention fix.
|
Codex review: needs real behavior proof before merge. What this changesThis PR retains loaded Control UI data and unsaved drafts through same-client Gateway interruptions while disabling disconnected server actions. Example: A connection drops while editing an automation named Daily report.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 10 items remain Keep open: this maintainer-directed fix addresses real draft loss, but protected roster retention and several reconnect recovery regressions block merge. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherControl UI owners consume Gateway connection, identity, permission, and RPC events and publish catalogs, page content, drafts, and action availability to Solid views. flowchart LR
Gateway[Gateway connection and permissions] --> Scope[Identity and request scopes]
Scope --> Owners[Catalog and page owners]
Owners --> Views[Retained Solid views and drafts]
Views --> Actions[Action admission]
Actions --> RPC[Gateway RPC authorization]
RPC --> Gateway
Technical reviewBest possible solution: Retain drafts and presentation while preserving current-authorized discovery, uncertain write outcomes, and visible reconnect recovery. Do we have a high-confidence way to reproduce the issue? Current-main source resets Cron state on same-client transport changes; the introduced failure paths are traceable in source, but no target code was executed during this read-only review. Is this the best way to solve the issue? Separating retained presentation from request generations is appropriate, provided discovery authorization and uncertain mutation custody retain their existing owners. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f864c660f56c. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Retained agent discovery can outlive a narrowed role's authorization. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes:
Label justifications:
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 October 16, 2026, 5:36 AM ET / 09:36 UTC. |
Keep settled page data and editable drafts through same-client transport loss while fencing old requests and disabling server actions. Refresh approvals with backoff, preserve import selections and dialogs, and retire protected catalogs and board leases on canonical account or Gateway identity changes. Validation: touched-file formatting, i18n baseline, and git diff --check. Focused tests, typecheck, lint, and browser proof are delegated to the coordinator under the host compute budget.
0ee1440 to
91e6411
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9d6359c67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dreaming.dreamDiaryLoading = false; | ||
| dreaming.wikiImportInsightsLoading = false; | ||
| dreaming.wikiOverviewLoading = false; | ||
| dreaming.dreamDiaryActionLoading = false; |
There was a problem hiding this comment.
Preserve interrupted memory-action settlement
When a doctor.memory.* write reaches the Gateway but the connection drops before its response, this clears the busy state and the stale completion is discarded by the epoch check. After reconnect, the same action is enabled again with no success, error, or uncertain state; for repairDreamingArtifacts, this can also lose the only response containing the archive path, while a retry may report that nothing changed. Preserve an unsettled outcome until it can be reconciled, or give these operations an idempotent result key.
AGENTS.md reference: AGENTS.md:L106-L106
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5a266a1: Interrupted memory writes now keep confirmed receipts and archive paths or show an explicit uncertain outcome warning without replaying the action.
| if (wikiPreview) { | ||
| wikiPreview.loading = false; |
There was a problem hiding this comment.
Keep interrupted wiki previews recoverable
If wiki.get is in flight when the Gateway disconnects, this turns off the preview's loading state while leaving its empty modal open. The old response is rejected by isTaskScopeCurrent, reconnect hydration never retries that lookup, and the modal has only a Close action, so it permanently presents an empty document with no error or recovery path. Retain a disconnected/loading indication or reissue the preview read after reconnect.
AGENTS.md reference: AGENTS.md:L81-L81
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5a266a1: Interrupted wiki previews stay visibly loading and reconnect automatically reloads the same modal while rejecting stale responses.
Control UI pages keep drafts and loaded data through same-identity transport reconnects: shared catalogs, session roster, Cron, Memory Import, Activity and inspector, Dreaming, approvals, command palette, mentions, session dialogs, the chat model picker and the New Session page. Stale responses are fenced, presentation resets on identity, account, recovery-scope or access change and on connect rejection, and uncertain writes are never replayed. Session-scoped operators keep Activity through self-read access. Landed via the inherited-failure exception: every red job on exact-head CI run 39191621242 is main-owned (chat-boot budget already over the ceiling on main with this branch reducing it, session-list-filter E2E red on main's scheduled runs, extensions/codex typecheck error), with evidence in the PR body.
What Problem This Solves
Fixes: brief Gateway disconnects wipe loaded pages, the sidebar roster, approvals and unsaved drafts outside Settings.
Many owners reset on every transport edge of the same client: shared agent, identity, project and profile catalogs cleared (so roster-mode navigation blanked); Scheduled tasks replaced its whole state and dropped the editor draft; Memory Import reset selections and, on replanning, silently re-selected every item (broadening the next import); Activity, the run inspector and Dreaming discarded results; approval queues cleared and a failed reconnect read left pending approvals invisible; the command palette showed "No results" offline; Inbox items disappeared; session rename / new-group dialogs and inline header rename were aborted with the typed text lost, and a failed rename could close the dialog as if it succeeded; the sidebar menu disabled even local actions; board documents released their provider and portals destroyed their iframe.
User Impact
User impact: during a spotty connection your pages, roster, approvals and drafts stay where they were; actions that need the Gateway are disabled until it returns, and everything refreshes quietly on reconnect.
Why This Change Was Made
Request-generation fencing is unchanged; only presentation and drafts now outlive a same-identity transport edge, and they still reset on a different client, Gateway, account or recovery scope (covered explicitly by tests). Approvals stay visible but non-actionable offline and their reconnect refresh retries with the existing question-recovery backoff. Memory Import keeps explicit selections and inputs. Dialogs keep drafts with submit disabled offline; non-success results keep the dialog open with feedback, and a settled dialog can no longer submit against a replacement owner. Fixes are made at the shared owners (catalogs, roster activity, board provider lease) rather than per page where possible.
Part of the offline-first series.
Evidence
Landing integration proof (2b1f48c)
Merged main at a830701. Conflict resolutions retain the newer request/presentation owners and fixture helpers while preserving reconnect drafts/data, stale-response fencing, identity/access retirement, and uncertain-write handling. Adapted header fixtures, project recovery identity, Memory Import scope typing, and Dreaming state retirement to those owners. Independent Codex P2 review of the integration repairs was scoped-clean.
The initial affected unit batch passed 388 tests with one recovery-scope fixture mismatch; after correcting that fixture, the focused repair run passed 84 tests (one existing skip), including Memory Panel stale-read and interrupted-write coverage. Formatting of all resolved files and diff checks passed.
Local proof gaps retained: the UI editor-graph typecheck still reports 11 diagnostics in unchanged main files (missing declarations for regexp/quota-reset diagnostics and native-desktop Gateway bridge typing). The integration-specific type errors are fixed. An earlier board-toast E2E wait failed once in untouched code; it remains an unproven flake candidate. Exact-head PR CI remains the broad landing gate; these local observations are not a CI waiver.
CI integration repair (7395ee7)
CI run 39161256276 exposed two branch-transitive failures: retained project catalogs stopped incidentally rerendering the authoritative chat identity, and retained agent rosters stopped incidentally clearing Models rejection feedback. Chat now reads the Gateway projection directly. The Models E2E preserves its authoritative model/agent assertions and checks rejection retention, no write replay, and clearing/read-only options on access loss.
The presence failure reproduced locally; all seven existing presence tests pass after the owner fix. The single permitted Models E2E replay passed five scenarios and the reconnect retention/no-replay checks, then failed on an added trigger-disabled assertion. The trigger is intentionally browseable read-only; the final test uses the established option-level disabled/forced-click contract. Those final access-loss assertions subsequently passed exact-head CI on 7395ee7; no second local replay, skips, timeout changes, or CI reruns were used. Final independent Codex P2 review is scoped-clean; formatting and diff checks pass.
Final conflict integration (7bcd449)
Merged main at 1ab6b64. The two conflict resolutions preserve main's input-dialog initial request ownership and live settled reads, plus its Inbox fixture refactor, while retaining offline submission blocking, profile-loss clearing, reconnect retention, and stale-response fencing. Main's optional explicit Gateway binding source remains intact.
All 43 tests in mentions, input-dialog, and gateway-page-binding passed with one worker. Scoped formatting and diff checks passed; independent review of the mechanical resolutions found no likely defect. Exact-head CI run 39169382359 completed successfully and openclaw/ci-gate passed on 7bcd449. Earlier local proof gaps remain disclosed above.
Exact-head inherited-failure qualification (073d7b4)
CI run 39181178586, attempt 1, remains failed. Landing is authorized through the native inherited-failure exception; this does not claim green CI. The tested merge is
93c2665d947b07e142802157c1fd4b8d834b1545, with main baseline52bd03a34f53d37a36cec8c86d298ade3630b1c1and PR head073d7b40565c7c88424205dcbedca7fd56b8fccbas ordered parents. The fetched tree matches their reconstructed merge.control-ui-performance(job 117834374153): chat boot gzip is 1,490,815 B against the unchanged 1,490,000 B ceiling. The same job measured main at 1,490,971 B; this branch reduces it by 156 B. The absolute ceiling failure is inherited.checks-fast-baseline-ratchets(job 117834374023): mock-exports flagssrc/cli/program/root-help.test.ts:33,./subcli-descriptors.js. The mock originated on main in9b4f26e70af(Plugins/CLI: add descriptor-backed lazy root command registration #57165); the CLI and checker source trees are unchanged by this branch.checks-ui-e2e (7/9)(job 117834374260):chat-pasted-text-show-in-text-field.e2e.test.ts, “restores pasted text directly from the 1280px composer,” fails with the same “Keep this draft” versus appended “Quarterly launch…” assertion on scheduled-main run 39176649118, job 117820740755, head943e9af522a. Both logs were compared; the test is unchanged.checks-node-changed-compact-large-17(job 117834374558): the Bun Gateway session-row-deltas integration case times out at 120 seconds and retains its temporary namespace. The fullsrc/, execution scripts, workflows, package manifest and lockfile are identical to the tested main baseline. This UI/docs-only branch changes none of those inputs. The earlier local RPC timeout remains an unresolved observation, not a claimed reproduction of the hosted mechanism or a repair.All three UI unit shards, production/test types, lint, and
security-fastpassed on this exact head. Earlier independent Codex review was clean; subsequent mechanical integration and scoped proof are retained. No assertions, skips, timeouts, budgets or baselines were weakened. Enforced security/review checks remain required by native admission.Final authorized conflict repair (87b29ad)
GitHub rejected the prior exact-head landing before dispatch after main introduced conflicts in the Models route and dashboard tests. Merged main
c5111f4067a3978c989e061293056659b264c5c4once, preserving its refactored test helpers and reapplying only the existing authenticated Models fixture and dashboard offline-retention assertions. No production fix, assertion weakening, skip, timeout, budget, or baseline change was added by the conflict resolution. Independent Codex P2 review of the two resolutions was scoped-clean.Focused local proof: Models route passed all 18 tests; dashboard passed 5 of 9, with four
expected null not to be nullrendering failures before the offline assertions. All four also reproduced on the exact integrated main snapshot (7 of 9 dashboard cases failed there), so they remain documented baseline observations, not claimed fixes. Combined branch test command took 49.81 seconds (Vitest 37.13 seconds); main comparison took 54.92 seconds (Vitest 38.51 seconds). Scoped type-aware lint, formatting, and diff checks passed.CI run 39186064265, attempt 1, completed all 69 jobs on
87b29ad22d6d2a833c5cf6d38193d0ca92644a5f. The tested merge231b8f033eb57f4bb1b744773823a5154633aab1has main baseline1eae3320e169706eedf83fafb684f292e1ec69a6and this PR head as its ordered parents; its tree equals the independently reconstructed merge. Exactly two non-aggregate jobs failed, both re-qualified as inherited:control-ui-performance(job 117848986075): chat gzip is 1,491,024 B against the unchanged 1,490,000 B ceiling; the same job measured main at 1,491,219 B. This branch reduces it by 195 B.checks-node-changed-compact-large-27(job 117848986552): the same Bunserver.session-row-deltas.integration.test.tscase, “capable and legacy sockets produce identical session payloads and consumer state,” times out at 120 seconds and retains temporary resources. The completesrc/,scripts/,.github/,packages/, andtest/trees, package manifest, and lockfile are byte-identical to tested main. This is the previously attributed main-owned failure in a newly numbered shard; CI's “unknown” classification reflects the lack of a matching main shard, not new causal evidence.All three UI shards, UI E2E jobs, production/test typechecks, lint, and
security-fastpassed on the repaired head. The local dashboard observations above remain disclosed; hosted success does not claim they were repaired. Landing is authorized through the inherited-failure exception for these two failures, with live review and security requirements still enforced. CI remains failed; no rerun, further branch repair, weakened assertion, timeout increase, or budget change was used.Exact-head inherited-failure qualification (f9ae2d6)
CI run 39191621242, attempt 1, is complete and failed. This exact-head landing uses the authorized native inherited-failure exception; CI is not green. Tested merge
51a2da04257d37823764462ff5c03f78b17e9161has ordered parents main3d8c860ac6ac9edb81bacd524680cc85f1d229c0and reviewed PR headf9ae2d6f70aa477d2847d63d4ff1503a4517f840. Its tree matches the reconstructed merge. The branch changes onlyui/anddocs/web/control-ui.md.control-ui-performance(job 117865844103): main chat boot gzip is 1,491,439 B, already above the unchanged 1,490,000 B ceiling. The branch reduces it to 1,491,270 B (-169 B).checks-ui-e2e (5/9)(job 117865844266):session-list-filter.e2e.test.tsfails both “refetches instead of showing a row excluded by configured-agent filtering” and “keeps the Sessions page query stable when the startup roster completes.” Both assertion signatures match scheduled-main job 117864340314, whose log was compared directly. The test source is identical to tested main. Coordinator verification also found shard 5 red on the last two scheduled main heads,a8771a5a154and9d013baeb67.check-test-types(job 117866130264):extensions/codex/src/app-server/native-subagent-monitor.parent-retention.test.ts:37reports TS2353 forcompletionDeliveryRetryDelaysMs. Although the classification table labels this new against an older passing scheduled run, the entireextensions/,src/,scripts/,.github/, test tsconfigs, package manifest and lockfile are identical to the actual tested main baseline. This UI/docs-only branch does not introduce the failing input.openclaw/ci-gate(job 117868663293) fails downstream of exactly those three jobs.All three exact-head UI unit shards and
security-fastpassed. The exact-head review andgithub_pendingpreparation are reused. The latest scoped conflict proof passed 94 unit and 12 browser tests; earlier unresolved local observations remain disclosed above. No commit, CI rerun, assertion weakening, timeout increase, or budget change was added for this landing. Enforced review and security checks remain required by native admission.