Skip to content

Commit a196b84

Browse files
authored
Durable stateful backend: cold re-attach, remove pi-mirroring, auto-mirror fan-out (#26)
* feat(server): durable stateful backend — cold re-attach, drop mirroring, auto-mirror fan-out Make the makit server a durable, multi-device WS backend where any device sees every session's activity live, and sessions survive a server restart. ## Cold-session re-attach (resume the live agent after a restart) - Persist `resumeSessionPath` alongside session metadata (new nullable SQLite column + `SessionMeta` field; back-compat ALTER for old rows). - `SessionManager.reattachSession(id)`: find the cold (rehydrated) session, rebuild the real adapter (pi resumes from its on-disk transcript via `--session`), swap it in with `replaceAdapter`, and start it. Non-pi / no-resume-path sessions stay history-only and keep emitting the clear `session.error`. - The durable `seq` space is preserved: new events continue after the persisted max (the store assigns the next seq), so mobile↔desktop handoff survives a restart end-to-end. - Wired via the `session.attach` cmd: `{sessionId}` re-attaches a cold session; legacy `{projectId, piSessionId}` still attaches an on-disk transcript (wire back-compat). ## Remove pi-mirroring (redundant now that makit owns/re-attaches pi) - Delete World B (file-tailing MirrorAdapter, `makit mirror`, `makit attach --pane`) and World D (`makit-mirror` extension, host sessions, IngestAdapter), plus the `pane/` + `mux/` infra and the standalone slash-palette fetcher (`commands.ts`). - `spawnSession` now always uses the headless PiAdapter; host token / `~/.makit/host.json` / auto-install wiring removed. ## Auto-mirror fan-out (every device sees every session) - `SubscriptionHub.fanout` delivers each session event to ALL authed clients, no explicit `sub` required. The `subscribed` set now only governs history replay-on-`sub` (with fromSeq cursor) and AskUserQuestion/ReverseRpc prompt routing. ## Tests - reattach: persist a pi-backed session + events → new manager on same store → reattachSession rebuilds a live adapter → next event gets seq = max+1 (continuity), history intact. - auto-mirror unit + a two-client integration test against a live startWsServer proving an event from one client reaches another that never subscribed. pnpm typecheck clean; pnpm test 228 pass / 0 fail. * ci: gate expensive macOS e2e to workflow_dispatch only macOS runners cost far more than the Linux gates, and the cheap Linux checks (server-ci unit tests + typecheck, protocol-contract, and the headless real-pi-pinned smoke) already cover regressions on every PR. - integration-ci.yml (stub-e2e, macos-latest): drop the pull_request / push triggers — the workflow is now workflow_dispatch only. (A manual dispatch already ran both stub-e2e and stub-e2e-coverage, so dispatch behaviour is unchanged; only the per-PR/push runs go away.) - real-pi-e2e.yml (real-pi-app, macos-15): gate to `if: github.event_name == 'workflow_dispatch'`. The Linux real-pi-pinned (PR/push blocking gate) and real-pi-canary (weekly schedule) are untouched. Run them on demand from the Actions tab (or `gh workflow run`) when a change warrants a full-stack check. * chore: re-trigger CI after CLA fix (empty; drops on squash-merge)
1 parent d6c4b02 commit a196b84

45 files changed

Lines changed: 868 additions & 3378 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/integration-ci.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,12 @@ name: Integration E2E (stub adapter)
33
# Keyless full-stack integration: real Flutter app ↔ real TLS WS server backed
44
# by the StubAdapter (server/src/adapters/stub.ts) on an iOS simulator. No LLM,
55
# no API key — the stub replies with scripted scenarios (echo, STREAM, THINK,
6-
# MARKDOWN, ASK_QUESTION, ASK_MULTI), so this runs on every PR/push as a
7-
# blocking gate. The real-pi path (needs a live pi + API key) stays in
8-
# real-pi-e2e.yml, opt-in only.
6+
# MARKDOWN, ASK_QUESTION, ASK_MULTI). macOS runners are expensive, so this is
7+
# MANUAL (workflow_dispatch) only — not a per-PR gate. The cheap Linux gates
8+
# (server-ci unit tests + typecheck, protocol-contract, real-pi-pinned headless
9+
# smoke) cover regressions on every PR. The real-pi path stays in real-pi-e2e.yml.
910

1011
on:
11-
pull_request:
12-
branches: [ main ]
13-
paths:
14-
- 'app/**'
15-
- 'server/**'
16-
- '.github/workflows/integration-ci.yml'
17-
push:
18-
branches: [ main ]
19-
paths:
20-
- 'app/**'
21-
- 'server/**'
22-
- '.github/workflows/integration-ci.yml'
2312
workflow_dispatch: {}
2413

2514
jobs:

.github/workflows/real-pi-e2e.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ name: Real-pi E2E (fake model)
77
# real-pi-pinned — pinned pi version, headless smoke on Linux, blocking on PRs.
88
# Failure = our bug.
99
# real-pi-app — real pi + Flutter e2e on iOS simulator (macos-15).
10-
# Full stack proof. Pinned pi, PRs only (slower/costlier).
10+
# Full stack proof. Pinned pi, MANUAL (workflow_dispatch)
11+
# only — macOS runners are expensive, so not a per-PR gate.
1112
# real-pi-canary — pi@latest on a schedule. Failure = a pi upgrade broke the
1213
# integration; opens an issue so we can bump the pin.
1314

@@ -81,9 +82,9 @@ jobs:
8182

8283
# Full-stack on macOS: real pi + real Flutter e2e via `tool/e2e.sh --mode real`
8384
# on an iOS simulator. Proves the complete makit↔pi integration on the target.
84-
# Pinned pi, PRs only (slower, costlier).
85+
# macOS runners are expensive — MANUAL (workflow_dispatch) only, not a per-PR gate.
8586
real-pi-app:
86-
if: github.event_name == 'push' || github.event_name == 'pull_request'
87+
if: github.event_name == 'workflow_dispatch'
8788
runs-on: macos-15
8889
timeout-minutes: 40
8990
steps:

server/extensions/makit-mirror-helpers.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

server/extensions/makit-mirror.test.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)