Skip to content

fix(ui): keep page drafts and data through reconnects - #174059

Merged
steipete merged 22 commits into
mainfrom
steipete/offline-drafts-pages
Oct 19, 2026
Merged

steipete merged 22 commits into
mainfrom
steipete/offline-drafts-pages

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Regression tests per owner for same-client retention and account/recovery-scope retirement (agents, identity, roster activity, projects, profile directory, session hydration, Cron, Memory Import, Activity, Dreaming, approvals, command palette, attention, mentions, sidebar session drafts, header rename, board document, portals).
  • An earlier remote Testbox run surfaced 19 failures (13 fixture/expectation, 3 product: header-draft identity key, settled-dialog submission, swallowed rename errors); all addressed in this branch. PR CI is the broad proof (Testbox capacity was unavailable for the rerun).

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 baseline 52bd03a34f53d37a36cec8c86d298ade3630b1c1 and PR head 073d7b40565c7c88424205dcbedca7fd56b8fccb as 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 flags src/cli/program/root-help.test.ts:33, ./subcli-descriptors.js. The mock originated on main in 9b4f26e70af (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, head 943e9af522a. 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 full src/, 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-fast passed 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 c5111f4067a3978c989e061293056659b264c5c4 once, 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 null rendering 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 merge 231b8f033eb57f4bb1b744773823a5154633aab1 has main baseline 1eae3320e169706eedf83fafb684f292e1ec69a6 and 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 Bun server.session-row-deltas.integration.test.ts case, “capable and legacy sockets produce identical session payloads and consumer state,” times out at 120 seconds and retains temporary resources. The complete src/, scripts/, .github/, packages/, and test/ 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-fast passed 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 51a2da04257d37823764462ff5c03f78b17e9161 has ordered parents main 3d8c860ac6ac9edb81bacd524680cc85f1d229c0 and reviewed PR head f9ae2d6f70aa477d2847d63d4ff1503a4517f840. Its tree matches the reconstructed merge. The branch changes only ui/ and docs/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.ts fails 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, a8771a5a154 and 9d013baeb67.
  • check-test-types (job 117866130264): extensions/codex/src/app-server/native-subagent-monitor.parent-retention.test.ts:37 reports TS2353 for completionDeliveryRetryDelaysMs. Although the classification table labels this new against an older passing scheduled run, the entire extensions/, 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-fast passed. The exact-head review and github_pending preparation 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.

@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T02:53:02.022564Z f9ae2d6 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: XL labels Oct 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread ui/src/lib/cron/index.ts
Comment on lines +758 to +761
export function invalidateCronMutation(state: CronState) {
// Already-dispatched writes may finish, but retired replies cannot change a retained draft.
activeCronMutations.delete(state);
state.cronBusy = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +89 to +95
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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +362 to +365
: previousState
? { ...previousState, [pageStatus]: "error" }
? pageKind === "refresh"
? previousState
: { ...previousState, [pageStatus]: "error" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 527 to 530
<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 ?? [])}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a266a1: Cold offline Memory Import now shows the disconnected explanation while previously authorized workspaces retain their plans and drafts through reconnects.

Comment on lines +125 to +131
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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.

  • Before: The editor resets and loses the unsaved prompt.
  • After: The editor retains the prompt and enables saving after reconnect.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The useful retention design has concrete privacy and recovery defects, and required authority-boundary behavior is supported only by mocked tests.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Brief connection interruptions discard loaded pages and unsaved edits.
Reason: Preserving users' work has clear value, and maintainer authorship establishes approval of the direction.

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
Reviewed head: 0ee1440f5ed5bd573af82a39fec945f6a2b9814c

Before merge

  • Add real behavior proof - Authority-chain proof required: exercise the real Control UI and Gateway with an unchanged account whose agent allowlist narrows during disconnect, fail reconnect discovery, and show excluded entries remain unavailable; also trace retained approval and board actions through allowed, revoked, and replacement-owner cases before RPC effects. Supplied evidence consists of mocked owner tests and an earlier failing Testbox run, with no after-fix runtime artifact for these boundaries. Redact credentials and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Keep excluded agents out of retained reconnect discovery (P1) - Start with a roster containing main and private, narrow the same operator's role to main while disconnected, then let the reconnect agents.list request fail with a transport or server error. The presentation key and operator.read scope can remain unchanged: recovery scope contains principal/device identity, not the agent allowlist. This catch now leaves the broader roster available to discovery indefinitely. The earlier privacy repair explicitly cleared it for this case. Retain private drafts separately, and require current authorized discovery before exposing roster entries after reconnect.
  • Preserve uncertain Cron creates until their outcome is reconciled (P1) - If cron.add commits but its acknowledgement is lost, the transport transition deletes mutation custody and clears cronBusy while retaining the create form. Reconnecting then enables Add again, while the first completion is ignored. The UI supplies no stable ID or declaration key, and the Cron owner generates a fresh UUID per add, so retrying the retained form can create a duplicate automation. Preserve an explicit uncertain outcome or a stable idempotent identity until the accepted write is reconciled.
  • Show Current Work refresh failures alongside retained rows (P2) - After Current Work has rows, a failed reconnect refresh retains currentResult and sets currentError. This rows-first branch returns null before considering props.error, and the error and Retry button exist only inside the message branch. Users therefore see stale running work with no indication that refresh failed and no local retry control. Render failure feedback independently of whether retained rows exist.
  • Record failed Run Inspector refreshes without discarding evidence (P2) - When the reconnect audit.run.inspect request fails after an inspector reached ready, the refresh branch restores previousState unchanged. The inspector remains ready, so neither its existing error recovery nor a refresh retry becomes available; a subsequent ordinary synchronization also skips the same ready client. Keep the evidence but record a retryable refresh failure, including restart recovery when a cursor expired.
  • Carry interrupted transcript pagination across both transport edges (P2) - Disconnecting during load-more calls reconnect with loading true but no capturable connection. It clears loading and retires the request. On the connected call, interrupted is now false and existing messages make the reload condition false, so the pending failedCursor is never resumed. Retain the interrupted-page intent through disconnect and consume it after a live scope is available.
  • Recover Wiki previews interrupted before content arrives (P2) - Open a Wiki preview and disconnect while wiki.get is pending. The preview starts with empty content and no error; this invalidation marks it no longer loading, and the old response is rejected by its task epoch. Reconnect reloads Dreaming resources but never reloads the preview. Its renderer consequently displays an empty successful preview with only Close available. Preserve pending preview intent for reconnect, or show an interrupted state with a retry action.
  • Resolve security concern: Principal identity does not establish current discovery permission - The agent allowlist is evaluated separately from the recovery identity; retaining a matching identity cannot authorize publication of the previous broader catalog.
  • Complete next step - Resolve GitHub's reported conflicts with main and validate the affected resolutions.
  • Explain or restore the original intent of Agent discovery after reconnect and failed reads - fix: hide agents excluded by operator roles from the picker #161019: Require live authorized discovery so a narrowed role cannot expose an older broader roster after reconnect failure.

Findings

  • [P1] Keep excluded agents out of retained reconnect discovery — ui/src/lib/agents/index.ts:247-250
  • [P1] Preserve uncertain Cron creates until their outcome is reconciled — ui/src/lib/cron/index.ts:758-761
  • [P2] Show Current Work refresh failures alongside retained rows — ui/src/pages/activity/current-work-view.tsx:89-95
  • [medium] Principal identity does not establish current discovery permission — ui/src/lib/agents/index.ts:247

Provenance

Tests

  • Missing end-to-end proof: Provide production-boundary reconnect and authorization-revocation evidence; the current tests use mocked RPCs, and base-fail/head-pass execution is not established for the added regressions.
Agent review details

How this fits together

Control 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
Loading

Technical review

Best 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:

  • [P1] Keep excluded agents out of retained reconnect discovery — ui/src/lib/agents/index.ts:247-250
    Start with a roster containing main and private, narrow the same operator's role to main while disconnected, then let the reconnect agents.list request fail with a transport or server error. The presentation key and operator.read scope can remain unchanged: recovery scope contains principal/device identity, not the agent allowlist. This catch now leaves the broader roster available to discovery indefinitely. The earlier privacy repair explicitly cleared it for this case. Retain private drafts separately, and require current authorized discovery before exposing roster entries after reconnect.
    Confidence: 0.97
  • [P1] Preserve uncertain Cron creates until their outcome is reconciled — ui/src/lib/cron/index.ts:758-761
    If cron.add commits but its acknowledgement is lost, the transport transition deletes mutation custody and clears cronBusy while retaining the create form. Reconnecting then enables Add again, while the first completion is ignored. The UI supplies no stable ID or declaration key, and the Cron owner generates a fresh UUID per add, so retrying the retained form can create a duplicate automation. Preserve an explicit uncertain outcome or a stable idempotent identity until the accepted write is reconciled.
    Confidence: 0.96
  • [P2] Show Current Work refresh failures alongside retained rows — ui/src/pages/activity/current-work-view.tsx:89-95
    After Current Work has rows, a failed reconnect refresh retains currentResult and sets currentError. This rows-first branch returns null before considering props.error, and the error and Retry button exist only inside the message branch. Users therefore see stale running work with no indication that refresh failed and no local retry control. Render failure feedback independently of whether retained rows exist.
    Confidence: 0.99
  • [P2] Record failed Run Inspector refreshes without discarding evidence — ui/src/pages/activity/activity-page-state.ts:362-365
    When the reconnect audit.run.inspect request fails after an inspector reached ready, the refresh branch restores previousState unchanged. The inspector remains ready, so neither its existing error recovery nor a refresh retry becomes available; a subsequent ordinary synchronization also skips the same ready client. Keep the evidence but record a retryable refresh failure, including restart recovery when a cursor expired.
    Confidence: 0.98
  • [P2] Carry interrupted transcript pagination across both transport edges — ui/src/pages/cron/run-transcript.tsx:125-131
    Disconnecting during load-more calls reconnect with loading true but no capturable connection. It clears loading and retires the request. On the connected call, interrupted is now false and existing messages make the reload condition false, so the pending failedCursor is never resumed. Retain the interrupted-page intent through disconnect and consume it after a live scope is available.
    Confidence: 0.97
  • [P2] Recover Wiki previews interrupted before content arrives — ui/src/pages/agents/memory/memory-panel-state.ts:91-92
    Open a Wiki preview and disconnect while wiki.get is pending. The preview starts with empty content and no error; this invalidation marks it no longer loading, and the old response is rejected by its task epoch. Reconnect reloads Dreaming resources but never reloads the preview. Its renderer consequently displays an empty successful preview with only Close available. Preserve pending preview intent for reconnect, or show an interrupted state with a retry action.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: Retained agent discovery can outlive a narrowed role's authorization.

Evidence

Security concerns:

  • [medium] Principal identity does not establish current discovery permission — ui/src/lib/agents/index.ts:247
    The agent allowlist is evaluated separately from the recovery identity; retaining a matching identity cannot authorize publication of the previous broader catalog.
    Confidence: 0.97

What I checked:

  • Pinned change and clean checkout: Inspected the introduced merge-base-to-head diff; the checkout remains clean. Current main still resets Cron state on transport transitions, so the central problem remains. (ui/src/pages/cron/cron-page-state.ts:164, 0ee1440f5ed5)
  • Agent authorization is narrower than recovery identity: Recovery scope derives from principal/device authentication material, not the operator role's agent allowlist; agents.list applies that allowlist separately using current configuration. (src/gateway/server/ws-connection/connect-hello.ts:112, 0ee1440f5ed5)
  • Previously protected discovery boundary: Current-main history attributes failed-read roster clearing to the earlier privacy repair; its discussion explicitly covers a narrowed role followed by a failed reconnect discovery read. (ui/src/lib/agents/index.ts:241, f864c660f56c)
  • Uncertain Cron create: Transport changes clear mutation custody and busy state while retaining the form; the UI supplies neither an explicit job ID nor declaration key, and the Cron owner generates a new ID for each add. (ui/src/lib/cron/index.ts:758, 0ee1440f5ed5)
  • Existing review discussion verified: The existing Codex discussion identified Cron settlement, Current Work feedback, Run Inspector recovery, and transcript pagination concerns; independent source inspection confirms those paths. The cold Memory Import concern was not retained because connection status already has a shared presentation owner. (ui/src/pages/activity/activity-page-state.ts:362, 0ee1440f5ed5)
  • Proof and merge state: The complete PR body and comments provide test descriptions but no current-change runtime artifact. GitHub reports the reviewed head as unmergeable with mergeable_state dirty; the supplied CI gate remains pending. (0ee1440f5ed5)

Likely related people:

  • Peter Steinberger: Raw commit 1b1283f adds ui/src/pages/cron/cron-page-state.ts:165 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1b1283fc06ae; files: ui/src/pages/cron/cron-page-state.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add P1: The change addresses lost work across common reconnects, but currently permits excluded-agent discovery and unsafe resubmission of an uncertain automation create.
  • add merge-risk: 🚨 security-boundary: A retained agent roster can remain exposed after the same operator's agent allowlist narrows, despite unchanged principal and recovery identity.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P1: The change addresses lost work across common reconnects, but currently permits excluded-agent discovery and unsafe resubmission of an uncertain automation create.
  • merge-risk: 🚨 security-boundary: A retained agent roster can remain exposed after the same operator's agent allowlist narrows, despite unchanged principal and recovery identity.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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 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.
@steipete
steipete force-pushed the steipete/offline-drafts-pages branch from 0ee1440 to 91e6411 Compare October 16, 2026 10:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a266a1: Interrupted memory writes now keep confirmed receipts and archive paths or show an explicit uncertain outcome warning without replaying the action.

Comment on lines +91 to +92
if (wikiPreview) {
wikiPreview.loading = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a266a1: Interrupted wiki previews stay visibly loading and reconnect automatically reloads the same modal while rejecting stale responses.

@steipete
steipete deleted the steipete/offline-drafts-pages branch October 19, 2026 04:28
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant