Skip to content

Local snapshots after an upgrade's mawsd restart: unknown, never empty; restored tabs kept and the reads asked again - #406

Merged
SSFSKIM merged 2 commits into
masterfrom
p5-snapshot-retry
Oct 31, 2026
Merged

SSFSKIM merged 2 commits into
masterfrom
p5-snapshot-retry

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Follow-up to #403. The upgrade's mawsd restart answers every startup read the page makes in that window with host_unavailable, and several one-shot local reads treated that failure as "nothing there". The worst case: the shell's local snapshot failed, so at hydration knownTab answered false for every local session, repairMain dropped their restored tabs, and the trimmed layout was saved. Every update hits this window (the owner's mawsd.log at 12:32:58–59.9Z).

One mechanism. askUntilAnswered (src/renderer/src/ipc/until-answered.ts) generalises #403's asker. A failed read is asked again when main reports the local machine's host.status, and immediately if one arrived while the read was still out. A rejected call counts as unanswered, and stopping it ends the asking. onLaunchMode now uses it.

The local snapshot (src/renderer/src/ipc/events.ts):

  • session.list, session.projects.list, session.digests and attention.list are retried until answered. The host.status subscription is made before any read, which keeps C1's rule that events are subscribed before snapshots.
  • The local machine counts as loaded only once its record side is in and the retention's intents are known.
    • Until then, knownTab keeps its tabs the way it already keeps an unloaded remote machine's, so hydration drops nothing and saves nothing trimmed.
    • When it loads, settleMachine(local) drops whatever is really gone.
  • Normal startup is unchanged: hydration still waits for the first answers rather than for success, and when everything answered the local machine is loaded before hydration.

Intents (src/renderer/src/sessions/store.ts, keymap/actions-runtime.ts):

  • A failed session.intent.list no longer applies an empty list.
  • TabRetention.ready now resolves to whether the first read held the intents, and known resolves once they are held.
  • Hydration still never waits forever, as the original design note requires; a failure now means "unknown", not "none".

Also retried: session.deletions.list, and the local laneA.list (its events are buffered again while the retry is out).

Review fix. A restored tab of a started session has no record while the local snapshot is unknown. With the launch mode and intents already answered, its pane mounted NewSessionEmptyState, which closed the tab as gone and so saved a trimmed layout. That self-close now also requires the session's machine to be loaded. The same gate protects another machine's record-backed tab while that machine connects.

Tests.

  • events.test: a failed local snapshot keeps the restored tabs and saves them whole, a host.status from another machine is ignored, the local host.status triggers a new snapshot, and the tabs settle once it loads. This fails on master: both tabs are dropped. A second case shows that intents still unknown keep local tabs until known resolves.
  • Also covered: the helper (other machine, in-flight retry, rejection, stop), the setup store (ready unknown, retried, known, deletions), lane A's retry with a change that raced it, and NewSessionEmptyState waiting for its machine.
  • e2e/cross-build's (update, mawsd restart) scene also seeds a session tab in layout.json and checks that hydration writes it back whole after the restart.

Left as is.

  • attention.pendingNavigate is main-owned, so mawsd never serves it and the restart window doesn't affect it.
  • The sidebar's skeleton still ends after the first local answer even when it failed, so for a moment it shows only what events have delivered. Holding the skeleton until the local machine loads is a UX call (on a permanent spine refusal it would never end), so I left it for a decision.
  • Another machine's failed snapshot is still only retaken at its next link generation. host.status is the local machine's signal.

Gate: run 41211435139 (--gates all --lane hosted --class1a pool --runner macos --peer b2c3c785f) succeeded with 0 flaky lines. e2e:cross-build had 5 passed and 1 skipped (the pre-O3 scene, which needs an O2-era peer); the scene logged "New chat enabled, the restored tab … kept". e2e:discover passed on its first attempt. The run tested d0d9109, whose tree (a257723592c0) is identical to this head's after the rebase onto 2aa6390.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

…d the restart's window answers host_unavailable is unknown, never empty, and is asked again until answered when main says the local host was heard (ipc/until-answered.ts, the mechanism onLaunchMode now rides); the shell's local snapshot keeps the local machine unloaded until its record side is in and the retention's intents are known, so hydration keeps its restored tabs and saves none trimmed, and they settle when it loads; the intent list no longer settles ready-and-empty (TabRetention.ready says whether it held them, known resolves once it does); the interrupted deletions and the local lane A list are asked again the same way; cross-build's (update, mawsd restart) also checks a restored session tab is kept and written back whole

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…: a restored tab of a started session has no record while the local snapshot is unknown, and with the launch mode and the intents answered its pane mounted NewSessionEmptyState, which closed the tab and so saved the layout trimmed; gone now also needs the session's machine loaded (which for the local machine is its record side in and the intents known), which also keeps another machine's record-backed tab while that machine connects

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@chatgpt-codex-connector

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

Copy link
Copy Markdown

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-31T16:12:26.220496Z 4230f4e PR opened
ℹ️ 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.

@SSFSKIM
SSFSKIM merged commit 155eb00 into master Oct 31, 2026
SSFSKIM added a commit that referenced this pull request Oct 31, 2026
…awsd restart and an unloaded snapshot never trims the layout (PR #406, master 155eb00); the sidebar skeleton's choice registered as board #407; the ledger gains O7 M2's paged-history names

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 31, 2026
…st reads retried after an mawsd restart), #408

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

# Conflicts:
#	src/renderer/src/ipc/events.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant