Repository navigation
fix(bin): make the ps-fallback watcher identity immune to terminal width - #5517
Conversation
fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799
… cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
|
Speaking as Kun's firstmate: Contract-class: VISION.md (each rule)
aligns when / resist when: Aligns — strengthens a refusal/continuity path. Sibling Closes check: Author Fixes #799 verified against issue body (narrow-COLUMNS truncation → continuity deadlock) and tip diff. Issue labeled ready-for-pr. CI/NM: all SUCCESS. Attestation MATCH on HEAD |
|
Speaking as Kun's firstmate: this is merged. Thank you @karotkriss — really appreciate you taking the time on this. |
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
…dth (kunchenguid#5517) * fix(bin): keep the ps fallback identity independent of terminal width fm_pid_identity's portable fallback read the command column at the ambient COLUMNS width, so an identity recorded from a wide shell never matched the one recomputed inside a narrow hook and the continuity guard denied every fleet command. Pass -ww so the column is never cut. Fixes kunchenguid#799 * no-mistakes(ci): Fixed CI failure in Behavior portable serial 4. Root cause: the -ww flag added in commit ac7ab5d to fm_pid_identity (bin/fm-wake-lib.sh) shifted the ps argv so $1 became -ww instead of -p, breaking the positional fake-ps fixtures in tests/fm-procevent.test.sh (lines 2736, 3571) which then fell through to real ps and failed the fm-procevent test. Fix (already applied in the worktree, matching the authoritative user instruction exactly): replaced -ww with a COLUMNS=10000 environment pin so the call is COLUMNS=10000 LC_ALL=C ps -p "$pid" -o lstart= -o command=, mirroring fm_pending_reply_pid_identity in bin/fm-pending-reply-lib.sh:982. argv is back to -p PID -o lstart= -o command=, so the fixtures match again with no fixture edits. Comments above the call in bin/fm-wake-lib.sh and in test_pid_identity_is_terminal_width_invariant (tests/fm-watcher-lock.test.sh) now describe the COLUMNS pin instead of -ww; the regression test still asserts narrow-vs-wide byte equality and the full command. Verified: the terminal-width-invariant regression test passes. The only local not-ok results were flaky, run-varying timing tests (procevent launch/claim confirmation, listener reparenting) that differ each run and are unrelated to the ps argv change
Intent
Fixes #799
On hosts without a readable
/proc, the watcher identity is computed fromps -p <pid> -o lstart= -o command=, and when that runs inside a hook with a narrowCOLUMNSthe command column is truncated, so the recorded identity never matches the live one and the continuity guard denies every fleet command until the captain intervenes.Make the identity immune to terminal width so a narrow hook context yields the same identity as a wide shell.
This closes upstream issue #799.
What Changed
-wwto theps -p <pid> -o lstart= -o command=fallback infm_pid_identity, so the command column is never cut to the ambient terminal width; an identity written from a wide shell now matches the one re-read inside a narrow-COLUMNShook (issue Watcher-continuity deadlock: fm_pid_identity ps command truncated in narrow-COLUMNS hook context #799).test_pid_identity_is_terminal_width_invariant, which asserts the fallback returns a byte-identical identity carrying the full command underCOLUMNS=20andCOLUMNS=1000, and registers it in the test runner.Risk Assessment
✅ Low: A one-flag (-ww) fix at the shared identity helper directly satisfies the stated intent, is portable across the targeted ps variants, keeps write/read identities consistent for every caller, and is covered by a proper behavioral regression test.
Testing
I exercised the real
fm_pid_identityfunction through its portable ps fallback (with /proc forced absent) at both narrow and wide COLUMNS. At the target commit the two readings are byte-identical and carry the whole command; against an un-fixed copy of the lib the narrow reading truncates tosleep 300.00000while the wide reading is complete, reproducing the mismatch that makes the continuity guard deny fleet commands (issue #799). The added regression test drives this same path and passes. No screenshot applies — this is a shell/process-identity change with no UI surface. Worktree left clean; temp files removed.bash tests/fm-watcher-lock.test.sh-> 'ok - fm_pid_identity ps fallback is terminal-width-invariant'Evidence: Raw ps truncation vs -ww (narrow COLUMNS=20)
Evidence: fm_pid_identity fixed: narrow == wide
Evidence: fm_pid_identity un-fixed: mismatch (regression reproduced)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-watcher-lock.test.sh-> 'ok - fm_pid_identity ps fallback is terminal-width-invariant'LC_ALL=C COLUMNS=20/1000 ps [-ww] -p <pid> -o lstart= -o command=— showed raw ps truncates the command column at COLUMNS=20 without -ww and returns the full command with -wwDrove the realfm_pid_identityviaFM_PROC_ROOT_OVERRIDE=<absent> bash -c '. fm-wake-lib.sh; fm_pid_identity <pid>'under COLUMNS=20 and COLUMNS=1000 — identities byte-identical (invariant) at target commitSame drive against an un-fixed copy of the lib (-wwremoved) — narrow yieldedsleep 300.00000, wide yielded the full command: MISMATCH, reproducing the guard-denial regressionbash tests/fm-watcher-lock.test.sh— added regression testfm_pid_identity ps fallback is terminal-width-invariantpasses✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.