Skip to content

carry-over follow-ups: carriesFrom only for a proven PTY, attach rows, claim-unmatched line (Fixes #70) - #72

Merged
nachumi-a2zoperations merged 2 commits into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-70-carry-followups
Nov 16, 2026
Merged

nachumi-a2zoperations merged 2 commits into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-70-carry-followups

Conversation

@nachumi-a2zoperations

Copy link
Copy Markdown

Fixes #70 (Refs #44, stage 3 piece (a), restart carry-over, observe only). These are the follow-ups from PR #68's Reviewer and Fable-3 reads.

S3: carriesFrom only for a PROVEN PTY (option B, the lane lead's ruling in #70)

  • The gap: the window route proved replacesPtyId only against a bound owner, so an unbound pane's restart named its PTY to the daemon unproven. The risk was a mislabelled carry if that id restarted within 60 s.
  • What changed:
    • stopReplacedPaneOwner (shared by both routes) now marks the replaced owner proven: true when main proved the PTY was the pane's: a bound owner with that ptyId, or (unbound) the PTY's own ptyPaneKey record = this pane.
    • carryOverFor(ctx.replacedPaneOwner) sends carriesFrom only for a proven replacement, on both routes. replace() runs before the spawn options are built (spawn-operation.ts), so the proof is known in time.
  • No refusal was added. An unproven window restart still stops the old PTY and runs exactly as before; it just carries nothing, and the old pane's held set expires with its carry-unclaimed line.
  • The runtime route already refuses an unproven id before the stop (spawn-replacement.ts), so it is always proven there.

S1: an attach never carries

  • Adapter: an attach-only spawn puts no carriesFrom on the wire. A spy on the public DaemonClient.prototype.request checks that.
  • Admission: an attach-only request that a client sends with carriesFrom reaches the host without it (a raw DaemonClient request).
  • Host: an attach to an existing agent pane never calls noteCarry.

S2: claim-unmatched line

  • An early claim that never meets a hold within CARRY_HOLD_MS now logs one pane-ownership-carry-claim-unmatched line {from, to} instead of expiring silently.
  • A claim that did meet its hold is not reported.

Nit: behaviour, not source text

  • spawn-carry-over.test.ts now tests carryOverFor on ReplacedPaneOwner values (proven, unproven, null).
  • The route rows run real spawns:
    • window route, pty-pane-restart-carry.test.ts on the restart harness:
      • bound pane → carriesFrom sent;
      • unbound with no record → the restart still runs, no carriesFrom;
      • unbound with a matching ptyPaneKey → sent;
    • runtime route, in the addendum test: ctx.spawnOptions.carriesFrom = the old id.

Red first (all local, MacBook, Node 24.22.1 + --config; the Reviewer's Dell run is the evidence)

  • S3: on fork-only 474ad64, the proven row (new API) and the "unbound, no record → no carriesFrom" row failed. The latter is the S3 bug: today it sends one.
  • S2: the two new rows failed (no line).
  • S1, by mutation:
    • removing admission's !attachOnly guard → 1 failed;
    • removing the adapter's guard → 1 failed (the wire row).
    • The host's own guard in reportCarry is structural: the host reports only from onCreated, which an attach never reaches. Removing that guard stays green; the host attach row pins the behaviour.
  • spawn-replacement.test.ts's expected owner gains proven: true (the runtime route always proves).
  • Now: src/main/ipc/pty, pane-ownership, terminal-host, the adapter carry file and the session-move test, 360/360 (74 files).

Gates (MacBook, Node 24.22.1, no override)

…TY, attach rows, claim-unmatched line (orca #70)

Observe only, Refs #44 stage 3 piece (a); follow-up to PR #68.

S3 (option B, the lane lead's ruling): stopReplacedPaneOwner now marks
the replaced owner `proven` when main proved the PTY was the pane's (a
bound owner with that ptyId, or the PTY's own ptyPaneKey record).
carryOverFor sends carriesFrom only for a proven replacement, on both
routes (it now reads ctx.replacedPaneOwner; replace() runs before the
spawn options are built). No refusal was added: an unproven window
restart still runs exactly as before and carries nothing, so the old
pane's held set expires with its carry-unclaimed line.

S1: attach rows. The adapter puts no carriesFrom on the wire for an
attach-only spawn; admission drops it from an attach-only request a
client sends; an attach to an existing agent pane never calls noteCarry.

S2: a claim that never meets a hold within CARRY_HOLD_MS logs one
pane-ownership-carry-claim-unmatched line instead of expiring silently.

Nit: spawn-carry-over.test.ts asserts on behaviour (carryOverFor), and
the route rows run real spawns (window harness, runtime addendum).

Fixes #70

Signed-off-by: Nachumi Eliyahu <[email protected]>
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