Skip to content

fix(zellij): find headless clients by process, retry failed listings (RIG-6930) - #100

Merged
mattwilkinsonn merged 4 commits into
rigel-releasefrom
harness/rig-6930-headless-adopt
Oct 30, 2026
Merged

mattwilkinsonn merged 4 commits into
rigel-releasefrom
harness/rig-6930-headless-adopt

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 30, 2026 •

Copy link
Copy Markdown

Review follow-up to #99. The handoff kept its headless client in a per-process map, so a survivor of an earlier manager was never stopped, and it detached on a raw client count of two, which another headless client or a leaving client could satisfy. A transient list-clients error also failed every unbounded caller at once.

Find headless clients from /proc by their attach command, as process-group leaders. Keep one only while no other client is attached, stop the rest, and re-check the listing after stopping so a client that left meanwhile gets a replacement. Retry a failed listing within the existing attach budget.

Test: package.smoke.ts adds a flaky-listing cell, a client leaving during handoff, and two survivors from earlier managers. The fake client forks a descendant, so a wrapper-only kill fails. The three new cells fail on the #99 driver. A live throwaway-session smoke shows the headless client exits after a real client attaches.

Refs RIG-6930
Spec-impact: none
Co-authored-by: Matt Wilkinson matt@rigel.build

Approved-at: 87521eb

…(RIG-6930)

Review follow-up to #99. The handoff kept its headless client in a per-process map, so a survivor of an earlier manager was never stopped, and it detached on a raw client count of two, which another headless client or a leaving client could satisfy. A transient list-clients error also failed every unbounded caller at once.

Find headless clients from /proc by their attach command, as process-group leaders. Keep one only while no other client is attached, stop the rest, and re-check the listing after stopping so a client that left meanwhile gets a replacement. Retry a failed listing within the existing attach budget.

Test: package.smoke.ts adds a flaky-listing cell, a client leaving during handoff, and two survivors from earlier managers. The fake client forks a descendant, so a wrapper-only kill fails. The three new cells fail on the #99 driver. A live throwaway-session smoke shows the headless client exits after a real client attaches.

Refs RIG-6930
Spec-impact: none
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

RIG-6930

rigel-mintaka and others added 3 commits October 30, 2026 15:31
…ed clients (RIG-6930)

Review of #100:
- high: without /proc no client was ever stopped. Fall back to the groups this process started.
- medium: a kept headless client that had not connected was joined by a second one. Keep one only while it is the sole attached client; otherwise stop it and start one. An unknown listing after stopping is retried, never read as zero.
- medium: a scanned PID was killed as a bare number. Match the exact script argv, our UID and group leadership, and re-check just before each kill.
- low: skip the /proc scan when exactly one client is attached, the steady state.

Test: a new cell for an unattached survivor fails on the previous head. The /proc cells skip explicitly where /proc is absent. 43 checks pass; a live throwaway-session smoke shows a clean handoff.

Refs RIG-6930
Spec-impact: none
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…IG-6930)

Review medium on #100: with one listed client, ensureClient skips the scan, so a survivor beside a real client is not stopped at once. list-clients cannot say which client is real, and stopping the group could remove the only client. An unconnected survivor holds no client state in the zellij server. Once it attaches, the listing shows two clients against one group, and the next call stops it. At most one such group lingers, and only until it attaches.

The new cell checks that: kept while unattached, stopped after it attaches, and no client started. 44 checks pass.

Refs RIG-6930
Spec-impact: none
Co-authored-by: Matt Wilkinson <matt@rigel.build>
Matt accepted option A on RIG-6941: an unattached headless survivor beside one real client stays until it attaches or the manager restarts, since list-clients has no process identity. Records that limit at the scan skip.

Refs RIG-6941, RIG-6930
Spec-impact: none
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka

Copy link
Copy Markdown
Author

Review note at 87521eb (base rigel-release a5451b8): three review rounds; no open high or medium. Findings fixed: transient list-clients retry, keep-one handoff with post-stop re-check, survivors of earlier managers found from /proc with argv, group-leader and UID checks before each kill, own-group fallback without /proc, scan skipped at one client. The remaining medium (an unattached survivor beside one real client) is accepted by Matt as option A on RIG-6941 and documented in the driver. 44 zellij package checks pass; the new cells fail on the previous heads; a live throwaway-session smoke shows a clean handoff.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 30, 2026 20:43
@mattwilkinsonn
mattwilkinsonn merged commit 5484041 into rigel-release Oct 30, 2026
21 of 28 checks passed
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.

2 participants