Repository navigation
kicad: a KiCad left by a thread switch is out of the pane for the idle close and the cap (#1345, PR C) - #1470
Merged
Merged
Conversation
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 20, 2026 20:02
17c112c to
9e3f5eb
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 20, 2026 20:36
9e3f5eb to
7e54879
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 20, 2026 20:49
7e54879 to
d5582bb
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…viction Close, and still clean, is ended as a hang (#1470, the KiCad lead's bound) On Windows (Carbon's main r2) a KiCad answered the hub's idle Close and never exited; with the closing guard an Edit then waited on it for ever. The existing 800 ms kill is not broken: it is only in close() (editor.kicad.close, the person's or an agent's), after Close answers; retire() (idle, evicted, appClosed) sends Close and nothing else. For the hub's idle and eviction closes only (a KiCad chosen clean: nothing unsaved, no dialog, in no pane), IDLE_CLOSE_BOUND (15 s; BACKPLANE_KICAD_IDLE_CLOSE_BOUND_S for tests) after the Close the same pid still running is checked again (bound_kill): still clean, it is killed and logged "a hang after its idle close: pid N still running M ms after the hub's Close, killed", and its exit ends the session as a clean one does (stopped, the idle reason kept), so the waiting Edit starts a fresh KiCad; unsaved or a dialog since, it is left and said. Every other close is unchanged (the close-wait PR's). Tests: a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean; e2e embed_closing_attach C2 now never lets the frozen KiCad go: ended at the bound (15000 ms, logged), a fresh KiCad on show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…; no answer starts the bound (#1470) Found writing the close-wait PR: retire() did not read Close's answer, so a Close KiCad refused (it became modified after it was chosen, or its task held it: CM_FAIL_IF_MODIFIED) left the session `closing` for good, and with closing_not_reused every later Edit would wait on a close that never came. Refused (an answer with a status: close_refused) clears `closing` and the stop reason and publishes; the bound counts from the answer. No answer at all (closed or timed out: a KiCad already going, or hung) is no refusal: the bound takes it. Test: a_refused_idle_close_ends_the_closing_but_no_answer_does_not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 20, 2026 21:30
f080345 to
6a053a3
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…viction Close, and still clean, is ended as a hang (#1470, the KiCad lead's bound) On Windows (Carbon's main r2) a KiCad answered the hub's idle Close and never exited; with the closing guard an Edit then waited on it for ever. The existing 800 ms kill is not broken: it is only in close() (editor.kicad.close, the person's or an agent's), after Close answers; retire() (idle, evicted, appClosed) sends Close and nothing else. For the hub's idle and eviction closes only (a KiCad chosen clean: nothing unsaved, no dialog, in no pane), IDLE_CLOSE_BOUND (15 s; BACKPLANE_KICAD_IDLE_CLOSE_BOUND_S for tests) after the Close the same pid still running is checked again (bound_kill): still clean, it is killed and logged "a hang after its idle close: pid N still running M ms after the hub's Close, killed", and its exit ends the session as a clean one does (stopped, the idle reason kept), so the waiting Edit starts a fresh KiCad; unsaved or a dialog since, it is left and said. Every other close is unchanged (the close-wait PR's). Tests: a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean; e2e embed_closing_attach C2 now never lets the frozen KiCad go: ended at the bound (15000 ms, logged), a fresh KiCad on show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…; no answer starts the bound (#1470) Found writing the close-wait PR: retire() did not read Close's answer, so a Close KiCad refused (it became modified after it was chosen, or its task held it: CM_FAIL_IF_MODIFIED) left the session `closing` for good, and with closing_not_reused every later Edit would wait on a close that never came. Refused (an answer with a status: close_refused) clears `closing` and the stop reason and publishes; the bound counts from the answer. No answer at all (closed or timed out: a KiCad already going, or hung) is no refusal: the bound takes it. Test: a_refused_idle_close_ends_the_closing_but_no_answer_does_not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 20, 2026 21:55
6a053a3 to
7708a5d
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…viction Close, and still clean, is ended as a hang (#1470, the KiCad lead's bound) On Windows (Carbon's main r2) a KiCad answered the hub's idle Close and never exited; with the closing guard an Edit then waited on it for ever. The existing 800 ms kill is not broken: it is only in close() (editor.kicad.close, the person's or an agent's), after Close answers; retire() (idle, evicted, appClosed) sends Close and nothing else. For the hub's idle and eviction closes only (a KiCad chosen clean: nothing unsaved, no dialog, in no pane), IDLE_CLOSE_BOUND (15 s; BACKPLANE_KICAD_IDLE_CLOSE_BOUND_S for tests) after the Close the same pid still running is checked again (bound_kill): still clean, it is killed and logged "a hang after its idle close: pid N still running M ms after the hub's Close, killed", and its exit ends the session as a clean one does (stopped, the idle reason kept), so the waiting Edit starts a fresh KiCad; unsaved or a dialog since, it is left and said. Every other close is unchanged (the close-wait PR's). Tests: a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean; e2e embed_closing_attach C2 now never lets the frozen KiCad go: ended at the bound (15000 ms, logged), a fresh KiCad on show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…; no answer starts the bound (#1470) Found writing the close-wait PR: retire() did not read Close's answer, so a Close KiCad refused (it became modified after it was chosen, or its task held it: CM_FAIL_IF_MODIFIED) left the session `closing` for good, and with closing_not_reused every later Edit would wait on a close that never came. Refused (an answer with a status: close_refused) clears `closing` and the stop reason and publishes; the bound counts from the answer. No answer at all (closed or timed out: a KiCad already going, or hung) is no refusal: the bound takes it. Test: a_refused_idle_close_ends_the_closing_but_no_answer_does_not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 20, 2026
…KiCad to be gone; a close that did not happen leaves it live; a waiting pane learns a refusal; no kill or eviction while it is in use From the cross-model review of 6a053a3, as the KiCad lead confirmed: 1. Two KiCads on one project: close() publishes the session stopped as Close answers and kills 800 ms later, and the fresh-start path started the next KiCad at once (the closing guard re-attaches the moment `stopped` is published). A session keeps its last pid when it stops (`last_pid`, cleared by the real exit); attach's start path waits for it to be gone (previous_alive, then gone_before_retry with restart's kill, Msg::AttachAfterGone), and never starts a second beside it. 2. The bound's "not killed" (not clean any more, a dialog, in use) cleared nothing: the session stayed ready+closing and every Edit was answered closing. It is live again now (Session::live_again, as a refused Close: also not chosen again at the next tick). The app-gone close has the bound too (its KiCads were chosen clean). 3. A waiting pane never saw a refusal: still_closing reads `closing` as well. 4. The bound could end a busy KiCad, and eviction could pick one mid-operation: `busy` (a named request in flight, in_flight; or a job, progress::has_jobs), read by note_use, keeps it from both. Also: a re-attach while the pane is off screen (a reconnect) says the leave again (LeaveState::resend). Tests: a_fresh_start_waits_for_the_projects_previous_kicad_to_be_gone (a real process as the previous KiCad), a_close_that_did_not_happen_leaves_the_kicad_live_and_not_closing, a_kicad_in_use_is_never_evicted_nor_ended_at_the_bound; client: a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (refusal), a_pane_off_screen_is_told_to_the_hub_once_settled_and_back_at_once (resend). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…viction Close, and still clean, is ended as a hang (#1470, the KiCad lead's bound) On Windows (Carbon's main r2) a KiCad answered the hub's idle Close and never exited; with the closing guard an Edit then waited on it for ever. The existing 800 ms kill is not broken: it is only in close() (editor.kicad.close, the person's or an agent's), after Close answers; retire() (idle, evicted, appClosed) sends Close and nothing else. For the hub's idle and eviction closes only (a KiCad chosen clean: nothing unsaved, no dialog, in no pane), IDLE_CLOSE_BOUND (15 s; BACKPLANE_KICAD_IDLE_CLOSE_BOUND_S for tests) after the Close the same pid still running is checked again (bound_kill): still clean, it is killed and logged "a hang after its idle close: pid N still running M ms after the hub's Close, killed", and its exit ends the session as a clean one does (stopped, the idle reason kept), so the waiting Edit starts a fresh KiCad; unsaved or a dialog since, it is left and said. Every other close is unchanged (the close-wait PR's). Tests: a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean; e2e embed_closing_attach C2 now never lets the frozen KiCad go: ended at the bound (15000 ms, logged), a fresh KiCad on show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…; no answer starts the bound (#1470) Found writing the close-wait PR: retire() did not read Close's answer, so a Close KiCad refused (it became modified after it was chosen, or its task held it: CM_FAIL_IF_MODIFIED) left the session `closing` for good, and with closing_not_reused every later Edit would wait on a close that never came. Refused (an answer with a status: close_refused) clears `closing` and the stop reason and publishes; the bound counts from the answer. No answer at all (closed or timed out: a KiCad already going, or hung) is no refusal: the bound takes it. Test: a_refused_idle_close_ends_the_closing_but_no_answer_does_not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…KiCad to be gone; a close that did not happen leaves it live; a waiting pane learns a refusal; no kill or eviction while it is in use From the cross-model review of 6a053a3, as the KiCad lead confirmed: 1. Two KiCads on one project: close() publishes the session stopped as Close answers and kills 800 ms later, and the fresh-start path started the next KiCad at once (the closing guard re-attaches the moment `stopped` is published). A session keeps its last pid when it stops (`last_pid`, cleared by the real exit); attach's start path waits for it to be gone (previous_alive, then gone_before_retry with restart's kill, Msg::AttachAfterGone), and never starts a second beside it. 2. The bound's "not killed" (not clean any more, a dialog, in use) cleared nothing: the session stayed ready+closing and every Edit was answered closing. It is live again now (Session::live_again, as a refused Close: also not chosen again at the next tick). The app-gone close has the bound too (its KiCads were chosen clean). 3. A waiting pane never saw a refusal: still_closing reads `closing` as well. 4. The bound could end a busy KiCad, and eviction could pick one mid-operation: `busy` (a named request in flight, in_flight; or a job, progress::has_jobs), read by note_use, keeps it from both. Also: a re-attach while the pane is off screen (a reconnect) says the leave again (LeaveState::resend). Tests: a_fresh_start_waits_for_the_projects_previous_kicad_to_be_gone (a real process as the previous KiCad), a_close_that_did_not_happen_leaves_the_kicad_live_and_not_closing, a_kicad_in_use_is_never_evicted_nor_ended_at_the_bound; client: a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (refusal), a_pane_off_screen_is_told_to_the_hub_once_settled_and_back_at_once (resend). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…n the previous KiCad is kept for it; busy has a quiet window; only the waited pid is forgotten 1. A leave behind a held attach (AttachAfterGone) reached a stopped session and was lost, so the new KiCad started with `left` empty while the pane had sent it (#1345 again on that path); a detach meanwhile had the same order. `Deferred` keeps them: a leave (or back) that comes for the project while its start is held is applied once the start has run; a detach cancels the held start. 2. `busy` was an instant: an agent's sequential calls have gaps. It is now others_busy(sock, BUSY_QUIET_MS = 10 s), for eviction and the bound. 3. AttachAfterGone forgets `last_pid` only when it is the pid waited on (Session::waited_gone). Also (review 6): RetryNow's "would not close" keeps the unkillable pid as `last_pid`, so the next start waits on it again. (Review 4, `live_again` wiping a person's closeAsked: not reachable here, the bound covers only the hub's own closes.) Tests: a_leave_or_a_detach_while_a_start_waits_on_the_previous_kicad_is_kept_for_it, a_held_start_clears_only_the_pid_it_waited_on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…the session itself; every attach, leave and detach meanwhile takes the paths of a starting session (the KiCad lead's shape) The delta review of 7716fc2 found that `Deferred` kept one slot per project while several attaches could be held at once (a warm-up and the pane's Edit): a leave or a detach could be consumed by the wrong one, or a stale detach answer the live pane. Instead of slots: when a fresh start finds the project's previous KiCad still there (previous_alive), the project's session is put in place at once as "starting" (HELD_REASON, a new generation, the attach's pane: held_session) and published. A warm-up, the pane's Edit or a re-attach then joins it through attach's starting branch, a leave or back is the ordinary leave() (holder check against its pane_cid), a detach the ordinary detach(); a message of the old session's generation is stale (#1435). Once the previous KiCad has ended (held_wait, HELD_WAIT 15 s) the one real start runs from the held session's fields (its pane, holder, `left`, `parked`); its waiters are finished when KiCad is ready. It never kills the previous KiCad (it may be finishing a save or asking): past HELD_WAIT the held session fails, "the KiCad before it is still closing (pid N, 15 s)…", with Try again. While held the pane says "KiCad is closing…" (waits_previous), never a start that looks hung. `Deferred`, AttachAfterGone and waited_gone are gone; the mode the start will run in is the held session's. Tests: a_start_held_for_the_previous_kicad_is_one_session_that_every_attach_joins, a_leave_or_a_detach_while_a_start_is_held_is_kept_by_its_session (with the stale generation), a_held_start_begins_once_the_previous_kicad_is_gone (a real process; nothing kills it); client: the held start's text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…n number, not the KiCad generation; an early return in a start answers its waiters 1. A leave re-sent after a reattach carried the old session's generation, so the hub answered it stale and the new KiCad counted as in the pane for good (the same across a held start's switch to the real one). Leave/back no longer take the generation rule: the holder check guards whose word it is, and the client numbers them (`seq`, one count for the whole client), which the hub keeps per project and client across sessions (leave_in_order): a re-sent leave applies, and a leave older than a later back never wins. 2. An early return in the real start (KiCad's program not found, the macOS refusal, Windows stock) left a held start's waiters unanswered: now they are answered and a final picture published. Tests: a_leave_resent_after_a_reattach_under_a_new_generation_applies, a_late_leave_never_marks_a_pane_left_that_is_back_on_screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
force-pushed
the
fix/1345-leave-idle
branch
from
November 21, 2026 06:15
c4fc48f to
ab39617
Compare
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
i2cjak
pushed a commit
that referenced
this pull request
Nov 21, 2026
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for the idle close and the cap (#1345) The client tells the hub when the pane leaves the screen because the person moved away (another thread or design, the viewer closed or on another page: `in_page` false for 300 ms) and when it is back (editor.kicad.leave {left, why, generation}). A sheet over the pane is not a leave. The leave is a plain send: no keyboard, no window, no call that waits on KiCad. Hub: `Session.left` counts as out of the pane for idle_victims and evict_warm (out_of_pane) unless a dialog of KiCad's is up; unsaved work stays exempt. Only the holder's leave counts (leave_counts), a stale generation changes nothing, a second leave never restarts the clock. A holder whose connection is gone for 15 s counts as left (holderGone). The idle clock is the last use: an agent's or a panel's request to that KiCad and a KiCad job running (ET_PROGRESS) are use (note_use), so a KiCad being used is not idle, left or not. The idle close's log line says why. The close path is unchanged. Closed as idle while away, the pane gives the viewer back. e2e: test/kicad_embed/embed_leave_idle_e2e.sh (L1-L5). Fixes #1345 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead; e2e L3 leaves by the Files page, pids of this run's copy only (#1345) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ain gives (#1345) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed 10 s ago kept, unused 301 s closed); e2e L6 (another thread of the same project showing the editor keeps it on screen, the leave comes when the last page showing it goes); the always-on leave log line says why Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lose, not the person's (Windows: KiCad closes its frames before it exits) (#1470 review) Carbon's Windows rows (17c112c): after the idle close KiCad sent ET_FRAME_CLOSED for both frames before it exited, and the viewer came back through PaneFrameClosed, which also put the project in kicad_closed (the person's close: no automatic attach after it). `closed_idle_away` (the stop first) is Linux's order. A frame closed while the pane is off screen (nobody could close it there) now gives the viewer back without the hold; both paths log kicad_idle_closed_away with "by" ("stopped" / "frames closed"), and the e2e says which it saw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… says so and attaches again once it has ended (#1470 finding 1) Carbon's Windows r1 (17c112c): after the idle close KiCad dropped its API but its process lived 2.5 min, and the next Edit attached to it. The same on Linux under load (run 8 here). Narrow, as decided: `attach` on a session that is `closing` (the hub's Close: idle, the cap, the person's, an agent's; or a runtime move) while it is ready or unresponsive answers `closing` and changes nothing (closing_not_reused; a restart's placeholder is joined as before). The pane then says "KiCad is closing. The editor opens again once it has closed." (gpui.c.kicad.closing, en/es/ja), maps nothing of the old KiCad, and attaches again once the hub's picture no longer has that process live, which starts a fresh KiCad. `retire` publishes the session (its `closing` in the info), and a pane off screen when its KiCad starts closing goes at once (closing_away), so coming back never shows a pane on a KiCad still ending. No kill, no bound, no change to how a close is recorded: the close-wait PR does those. Tests: an_attach_never_reuses_a_kicad_that_is_closing (hub), a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (client); e2e test/kicad_embed/embed_closing_attach_e2e.sh (C1, C2; the slow exit made by SIGSTOP at the idle close). embed_leave_idle L1 waits up to 30 s for the old process to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tarts a fresh one; an automatic pane goes (#1470, the KiCad lead's check) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…viction Close, and still clean, is ended as a hang (#1470, the KiCad lead's bound) On Windows (Carbon's main r2) a KiCad answered the hub's idle Close and never exited; with the closing guard an Edit then waited on it for ever. The existing 800 ms kill is not broken: it is only in close() (editor.kicad.close, the person's or an agent's), after Close answers; retire() (idle, evicted, appClosed) sends Close and nothing else. For the hub's idle and eviction closes only (a KiCad chosen clean: nothing unsaved, no dialog, in no pane), IDLE_CLOSE_BOUND (15 s; BACKPLANE_KICAD_IDLE_CLOSE_BOUND_S for tests) after the Close the same pid still running is checked again (bound_kill): still clean, it is killed and logged "a hang after its idle close: pid N still running M ms after the hub's Close, killed", and its exit ends the session as a clean one does (stopped, the idle reason kept), so the waiting Edit starts a fresh KiCad; unsaved or a dialog since, it is left and said. Every other close is unchanged (the close-wait PR's). Tests: a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean; e2e embed_closing_attach C2 now never lets the frozen KiCad go: ended at the bound (15000 ms, logged), a fresh KiCad on show. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; no answer starts the bound (#1470) Found writing the close-wait PR: retire() did not read Close's answer, so a Close KiCad refused (it became modified after it was chosen, or its task held it: CM_FAIL_IF_MODIFIED) left the session `closing` for good, and with closing_not_reused every later Edit would wait on a close that never came. Refused (an answer with a status: close_refused) clears `closing` and the stop reason and publishes; the bound counts from the answer. No answer at all (closed or timed out: a KiCad already going, or hung) is no refusal: the bound takes it. Test: a_refused_idle_close_ends_the_closing_but_no_answer_does_not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1. Two KiCads on one project: close() publishes the session stopped as Close answers and kills 800 ms later, and the fresh-start path started the next KiCad at once (the closing guard re-attaches the moment `stopped` is published). A session keeps its last pid when it stops (`last_pid`, cleared by the real exit); attach's start path waits for it to be gone (previous_alive, then gone_before_retry with restart's kill, Msg::AttachAfterGone), and never starts a second beside it. 2. The bound's "not killed" (not clean any more, a dialog, in use) cleared nothing: the session stayed ready+closing and every Edit was answered closing. It is live again now (Session::live_again, as a refused Close: also not chosen again at the next tick). The app-gone close has the bound too (its KiCads were chosen clean). 3. A waiting pane never saw a refusal: still_closing reads `closing` as well. 4. The bound could end a busy KiCad, and eviction could pick one mid-operation: `busy` (a named request in flight, in_flight; or a job, progress::has_jobs), read by note_use, keeps it from both. Also: a re-attach while the pane is off screen (a reconnect) says the leave again (LeaveState::resend). Tests: a_fresh_start_waits_for_the_projects_previous_kicad_to_be_gone (a real process as the previous KiCad), a_close_that_did_not_happen_leaves_the_kicad_live_and_not_closing, a_kicad_in_use_is_never_evicted_nor_ended_at_the_bound; client: a_pane_waits_on_a_closing_kicad_until_its_process_is_gone (refusal), a_pane_off_screen_is_told_to_the_hub_once_settled_and_back_at_once (resend). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n the previous KiCad is kept for it; busy has a quiet window; only the waited pid is forgotten 1. A leave behind a held attach (AttachAfterGone) reached a stopped session and was lost, so the new KiCad started with `left` empty while the pane had sent it (#1345 again on that path); a detach meanwhile had the same order. `Deferred` keeps them: a leave (or back) that comes for the project while its start is held is applied once the start has run; a detach cancels the held start. 2. `busy` was an instant: an agent's sequential calls have gaps. It is now others_busy(sock, BUSY_QUIET_MS = 10 s), for eviction and the bound. 3. AttachAfterGone forgets `last_pid` only when it is the pid waited on (Session::waited_gone). Also (review 6): RetryNow's "would not close" keeps the unkillable pid as `last_pid`, so the next start waits on it again. (Review 4, `live_again` wiping a person's closeAsked: not reachable here, the bound covers only the hub's own closes.) Tests: a_leave_or_a_detach_while_a_start_waits_on_the_previous_kicad_is_kept_for_it, a_held_start_clears_only_the_pid_it_waited_on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the session itself; every attach, leave and detach meanwhile takes the paths of a starting session (the KiCad lead's shape) The delta review of 7716fc2 found that `Deferred` kept one slot per project while several attaches could be held at once (a warm-up and the pane's Edit): a leave or a detach could be consumed by the wrong one, or a stale detach answer the live pane. Instead of slots: when a fresh start finds the project's previous KiCad still there (previous_alive), the project's session is put in place at once as "starting" (HELD_REASON, a new generation, the attach's pane: held_session) and published. A warm-up, the pane's Edit or a re-attach then joins it through attach's starting branch, a leave or back is the ordinary leave() (holder check against its pane_cid), a detach the ordinary detach(); a message of the old session's generation is stale (#1435). Once the previous KiCad has ended (held_wait, HELD_WAIT 15 s) the one real start runs from the held session's fields (its pane, holder, `left`, `parked`); its waiters are finished when KiCad is ready. It never kills the previous KiCad (it may be finishing a save or asking): past HELD_WAIT the held session fails, "the KiCad before it is still closing (pid N, 15 s)…", with Try again. While held the pane says "KiCad is closing…" (waits_previous), never a start that looks hung. `Deferred`, AttachAfterGone and waited_gone are gone; the mode the start will run in is the held session's. Tests: a_start_held_for_the_previous_kicad_is_one_session_that_every_attach_joins, a_leave_or_a_detach_while_a_start_is_held_is_kept_by_its_session (with the stale generation), a_held_start_begins_once_the_previous_kicad_is_gone (a real process; nothing kills it); client: the held start's text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n number, not the KiCad generation; an early return in a start answers its waiters 1. A leave re-sent after a reattach carried the old session's generation, so the hub answered it stale and the new KiCad counted as in the pane for good (the same across a held start's switch to the real one). Leave/back no longer take the generation rule: the holder check guards whose word it is, and the client numbers them (`seq`, one count for the whole client), which the hub keeps per project and client across sessions (leave_in_order): a re-sent leave applies, and a leave older than a later back never wins. 2. An early return in the real start (KiCad's program not found, the macOS refusal, Windows stock) left a held start's waiters unanswered: now they are answered and a final picture published. Tests: a_leave_resent_after_a_reattach_under_a_new_generation_applies, a_late_leave_never_marks_a_pane_left_that_is_back_on_screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he page takes no input and no focus
A hand-in pending after the person's Edit (want_keys) could complete off the page: an agent's viewer_show switching the page while
KiCad was still starting, or a switch inside EDIT_KEY_GRACE_MS, and the frame's arrival focused the editor off screen (nc::focus;
yield_to + ShowFrame{focus} on macOS), set `keys`, grabbed Escape and touched the left KiCad's idle clock. The hand-in is now gated on
the page and the pane's rect (hand_in_on_page), and set_in_page(false) drops a waiting hand-in (hand_in_after_leave).
Test: a_hand_in_pending_across_a_leave_never_focuses_an_editor_off_screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' hand-in repost are gated on the page too (a pane off the page takes no focus) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1345. This is the KiCad lead's PR C.
Cause.
idle_victimsandevict_warmtreated a KiCad as "in no pane" only aftereditor.kicad.detach(container == 0 || parked). A thread switch keeps the pane entity and only flipsKicadPane.in_page, and sent nothing. So a KiCad left that way was never idle-closed and never evicted.Change
Client:
ui.rs: when the pane'sin_pagechanges, it callsKicadPane::set_in_page(in_page, why).whyis"thread"for a thread other than the one where the pane was last on screen, the same project's included. It is"viewer"when the same thread's viewer was closed or moved to another page.in_page, so it is not a leave.LeaveState(pure, tested):LEAVE_SETTLE), and only once;editor.kicad.leave {project, left, why, generation}. It is a plaintry_send: no keyboard, no window call, nothing that waits on KiCad's UI thread (Windows: KiCad windows' placements run off Backplane's UI thread, so a tab switch during KiCad's DRC no longer freezes Backplane (#1343) #1401/Windows: 243 ms SetFocus on the UI thread during a cold KiCad construction (follow-up to #1343) #1403).kicad_info: if KiCad is closed as idle while the pane is off screen (closed_idle_away), the pane goes as a View does. Coming back shows Backplane's viewer, not a dead pane.kicad_attachis only driven by scripts), so the viewer is what the person gets.closedByPerson) keeps its own path.Hub (
kicad/embed.rs):Session.left(the reason; empty while on screen).out_of_panemeans detached, or parked, or left with no dialog of KiCad's up. It feeds bothidle_victimsandevict_warm. Unsaved work stays exempt, as before.leave_counts: the caller's cid must be the pane'spane_cid). A leave from any other connection is answered and changes nothing.staleand changes nothing (kicad pane + hub: an automatic attach carries its session's generation; the person's close holds it off (default flip, PR B) #1435's rule, extended toeditor.kicad.leave).Session::leave, tested).left.HOLDER_GONE_S: a crash or the network), the KiCad counts as left (holderGone). It does not stay held in a pane nobody shows.note_use, run each tick and before the cap picks a victim).touched_atis now the last use:gui_call_inclient, at its start and end);ET_PROGRESS: DRC, zone fill, plot;progress::has_jobs);idle, closing … (left the pane: thread, unused for 300 s).retireand the close path are unchanged; only eligibility changed.BACKPLANE_KICAD_IDLE_Stest variable changes it.editor.kicad.leaveis added toMETHODS. No generated catalogs or bindings list theeditor.kicad.*methods.Use is not idle, for every KiCad (a finding). Before this PR nothing an agent or a panel sent to an open KiCad, and no KiCad job (DRC, zone fill, plot), counted as use:
touched_atmoved only on attach, show, warm-Have, detach and park, so a detached KiCad an agent was working in could be idle-closed under it.note_usemakes those count for every live session, detached and parked included, not only left ones: a detached KiCad an agent keeps calling never idles out. That is intended.leftis not inviewer.runtime.leave()does not publish the session and nothing on the client readsleft. Carrying it (say, for the right-rail tiles to show a KiCad as "left, warm") would need a publish on each leave and back; that is a small follow-up if the tiles want it, not part of this PR.Same project, two threads. A second thread of the same project whose viewer is on a design page shows the editor too: the KiCad is on screen there, so no leave is sent, as intended. The leave comes when the last page showing it goes (e2e L6).
The always-on
kicad_leavelog line (the pane's others are behindBACKPLANE_KICAD_DEBUG): at most one line per leave and one per back, and it is what the e2e counts; the code says so.Functions touched
ui.rs: thein_pageblock in render.kicad_pane.rs: newset_in_page,send_leave,LeaveState,closed_idle_away; a few lines inkicad_info.embed.rs:Session(new/detached/ended/leave),out_of_pane,leave_counts,last_use,idle_victims,evict_warm,attach(clearsleft),detach(clearsleft), newleave/note_use/note_holders, the Tick,METHODS, the RPC dispatch.progress.rs:has_jobs.KicadPane::detach,show_settledandnative_child.rsare untouched.Tests
a_kicad_left_by_a_thread_switch_closes_as_idle_but_not_with_a_dialog_or_unsaved_workonly_the_holders_leave_countsa_kicad_in_use_is_not_idle_left_or_notthe_cap_evicts_the_left_kicad_used_longest_ago_never_one_with_a_dialog_or_unsaved_worka_pane_off_screen_is_told_to_the_hub_once_settled_and_back_at_oncea_kicad_closed_as_idle_while_away_gives_the_viewer_backcargo test --all-targetsinnative/hostwith its ownCARGO_TARGET_DIR: 4037 passed, 1 failed.kicad::install::tests::a_stopped_download_is_kept_said_and_continued: a curl download fixture, untouched here. It passed 3 of 3 alone.cargo test --bin backplane-gpui: 867 passed.scripts/windows-check.sh all(hub and client,x86_64-pc-windows-gnu): clean.cargo check --release --features cefofnative/gpuiundermac-heavyfinished clean. Built in one folder,~/bp-1345, deleted afterwards.scripts/mac-build.shdoes not copynative/winres.rsor the hub files the client includes (host/src/{mouse,scopeprobe,bots/cat}.rs); I copied them by hand. That gap is on main, not in this PR.Linux e2e (
test/kicad_embed/embed_leave_idle_e2e.sh, fork, bp.13.1,BACKPLANE_KICAD_IDLE_S=20): single runs on the desktop underkicad-embed-e2e, load checked.left the pane: threadL4 and L3 are guards: main keeps those KiCads too.
L4's "a job in progress at the idle time" is covered by the
last_useunit test, not the e2e: a DRC on the seed board ends in about 0.2 s, too quickly to stage at the tick.Windows (Carbon, bp-win under
bp-win-ui) and macOS (Lane M) rows are to be scheduled by the Integrator on the head SHA.🤖 Generated with Claude Code
Head 9e3f5eb (rebased on main a44963a, after the bp.13.3 pin). Changes from 17c112c:
on_the_default_idle_time_a_kicad_used_10_s_ago_is_kept_and_one_unused_301_s_is_closed).PaneFrameClosed, which also set the person-closed hold. A frame closed while the pane is off screen is now taken as the idle close, with no hold. Both paths logkicad_idle_closed_awaywithby("stopped" on Linux, "frames closed" on Windows).Checks on 9e3f5eb:
cargo test --all-targets(own target dir): 4051 passed, 0 failed (bin), and every other target passed.windows-check.sh all: clean.kicad-embed-e2e): 9/9 passed, L1–L6 included; L5 by "stopped".Not changed here: on Windows, a KiCad slow to exit after the hub's Close stays "ready" until its process ends, and an Edit in between attaches to it.
attachdoes not look atclosing. That is on main already (any Close, idle or the person's, followed by Edit before exit), and it is the close path, which this PR leaves alone.Head 7e54879 (rebased on main ef145cd): an attach never reuses a KiCad that is closing (finding 1, the Lead's narrow form).
attachon a session that isclosingwhile "ready" or "unresponsive" answersclosingand changes nothing (closing_not_reused). That covers the hub's Close (idle, the cap, the person's, an agent's) and a runtime move. A restart's placeholder is joined as before.gpui.c.kicad.closing, en/es/ja). It maps nothing of the old KiCad, and attaches again once the picture no longer has that process live, which starts a fresh KiCad.retirenow publishesclosing, and a pane that is off screen when its KiCad starts closing goes at once (closing_away). Coming back shows the viewer, never a pane on a KiCad still ending.editor.kicad.close, the app quitting) is unchanged: if that KiCad doesn't exit, the pane says "KiCad is closing" until the old KiCad exits, which on Windows it sometimes doesn't, until the close-wait PR's hang kill. Nothing in the pane reaches it meanwhile.editor.kicad.restartwould (it ends the old pid), but only the runtime update uses it today.an_attach_never_reuses_a_kicad_that_is_closing(ready or unresponsive after our Close: not reused; stopped: a fresh start; a restart's placeholder: joined);a_pane_waits_on_a_closing_kicad_until_its_process_is_gone;test/kicad_embed/embed_closing_attach_e2e.sh. The slow exit is made with SIGSTOP at the idle close. C1: the Edit is answered closing, the pane says so, no second KiCad. C2: once the old KiCad ends, the pane attaches again and a fresh pid is on show. On main's build C1 and C2 fail; on this head both pass.Checks on 7e54879:
cargo test --all-targets: 4052 passed, 0 failed (bin), and every other target passed.i18n-check: ok.windows-check.sh all: clean.Head d5582bb: a bound on the hub's own idle and eviction closes (the KiCad lead's condition).
close()(editor.kicad.close, the person's or an agent's Close), after Close answers.retire()(idle, evicted, appClosed) sends Close and nothing else, so the idle path never had a kill.idleandevictedonly,IDLE_CLOSE_BOUND(15 s) after the hub's Close, the same pid still running is checked again (bound_kill).waits_on_close), so nothing starts a KiCad by itself after a close.a_kicad_still_running_at_the_bound_after_an_idle_close_is_ended_only_while_still_clean(clean: killed; unresponsive: killed; a dialog, or unsaved work: left; any other close: left; the exit afterwards gives stopped with the idle reason);embed_closing_attach_e2e.sh, where the frozen KiCad is never let go: C1 answered closing, the pane says so; C2 killed at 15000 ms and logged, a fresh KiCad on show (5/5);embed_leave_idlerun 11: 9/9.cargo test --all-targets: 4053 passed, 0 failed, and every other target passed;i18n-check: ok;windows-check.sh all: clean.Head 6a053a3 (rebased on main 02d4611; two conflicts in
kicad_pane.rswith main's macOS 15 press change, both sides kept).retire()now reads Close's answer. KiCad refusing it (an answer with a status: it became modified after it was chosen, or its task held it) clearsclosing. Before, every later Edit would have waited on a close that never came. No answer at all (a KiCad already going, or hung) is not a refusal, and the bound takes it. Test:a_refused_idle_close_ends_the_closing_but_no_answer_does_not.cargo test --all-targets(own target dir): rc 0. 4057 passed, 0 failed (bin); every other target passed too.windows-check.sh all: rc 0.embed_closing_attach: 5/5.embed_leave_idle: 9/9.Head 7708a5d: the cross-model review's findings (Fable), as the KiCad lead confirmed. Rebased on main.
close()publishes the session stopped as soon as Close answers and kills 800 ms later, and the fresh-start path started the next KiCad at once.last_pid, cleared by the real exit). The start path waits for that process to be gone (previous_alive, thengone_before_retrywith restart's kill,Msg::AttachAfterGone) and never starts a second KiCad beside it. That also closes the window on main.a_fresh_start_waits_for_the_projects_previous_kicad_to_be_gone, with a real process as the previous KiCad.closingfor ever. A KiCad that is no longer clean, has a dialog up, or is in use is now live again (Session::live_again, as for a refused Close), and isn't chosen again at the next tick. The app-gone close has the bound too.a_close_that_did_not_happen_leaves_the_kicad_live_and_not_closing.still_closingnow readsclosingtoo.a_pane_waits_on_a_closing_kicad_until_its_process_is_gone.busy(a named request in flight, or a KiCad job) keeps a KiCad from both the bound's kill and eviction.a_kicad_in_use_is_never_evicted_nor_ended_at_the_bound.LeaveState::resend, tested).cargo test --all-targets: rc 0. 4060 passed, 0 failed (bin); every other target passed.windows-check.sh all: rc 0. The first try failed with "can't find crate for core" for windows-gnu while the toolchain was being updated under it; the rerun was clean.Head 7716fc2: the delta review's three points (rebased on main de9296b; the struct's field line in
kicad_pane.rsconflicted again, main's kept plus this PR's fields).Deferredkeeps it: a leave (or back) is applied once the held start has run, and a detach cancels the held start.a_leave_or_a_detach_while_a_start_waits_on_the_previous_kicad_is_kept_for_it.busyhas a quiet window. It is nowothers_busy(sock, BUSY_QUIET_MS = 10 s), for eviction and the bound, because an agent's calls come one after another with gaps.AttachAfterGoneforgetslast_pidonly when it is the pid it waited on (Session::waited_gone).a_held_start_clears_only_the_pid_it_waited_on.last_pid, so the next start waits on it again.live_againwiping a person'scloseAsked): not reachable in this PR, because the bound covers only the hub's own closes. Close-wait keeps the person's close reason.cargo test --all-targets: 4062 passed, 0 failed (bin); every other target passed.windows-check.sh all: both finished clean.Head 3a961b3: a start that waits on the project's previous KiCad is held as the session itself (the KiCad lead's shape, replacing
Deferred). Rebased on main e3e2544.previous_alive), the session is put in place at once as "starting" (HELD_REASON, a new generation, the attach's pane:held_session) and published. Everything after it takes the paths that already exist for a starting session:leave(), with its holder check;detach();held_wait), the one real start runs from the held session's fields: its pane, holder,leftandparked. Its waiters are finished when KiCad is ready.HELD_WAIT(15 s) the held session fails with "the KiCad before it is still closing (pid N, 15 s): it was not ended, as it may be saving or asking; try again once it has closed".waits_previous). It ends one of two ways: KiCad starts and shows in the pane, or the pane says "KiCad could not start: the KiCad before it is still closing…" with Try again.a_start_held_for_the_previous_kicad_is_one_session_that_every_attach_joinsa_leave_or_a_detach_while_a_start_is_held_is_kept_by_its_session(includes the stale generation)a_held_start_begins_once_the_previous_kicad_is_gone(a real process; nothing kills it)cargo test --all-targets: 4067 passed, 0 failed (bin); every other target passed.windows-check.sh: the hub's test target fails to compile atsettings/fab.rs:528(E0034,custom_flagsambiguous). That line comes from main's e3e2544; this PR doesn't touch the file.Head f7f9e00: the adversarial review's blocker, plus unanswered waiters.
seq, one count for the whole client), and the hub keeps the numbers per project and client across sessions (leave_in_order): a re-sent leave applies, and a leave older than a later back never wins.a_leave_resent_after_a_reattach_under_a_new_generation_applies,a_late_leave_never_marks_a_pane_left_that_is_back_on_screen.last_pidacross a generation move (a reused pid's 15 s hold);cargo test --all-targets: 4069 passed, 0 failed (bin); every other target passed.windows-check: still blocked by main'ssettings/fab.rs:528(E0034, from e3e2544). This PR doesn't touch that file.