chore(memory): mods tty hang journal, LRN
This commit is contained in:
1 parent
87b3530b29
commit
adc0dff72d
3 files changed
+29
No files matched your search
@@ -755,3 +755,4 @@ rules:
|
||||
- /bugfix perl-timeout-group: perl fallback runner leads own process group, kills group at deadline, TERMs leftovers (490ad83); challenge r1 FATAL (digest assertion impossible without tty, single quotes = SC2016, timeout(1) misread) → r3; verifier CONFORME (flip red), security PASS. Phase 4b-4d closed: digest-after-compaction proven by this run's auto-compact. Residue TODO: design-tool-gate.sh:70 same idiom.
|
||||
- BDR-125 close-out J: /reconcile clean (BLK-017 + 3 upstream), CHANGELOG BDR-125 delivered + gate 1 57 % + H6a + BLK-049 (69eb53f), D4 BUGS-FOUND items closed with reason, block I + phase 4b-4d TODO closed, EVAL-059 capitalized; close ritual: nothing new (LRN-289/290 already). User leftovers: E3 npm -g hand edit, faunosteo merge, LRN-270 bisect, W4-B AC9, game status words, cc oom proof.
|
||||
- E3 npm -g deny rows removed by user (692e4a5, merged 98e1800); my step list sent user to a 69-commit-stale branch, rebased by stash+ff. mods.test.sh hangs in a tty: claude CLI under timeout = background pgrp, SIGTTOU stops whole group incl. timeout → hotfix next.
|
||||
- /hotfix mods-test-tty-hang: bounded() runs CLI with </dev/null (commit above); pty repro before T-state hang, after 52 s pass; security PASS; doc sync skipped (test-only, no doc names bounded).
|
||||
@@ -2103,3 +2103,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Pattern**: `perl -e 'alarm N; exec cmd'` bounds ONE process: `$(cmd)` waits for EOF on the pipe, so any child holding stdout/stderr outlives the bound. timeout(1) (GNU, uutils) default = new process group, signals whole group (only `--foreground` leaves children). Portable bounded runner: perl `setpgrp(0,0)` on ITSELF before fork (child born in group, no race), ALRM → `kill KILL, -$$`, after waitpid ignore TERM + `kill TERM, -$$` for leftovers, child `alarm(t+1)` backstop survives exec. Keep the program double-quoted with `\$` (single quotes = SC2016).
|
||||
- **Context**: /bugfix perl-timeout-group 2026-11-14 (490ad83), hooks/session-start.sh stock-macOS fallback. Timing-only tests pass on a runner that fails fast: also assert the command's output arrived.
|
||||
- **Apply**: any alarm/exec timeout wrapper around a captured command; lib/design-tool-gate.sh:70 has the same limit (TODO).
|
||||
|
||||
## LRN-291 — CLI under timeout in a terminal: SIGTTOU stops the group, timeout included (2026-11-14)
|
||||
- **Pattern**: `timeout N cmd` (no --foreground) puts cmd in own process group = background of the tty. Interactive CLI (claude, anything Ink/readline) inheriting tty stdin sets terminal modes → SIGTTOU to whole group → cmd AND timeout stopped (state T), alarm never fires, hang forever. Only in a terminal; non-tty runs (Claude sessions, CI) pass, so tests stay green while user's `make test` hangs.
|
||||
- **Context**: lib/tests/mods.test.sh `bounded()` around `claude plugin validate --strict`, user report 2026-11-14 (4h30 in T). Reproduced under util-linux `script -qec` pty: before T from 2 s, after 52 s pass.
|
||||
- **Apply**: any CLI under timeout/perl group runner in tests or hooks → `</dev/null` (and capture stdout/stderr). Prove tty behaviour with `script -qec '<cmd>' /dev/null`, not only headless runs.
|
||||
@@ -0,0 +1,23 @@
|
||||
# CONTRACT — mods-test-tty-hang
|
||||
- date: 2026-11-14 | flow: hotfix | branch: bugfix/mods-test-tty-hang (off develop)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
lib/tests/mods.test.sh hangs forever when `make test` runs from an interactive terminal (user report 2026-11-14, stuck after "model-routing census: 141 pass" at "== lib/tests/mods.test.sh"; ps: `timeout 120 claude plugin validate --strict /tmp/…/cleanfix` and the claude child both in state T for 4h30). Root cause: timeout(1) without --foreground puts the command in its own (background) process group; the claude CLI inherits the tty on stdin and touches it, SIGTTOU stops the whole group including timeout, whose alarm then never fires. Non-tty runs (Claude sessions) are unaffected. Fix: `bounded()` (lib/tests/mods.test.sh:20-33) runs the command with stdin from /dev/null in both branches (timeout line :23 and the background fallback :26). 1 file.
|
||||
|
||||
## CLARIFICATIONS
|
||||
- [gated 2026-11-14] challenge skipped (stdin redirect, no control-flow change). Proof = pty reproduction with util-linux `script` before/after.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Both branches of bounded() read stdin from /dev/null.
|
||||
CHECK: cd /home/bchanot/Documents/claude && sed -n '/^bounded()/,/^}/p' lib/tests/mods.test.sh | grep -c '</dev/null'
|
||||
EXPECT: 2
|
||||
EVIDENCE: MET exit=0 marker-found :: 2
|
||||
2. shellcheck clean.
|
||||
CHECK: cd /home/bchanot/Documents/claude && shellcheck -x lib/tests/mods.test.sh && echo SC-OK
|
||||
EXPECT: SC-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: SC-OK
|
||||
3. Under a pty (`script`), the mods suite finishes (before the fix it stops in state T); make test green (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
lib/tests/mods.test.sh (bounded, :20-33).
|
||||
Reference in new issue
Block a user