edge: hold opted-in event streams while instances sleep (#432)
A browser EventSource opened with carlos_hold=1 on a hibernating instance is held by the edge while the instance sleeps and resumed with Last-Event-ID when something else wakes it. A held stream never counts as activity and never wakes anything. Activator: held legs admitted and registered under a.mu, cancelled synchronously before every stop, swap and entry removal. Edge: marked requests classified once after lookup, hold branch after the password gate, one stream task per browser relaying whole SSE events through the route's own proxy, heartbeats, wake-hook and tick reopens, caps, no shared caching of marked requests. held_streams counters in the box status snapshot. Design rev 3 and plan rev 2 approved by Paul (discussion 432). Astra per-task and whole-branch reviews; census approved. Also fixes a pre-existing race in run_cutover_witness_test.go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Prompts: <task-notification> <task-id>bnge9aug2</task-id> <tool-use-id>toolu_01Bqvonzn4uJMXiaoBtK1Rv4</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2133d32c-5178-487f-857e-d1ed11ea0d38/tasks/bnge9aug2.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 2" completed (exit code 0)</summary> </task-notification> <cross-session-message from="uds:/run/user/1001/cc-socks/2325897.sock" from-name="platform-4e" from-mode="bypass"> Are you driving rootfs Plan 3 Group W (worktree .claude/worktrees/rootfs-apps-3w, branch rootfs-apps-3-workers; W1a done 5b341104, W1b uncommitted, files last edited 10:19Z)? Paul asked me (platform-4e) what's left on rootfs and whether it's ready to roll to flagship. I won't touch that worktree. If it's yours, please reply: is W1b's implementer still running, what's left in W, and anything you know blocking a flagship roll of v0.29.0+. </cross-session-message> go ahead. Squashed from edge-held-streams-432 into main. Co-Authored-By: claude <claude~paul@keymail.dev>
docs/superpowers/notes/census-edge-held-streams-claims.md+36 −0docs/superpowers/notes/census-proposal-edge-held-streams.md+70 −0docs/superpowers/notes/edge-held-streams-followups.md+10 −0docs/superpowers/plans/2026-10-28-edge-held-streams.md+338 −0docs/superpowers/plans/CODEX-FINDINGS-edge-held-streams-plan.md+175 −0docs/superpowers/reviews/ASTRA-FINDINGS-edge-held-streams-branch-R1-fixes.md+45 −0docs/superpowers/reviews/ASTRA-FINDINGS-edge-held-streams-branch-R1.md+78 −0docs/superpowers/specs/2026-10-28-edge-held-streams-design.md+497 −0docs/superpowers/specs/CODEX-FINDINGS-edge-held-streams-R2.md+109 −0docs/superpowers/specs/CODEX-FINDINGS-edge-held-streams.md+154 −0docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-held-streams-R2.md+101 −0docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-held-streams.md+88 −0internal/activator/activator.go+30 −69internal/activator/activator_test.go+175 −0internal/activator/claimproducer_test.go+2 −2internal/activator/claimwake.go+24 −2internal/activator/hacache.go+20 −0internal/activator/haforward.go+40 −5internal/activator/haforward_test.go+23 −0internal/activator/heldlegs.go+311 −0internal/activator/heldlegs_activity_test.go+173 −0internal/activator/heldlegs_guard_test.go+1,030 −0internal/activator/heldlegs_test.go+613 −0internal/activator/heldstream_e2e_test.go+1,041 −0internal/activator/maintenance.go+6 −2internal/activator/recoveryprobe.go+11 −0internal/activator/seed_exclusion.go+3 −1internal/activator/swap_sim_test.go+245 −7internal/activator/swaphold.go+2 −0internal/domains/rootfs_apex_test.go+6 −0internal/edge/alias_test.go+7 −0internal/edge/assetcatch.go+16 −0internal/edge/edge.go+229 −10internal/edge/edge_test.go+20 −0internal/edge/edgeerrors_test.go+10 −0internal/edge/forwardha.go+35 −2internal/edge/forwardha_test.go+10 −0internal/edge/genedge_test.go+7 −0internal/edge/guard_test.go+6 −0internal/edge/heldleg.go+14 −0internal/edge/heldstream.go+1,008 −0internal/edge/heldstream_dispatch_test.go+594 −0internal/edge/heldstream_sim_test.go+434 −0internal/edge/heldstream_test.go+930 −0internal/edge/homemap.go+21 −0internal/edge/ratelimit_test.go+6 −0internal/edge/reqrecords_test.go+7 −0internal/edge/sse.go+134 −0internal/edge/sse_test.go+68 −0internal/edge/tunnel_e2e_test.go+201 −0internal/edge/usagemeter.go+4 −0internal/edge/usagemeter_test.go+21 −0internal/host/activator_seam.go+10 −0internal/host/agent.go+22 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-edge-held-streams.tsv+66 −0internal/status/snapshot.go+20 −2internal/status/snapshot_test.go+17 −0run_cutover_witness_test.go+35 −25
CI passed — run details
landed from edge-held-streams-432
docs/superpowers/notes/census-edge-held-streams-claims.mdLoading diff…
docs/superpowers/notes/census-proposal-edge-held-streams.mdLoading diff…
docs/superpowers/notes/edge-held-streams-followups.mdLoading diff…
docs/superpowers/plans/2026-10-28-edge-held-streams.mdLoading diff…
docs/superpowers/plans/CODEX-FINDINGS-edge-held-streams-plan.mdLoading diff…
docs/superpowers/reviews/ASTRA-FINDINGS-edge-held-streams-branch-R1-fixes.mdLoading diff…
docs/superpowers/reviews/ASTRA-FINDINGS-edge-held-streams-branch-R1.mdLoading diff…
docs/superpowers/specs/2026-10-28-edge-held-streams-design.mdLoading diff…
docs/superpowers/specs/CODEX-FINDINGS-edge-held-streams-R2.mdLoading diff…
docs/superpowers/specs/CODEX-FINDINGS-edge-held-streams.mdLoading diff…
docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-held-streams-R2.mdLoading diff…
docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-held-streams.mdLoading diff…
internal/activator/activator.goLoading diff…
internal/activator/activator_test.goLoading diff…
internal/activator/claimproducer_test.goLoading diff…
internal/activator/claimwake.goLoading diff…
internal/activator/hacache.goLoading diff…
internal/activator/haforward.goLoading diff…
internal/activator/haforward_test.goLoading diff…
internal/activator/heldlegs.goLoading diff…
internal/activator/heldlegs_activity_test.goLoading diff…
internal/activator/heldlegs_guard_test.goLoading diff…
internal/activator/heldlegs_test.goLoading diff…
internal/activator/heldstream_e2e_test.goLoading diff…
internal/activator/maintenance.goLoading diff…
internal/activator/recoveryprobe.goLoading diff…
internal/activator/seed_exclusion.goLoading diff…
internal/activator/swap_sim_test.goLoading diff…
internal/activator/swaphold.goLoading diff…
internal/domains/rootfs_apex_test.goLoading diff…
internal/edge/alias_test.goLoading diff…
internal/edge/assetcatch.goLoading diff…
internal/edge/edge.goLoading diff…
internal/edge/edge_test.goLoading diff…
internal/edge/edgeerrors_test.goLoading diff…
internal/edge/forwardha.goLoading diff…
internal/edge/forwardha_test.goLoading diff…
internal/edge/genedge_test.goLoading diff…
internal/edge/guard_test.goLoading diff…
internal/edge/heldleg.goLoading diff…
internal/edge/heldstream.goLoading diff…
internal/edge/heldstream_dispatch_test.goLoading diff…
internal/edge/heldstream_sim_test.goLoading diff…
internal/edge/heldstream_test.goLoading diff…
internal/edge/homemap.goLoading diff…
internal/edge/ratelimit_test.goLoading diff…
internal/edge/reqrecords_test.goLoading diff…
internal/edge/sse.goLoading diff…
internal/edge/sse_test.goLoading diff…
internal/edge/tunnel_e2e_test.goLoading diff…
internal/edge/usagemeter.goLoading diff…
internal/edge/usagemeter_test.goLoading diff…
internal/host/activator_seam.goLoading diff…
internal/host/agent.goLoading diff…
internal/provision/testdata/plan14-root-reads-chain.tsvLoading diff…
internal/provision/testdata/plan14-root-reads-edge-held-streams.tsvLoading diff…
internal/status/snapshot.goLoading diff…
internal/status/snapshot_test.goLoading diff…
run_cutover_witness_test.goLoading diff…