Skip to content

P5 O2: mawsd, the per-profile daemon that owns the engine host and the pty host - #296

Merged
SSFSKIM merged 102 commits into
masterfrom
p5-o2
Oct 28, 2026
Merged

SSFSKIM merged 102 commits into
masterfrom
p5-o2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 28, 2026

Copy link
Copy Markdown
Owner

P5 child O2: mawsd, a per-profile daemon outside Electron that owns the engine host and the pty host.

  • On macOS, the default profile's LaunchAgent runs it; a packaged app installs or repairs that agent.
  • On Linux, a systemd user unit with lingering runs it. devenv up installs it into a content-named release with its own Node 24.21.0.
  • Any other profile starts a private mawsd.
  • Sessions are released strictly, by interest. A session is never released while it holds crons (Stop or the durable scheduled_tasks.json), background tasks, or work it cannot read.
  • Terminals outlive the app.
  • Settings version 20 makes the daemon shape the default. Wire minor is 3.5.
  • A test or harness launch refuses the default profile (O3's planner P9).

Execution document: docs/doperpowers/plans/2026-10-27-p5-o2-mawsd.md. Its Outcomes & Retrospective table holds acceptance 1–11. The hand-back report is docs/doperpowers/plans/2026-10-27-p5-o2-report.md.

Validation Evidence

The landing head is f3fd340b9 (tree 892d99838), with master 790002644 merged. The commits after it touch only docs.

Claim Command Result
Static, unit (4 shards) and probes pass scripts/ci-gate.sh <worktree> --class1a pool --peer none GREEN, run 40703662055
Every hosted Mac e2e group, e2e:desk-web-hub, and e2e:cross-build (this build at 3.5 against master 79000264 at 3.4, four scenes including (update, daemon) and (downgrade, daemon)) scripts/ci-gate.sh <worktree> --runner macos --lane hosted 36 of 37 GREEN, run 40704450189. e2e:connectors-direct :591 timed out on git rev-parse (10 s), then passed on its rerun, run 40710872036 GREEN
Packaged (including e2e:supervisor-daemon:packaged and the canonical-mawsd no-touch check), e2e:default and unit:darwin on the mini scripts/ci-gate.sh <worktree> --gates packaged,e2e:default,unit:darwin --peer none GREEN, run 40704479546
Idle cost within the bound re-derived on the landing tree (the architect's ruling) e2e:daemon-idle-baseline ×3 and e2e:daemon-idle on the mini, --evidence, in CI-opt's quiet window on d6037a48a Baseline 65729 / 70881 / 67409 KiB, median 67409 KiB and 0.11 s, giving a bound of 101113 KiB and 1.11 s. Daemon shape 97683 KiB (40671838782) and 99219 KiB (40676048769), both within; CPU 0.11–0.13 s
Bench e2e:local-latency-daemon, M9 (6df807077) p50 25.9 / p95 38.4 ms against limits 26.45 / 42.56; round trip 1.1 / 1.6 ms against 2.9 / 6.3. Run 40606738513
The daemon's code is unchanged since the idle window git diff d6037a48a f3fd340b9 -- src/mawsd src/engine-host src/pty-host Empty. The shared graph gained only schema data: O7's two optional machine-state fields (+523 B) and #292's optional lastPrompt

The three idle readings:

Reading Tree Result Bound
M1 baseline (detached supervisor) d14e92991 64481 KiB, CPU 0.11 s —
M9, daemon shape 6df807077 94947 KiB M1's fixed 96721
Landing window, daemon shape d6037a48a 99219 / 97683 KiB, about 1.9% to spare Re-derived 101113

The first daemon run after the master merges read 101411 KiB against 96721. That miss is what led to the re-derivation ruling.

Acceptance 5 and 6 rest on M8's VM transcript (dc-m8accept-dcef, at fe52fd122). The cross-build scenes are M9's two-build check, re-run above. The architect accepted both.

A canonical mawsd on the mini cannot collide with the job's own:

  • The e2e labels are dev.maws.mawsd.e2e-<run>-<attempt>-<case>. The sweep checks each whole label against ^dev\.maws\.mawsd\.e2e-[A-Za-z0-9._-]+$ and touches nothing else.
  • Sockets and locks are per profile, and the temporary-directory fallback is hashed per profile.
  • mawsd listens on no TCP port at O2.
  • The job's profile is a scratch MAWS_USER_DATA.
  • e2e/support/canonical-mawsd.ts snapshots the canonical plist, the default profile's sockets, lock and mawsd/ tree. It fails on any change the job could cause.

The gate.yml change (the launchd sweep steps and the packaged daemon-shape check) goes to CI-opt for review at landing.

Master moved to 180e7d1ee (#294, CI and desk-hub only) after these gates ran. git merge-tree against it is clean.

Reviews: every milestone task review ended clean, and the branch review (high rung) ended Ready.

Flakes seen, none in O2's paths:

  • src/main/ipc/ipc.test.ts:1140: artifactScope non-JSON, run 40555429960.
  • src/mawsd/cli-prompt.test.ts, "mawsd enroll at a terminal > abandons the enrollment at ^C…": a 15 s real-pty timeout in unit 3/4, run 40685963579 on ebed09b69, a commit that only changes mocks. The rerun 40688958878 was GREEN.
  • e2e/settings.spec.ts:262 (WR desk: a machine's reconnect invisible to the reader, and an end-to-end latency budget #57): reproduced once at 99c2c533c (40681661133). GREEN on the final tree.
  • e2e/connectors-direct.spec.ts:591: see the hosted row above.

Unresolved Review Findings

  • src/main/hosts/host-supervisor.test.ts suppresses console output without asserting on it. Minor, from M3's task review. Left because it hides no failing behaviour and touching it was out of milestone scope.
  • src/mawsd/cli-prompt.test.ts does not tear down its pty child when a test fails. Minor, from M6's task review. This could relate to the unit 3/4 flake above: a leaked pty child under load. It is worth fixing with that flake's ticket.

Residue

  • Trim mawsd's eager start-up graph. The idle margin is about 1.9% (99219 of 101113 KiB), and the bench p50 has 0.55 ms to spare. mawsd loads electron-vite's ~603 KiB shared chunk, which includes registry-wide IPC schemas. An entry of its own that imports only the daemon.status schema, the host envelope and the socket/lock code is the lever. Outcomes & Retrospective describes it; P5 Risks row 27dda37d5.
  • Split src/mawsd/daemon.ts (about 800 lines): extract the pty-credit controller and the endpoint-channel adapter. This is maintenance, not a defect.
  • Make the quarantine mark survive an engine-host restart. Today it lives in memory, so after a restart a fresh state file reads as a never-saved lineage again. Persisting it needs a state-file key that older strict readers do not move aside.
  • Use a deterministic build stamp for Linux packs. Every rebuild is a new release, so a devenv up whose setup reruns restarts mawsd (its hosts keep running).
  • Verify the Node runtime's GPG signature. SHASUMS256.txt is fetched over HTTPS, but its GPG signature is not checked.
  • Recover from a crash during a recycle drain. A host that crashes mid-drain is restarted with no crash count and no pty.exit; the pty relay is never recycled.
  • Downgrade orphan. A socket-mode pty host would be orphaned by a downgrade to a pre-O2 build. Found by reading, not observed.
  • Sign MAWS. Until it has a stable identity, an ad hoc build's TCC grant is tied to its cdhash, so each new build may be prompted again for Documents and Desktop.
  • The flakes cli-prompt.test.ts (^C enrollment), settings.spec.ts:262, connectors-direct.spec.ts:591 and ipc.test.ts:1140 (the architect files the last).
  • Lingering devcloud VMs. dc-o2probe-ac5c and dc-m8accept-dcef may linger in the desk's Machines list after deletion.

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

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… the detached supervisor's RSS and CPU holding one kept idle session; the bound derived from a baseline still pending)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… (fixtures, findings, "p5 O2" replay tests)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…(the work state from the Stop callback and the durable crons' file, host.interest, the machine role, the keep mark, WIRE_MINOR 1)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…st held by the app's interest, the role in its deps; two test typings)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…, coalesced, resent at streaming); the sidebar's Keep running; the budget names scheduled jobs and unreadable work; e2e pins a laptop role

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…le crons absent from Stop)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…s the interest report; a test typing); a comment rewrapped

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

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…t (proc_pid_rusage through python3's ctypes, checked once per run against top's MEM), RSS kept as a diagnostic; baseline and bound move to footprint (P5 Decision Log 48)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…replay of main, session-resume, durable and durable-resume; the handshake projects their Stop hook; the synthetic stand-in retired); P5 Decision Log 49's cron record bounds a resume's unknown

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…e journals; a test typing)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…re, the detached transport and identity in src/shared/host; external ready, recycle, on-demand hosts, raw forwarding, relayed transports, build policies and start strategies; private paths on every listen and connect; badToken close, many clients and the peer's end in the socket layer)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…er 600 s; three mini runs at d14e929)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…or measures the bare Electron runtime as Node; the bound per process (engine host 1.5x the supervisor, mawsd 1.5x the floor, CPU combined); the floor pending

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…nreadable while the lineage cannot load and another id's job is in the file; a cron record write that failed is retried and leaves the record unadmitted until a write succeeds)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…, a file or another uid's socket at its socket path and leaves it in place; a retry's refusal is reported whenever any field changes; one create-if-missing private directory, in an internal private-listen.ts)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…wn file beside the state file, written atomically; a failed save unlinks it, so a new store reads it as missing and the resume stays unknown; an unlink that fails too is logged and the live store still refuses the record)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… mode beside the utility mode over a shared socket-host.ts with the engine host; pty.data as capability-gated 0x01 frames; the pty host's commands and events on the wire manifest under M2's minor; pty.attach credit: false; the renderer reattaches terminals across a reconnect to the same pty-host pid)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…4.5; three mini runs at 36704c9), so the bound is engine host 96721 KiB, mawsd 19729 KiB, CPU 1.11 s per 600 s

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… shape's processes together within 96721 KiB and 1.11 s per 600 s; the runtime floor kept as a diagnostic

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…only when no unit was installed before; with one, current goes back so the reachable retry restarts the unit onto the new release

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…utable, since its requireFirst hook cannot load into app.asar (the unpackaged sets still run it)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… findings into the document; releases named by content

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…unchAgent is MAWS's; sessions' children inherit the grant; an ad hoc build's grant is its cdhash's)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…s mawsd and the engine host together with each one's footprint, compares Electron with the runtime floor's, and asserts DAEMON_IDLE_BOUND

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…aside as unreadable load as unavailable, not as a clean empty lineage, until they are saved again, so a durable job an id before a /clear created still holds the resumed session

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…evcloud/env, not the devcloud seed (O14's execution document)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… an identity the profile already has, naming its machine.json, the ref it keeps and the id it ignored; the install still succeeds

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…: the driver profile's [desk] delegation_id, through devcloud's descriptor into /etc/devcloud/env, not anything provisioning decodes from the seed

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…job creates, changes or removes anything of the account's canonical mawsd: its plist, the default profile's sockets and lock (in mawsd/ and the TMPDIR fallback), or that profile's mawsd/ tree by names and mtimes

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…ive canonical daemon writes on its own (logs, out files and their rotations, endpoint/ below its top level, directories' mtimes), in a helper with its own unit test; gate.yml's comment states the invariant

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…20, wire minor 3)

Master's settings version 19 (the launch profile's output style removed) stays as master has it; O2's
supervisor.shape becomes version 20, migrated from a kept version 19 schema, and the current defaults are
SETTINGS_DEFAULTS_V20. Master's WIRE_MINOR 2 (P5 O10 M7 and M8) stays; O2's additions are minor 3, and the
manifest is regenerated. host.interest and session.setKeep sit beside O10's host.op, host.opQuery and
session.pendingItems in the names, grades, schemas and deadline shapes.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…eDaemonStatus, now that O2 grades it list

O10's endpoint refused daemon.status `ungraded` until O2 graded it, and left the call's executor to O2. With O2's
`list` grade merged, the call reached no executor and answered `unavailable`. It now asks mawsd through the seam's
dispatch and answers the status less every field the schema marks local-only (the profile and log paths);
`unavailable` when mawsd cannot answer. calls.test.ts proves both.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…tached supervisor, recording only

The same spec's scene under MAWS_HOST_MODE=detached, no mawsd, in MEASURED_E2E: it asserts no bound and records the
footprint and CPU the daemon shape's bound is derived from, so the baseline is re-measured on the tree under test when
a landing misses (the architect's ruling on O2's landing miss).

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

O6 M1 to M5 meet O2 here:
- settings stays version 20 on master's 19; the tests O6 touched name SETTINGS_DEFAULTS_V20
- the ipc registry lists daemon beside machine and machines; HostOwner lives in host-supervisor only
- socket-server: O2's relay admission becomes admitHello, beside O6's peer check admit
- the pty registry keeps O2's wait-and-reattach per machine (each machine's ready pid)
- interest and the open session tabs read addresses on the local machine
- main starts the machine identity before settings, then O2's hosts and O6's machines
- the link surface lists O2's ptyHostEvents
- WIRE_MINOR is 4 (master's 3 + 1); the manifest is regenerated

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… measured prebuild; wire minor 5)

- engine-host ipc: O2's setKeep deadline beside lane B's engine.pendingItems
- WIRE_MINOR is 5 (master's 4 + 1), with socket.ptyFrames; the manifest is regenerated
- O6's snapshots name O2's commands: routes.json (session.setKeep addressed; daemon.*,
  host.interest and pty.recaptureEnv machine-wide) and address-paths.json (setKeep's
  and host.interest's session ids)
- gate-plan.test: a measured group whose script builds no out/ (daemon-idle-floor,
  tool-time-heavy-live) keeps the one-guard timeout under #273's prebuild
- the counts: 98 bare specs (machines, daemon-unit, daemon-idle); pool demand 2x35/2x36/2x35
- Sidebar's Keep running test installs the fake bridge as O6's tests do and expects main's bare id

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…yout at the session's address

O6 keys a session's panel layout by its address (panel.<machine>/<id>); the scene's
second layout poll still read panel.<id> and found nothing (hosted run 40666008715).

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…e idle bound re-derived on the landing tree

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…rvisor, 101113 KiB and 1.11 s

The architect's ruling at the landing (superseding P5 Decision Log 57's fixed number): the
bound is 1.5 times today's detached supervisor measured on the same tree. DAEMON_IDLE_BASELINE
is that record (d6037a4; runs 40650181035, 40669418019, 40673974571; 67409 KiB, 0.11 s);
M1's record stays as DAEMON_IDLE_BASELINE_M1. The daemon shape's two valid runs in the same
window (97683 and 99219 KiB) are within. The test derives from the records instead of pinning
the bound, and mawsd's headroom is now 33704 KiB.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… O10's send buffers; wire minor stays 5)

A clean merge: master's wire is still 4, so O2 stays at 5 and the regenerated manifest is
unchanged. O7 M1's org session joins startMachines inside main's start, after O2's hosts.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…O3's planner, P9)

A launch with MAWS_E2E=1 or MAWS_HARNESS=1 and no MAWS_USER_DATA ran on the default
profile. Planned embedded there while the owner's mawsd was up, prepareShape left the daemon
shape and ended the owner's mawsd and its socket-mode pty host (their terminals and kept
sessions); planned packaged, it installed or uninstalled the owner's LaunchAgent.

- hosts/mode.ts: testLaunchRefusal(env, defaultProfile), pure; one line naming MAWS_USER_DATA
- daemon.ts resolveLaunch: exits 1 with that line before the unit is read or any plan runs
  (LaunchDeps.exit)
- main/index.ts: the same check right after MAWS_USER_DATA is applied, before the profile
  lock, the machine identity, the settings or a host
- package.json dev:harness: its own profile (MAWS-harness, as dev:stub has MAWS-stub)
- tests: the decision over E2E/HARNESS x profile x MAWS_HOST_MODE; resolveLaunch with the
  owner's unit loaded and daemon locks present never installs, starts, uninstalls, leaves or
  awaits, and exits 1; the mode table's harness-on-default rows now refuse

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

lifecycle, root-wiring and main-wiring import src/main/index.ts over a mocked ./hosts, which
now has to export refuseTestLaunchOnDefaultProfile (class 1a run 40683858870).

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…ixtures #289, CI #288 and #290; wire minor stays 5)

replay-fixtures.test.ts: master's p4/p5 listing, which already reads O2's Stop-hook probe
journals under fixtures/p5; its comment names both P5 sets. Master's wire is still 4, and
the regenerated manifest is unchanged.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…5, settings v20)

- src/main/index.ts: in startMain, O2's settled hosts (createHosts(MAIN_BUILD, launch)),
  then #287's org session, Registry feed and org handlers, then O6's machines, which read
  that session. #287's org shutdown closes startMain. startMain is O2's function (the lock
  callback closes once the launch has settled), so #287's closing line for the lock
  callback is not taken. The P9 guard and the identity, settings and launch order stand.
- grades.ts and schema.test.ts: both sides; daemon, then machine, machines and org.
- Master's wire is 4 and its settings are 19, so no re-bump. The regenerated manifest is
  unchanged.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…ding merges in the Decision Log; Outcomes & Retrospective

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM merged commit 7a5893b into master Oct 28, 2026
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
…296), mawsd; acceptance 14's bound re-derived on the landing tree; O3-A and O3-B dispatched; seven tracker rows

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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