A hung engine child that stops reading stdin fills the 64 KB pipe; ACPEngineClient's synchronous fileHandleForWriting.write ran on the client's ONE serial state queue — the same queue carrying request-id allocation, pending-registration, the asyncAfter request deadline, and close()'s opening queue.sync barrier. A blocked writer therefore defeated:
the request timeout — the deadline sat queued behind the stuck send and never fired (ACPEngineClient.swift base bb4bfa26: L177 queue.async { self.send(raw) }, L180 queue.asyncAfter(deadline:));
Stop/lifecycle — a follow-up request starved at id-allocation/registration queue.sync (base L154, L168), session/cancel queued behind the write (base L197);
teardown — close() began with queue.sync (base L203) behind the stuck writer, so SIGTERM/SIGKILL were never reachable, and EngineHost's close callers (killChat, withOneShot defer, shutdownAll) run on MainActor — an app-wide unbounded hang on restart/quit (availability, APP-DOWN class; argus cycle-4, severity high, executed standalone repro: 2M-char request at 0.1 s timeout over an inert /bin/sleep child — no completion, watchdog close() never returned, probe killed at 12 s).
Unticketed by design — no issue exists, the slug is the key.
Fix
Stdin writes — and the stdin write-handle's own close — move off the state queue onto a dedicated serial writerQueue (Museion/ACPEngineClient.swift +42/−8, the only production file touched):
send(_:) frames and writes on writerQueue; request, notify, and dispatch's server-reply (-32601) all funnel through it — wire order preserved (one serial FIFO, same enqueue-order semantics).
The state queue is now I/O-free: id allocation, registration, deadlines, and close()'s bookkeeping barrier always run; close() does SIGTERM → 1 s grace → SIGKILL → reap without ever queueing behind the writer.
The stdin WRITE handle closes ON the writer queue after kill+reap — a blocked write may still be in write(2) (unblocks with EPIPE once the child's read end died, which the kill arranged); closing under a live write would race Foundation. Reader handles close on the caller as before (handlers off first, no writers exist for them).
Blocking writes kept (boring over clever): a blocked writer now wedges only itself.
Verification (review seat, independent re-runs — clone ~/athena-reviews/museion/, base re-pinned live: trunk main = bb4bfa26 unchanged at review, merge-base = base, so the branch is unintegrated and diffed against exactly bb4bfa26)
RED at 33b7fe0 (base tree + regression tests), focused serialized EngineSmokeTests via the full-test.sh rail, run dir 20261117T231035Z-Museion-serialized: 6 executed / 3 passed / 3 failed (xcodebuild exit 65) — exactly the three blocked-writer smokes, each on mechanism: deadline did not fire … still blocked after 5 s; bookkeeping starved behind the blocked writer; close did not return within 5 s. 98 SwiftCompile lines (no stale binary). Matches the implementer's RED run.
Fix at 89cd377, same focused rail, run dir 20261117T231251Z-Museion-serialized: 6 executed / 6 passed / 0 failed / 0 skipped, exit 0 — all four new smokes started/passed (deadline 0.534 s, stop/bookkeeping 0.739 s, close-bounded 0.232 s, healthy 0.189 s).
Full suite at head ae3b99c, serialized rail, run dir 20261117T231415Z-Museion-serialized: 697 executed / 697 passed / 0 failed / 0 skipped, xcodebuild exit 0 — matches the implementer's 697/697 (the head's docs commit verified docs-only against its parent: CHANGELOG + devlog + INDEX, zero code files).
Lint at head: swiftformat --lint: 0/149 files require formatting (exit 0); swiftlint: 0 violations, 0 serious in 138 files (exit 0) — the gate is zero and the base was clean.
GitNexus at head (fresh index, review clone): detect-changes vs base → 8 production symbols in ACPEngineClient.swift (writerQueue, pending, framed, ACPEngineClient, request, notify, close, send) + test rig; affected flows: Start→Send, MakeScriptedRig→ACPEngineClient. Impact: sendLOW (5 impacted, 3 direct, 1 process) — matches the implementer; dispatch LOW (2, 1 direct). Divergence disclosed: on this fresh index notify/close/request label HIGH (149 impacted at depth 2) where the implementer's worktree index reported LOW(0)/LOW(0)/UNKNOWN(0) — the count is transitive fan-out through the EngineTransport seam with direct = 1 and processes_affected = 0 on all three, i.e. graph closure state, not a defect signal: every direct caller is either in the same file and updated by this diff, or pinned green by the full suite and the healthy-contract smoke. Advisory tool only; no action.
Owner-apply patchgit apply --check at branch head ae3b99c: exit 0 (direct application clean; patch touches exactly Museion/AGENTS.md +1 line, MuseionTests/AGENTS.md +1 line — the consent-gated DOX updates).
Mergeability: git merge-tree --write-tree vs origin/main@bb4bfa26 → clean, exit 0. Coupling with open PR #198 (ffb9457, sole shared file docs/devlog/INDEX.md): merge-tree vs ffb9457 also clean, exit 0, and the merged tree retains BOTH ledger rows (80 rows = 79+1 each side; verified by reading the merged blob) — whichever merges first, the other lands clean.
Rig discipline
The only child ever spawned by the new tests is the zsh fake: neverRead mode execs /bin/sleep 30 without reading one line (exec = sleep is the DIRECT child, so close's SIGTERM reaches it and no orphan holds the pipe); serverPing mode is full behaviour plus one server→client request (id 900) at initialize, logging our reply to <name>-reply-log. No real Hermes profile is anywhere near the dead-child smokes.
Implementer disclosures (verbatim, 4)
First focused RED run died at COMPILE (my Task<String?, Never> made awaitBounded's T? a double optional — two error: lines, zero tests executed, the rail's vacuous guard caught it as 0-executed/exit 65). Fixed to Task<String, Never>; the recorded RED run is the second, clean one.
No testmanagerd wedge encountered this brief (the known hazard did not fire; runs sequenced behind @athena's classis brief-26 verify, which finished 22:21:15 exit 0 before my first xcodebuild).
AGENTS.md DOX updates (Museion/AGENTS.md ACP-bridge bullets, MuseionTests/AGENTS.md suite-map lines) are consent-gated → owner-apply patch beside the handoff, git apply --check clean vs branch head; the root AGENTS.md session-log 10-row window is left for the write-log tooling (INDEX.md carries the durable row).
Docs commit (CHANGELOG + devlog + INDEX) is docs-only; the 697/697 suite ran at its parent (the fix commit) — code identical.
Owner apply line for Alexander at merge time: git apply ~/daedalus-builds/museion/brief-27-agents-md-owner-apply.patch (moment-scoped to ae3b99c; if main rewrites those doc lines before you apply, request a regen).
Scope (pre-committed criteria: same defect class / file already in footprint / mechanical zero-new-logic)
In-scope: all four send call sites (request, notify, dispatch server-reply — the seeded set; the reply path rides the same send, no second site), the deadline scheduling, both request-path queue.syncs, and close()'s barrier — one writer-queue separation heals all; nothing beyond.
Disproved with evidence (reviewer re-checked each in-source): EngineGate.execute pre-spawn write lands before process.run() (no reader exists to block on; in-source 64 KB ceiling note + watchdog own it); EngineGate.terminateAndReap has no preceding queue.sync; ReadingPresenter apex render is a one-shot synchronous render (write→close→read-to-EOF is the operation itself — no deadline/Stop/close machinery to defeat, out of class); MCPServer fflush (the app is the child there); ScriptedEngine mirrors the queue shape but performs zero FileHandle I/O.
EngineHost left untouched — implementer's disclosed out-of-scope call, reviewed and ACCEPTED: post-fix killChat/withOneShot/shutdownAll call a bounded close (bookkeeping sync on an I/O-free queue; ≤ ~1 s SIGTERM-grace + reap worst case). Hopping them off MainActor would drop the reaped-before-return guarantee the teardown smokes pin — an EngineHost API change beyond this finding. The briefed defect was the unbounded hang; it is gone.
Round 1 (2026-11-18, same night): zero must-fix, zero nits — clean on first pass after full independent verification. Converged in 1 round.
Unverified: nothing keyed to museion/acp-backpressure-defeats-timeout-and-shutdown — every Verify leg re-executed by the review seat at the exact SHAs above.
New fake mode neverRead: execs /bin/sleep 30 without reading stdin, so the pipe fills and the client's writer blocks (exec keeps sleep the direct child for SIGTERM)
New fake mode serverPing: full behavior plus one server→client request (id 900) at initialize, logging the client's -32601 reply line to -reply-log
Header docs updated to describe both modes and their observables
awaitBounded helper: bounded one-deadline window; nil result means the task hung
Blocked-writer rig: real ACPEngineClient over the neverRead fake, wedged by a 2M-char prompt
3 regression smokes: request deadline fires while blocked; session/cancel accepted and follow-up request reaches its own deadline; close() returns bounded and reaps the child (SIGKILL-first teardown settles the base tree)
Healthy-contract smoke: initialize round trip to 9.9.9, -32601 reply logged over the wire, idempotent close with reap
New Fixed entry for the acp backpressure finding: mechanism (one serial queue defeating deadlines, Stop, close), fix (dedicated writer queue), and test coverage
<!-- pr-agent-generated -->
### **User description**
## Finding — `museion/acp-backpressure-defeats-timeout-and-shutdown`
A hung engine child that stops reading stdin fills the 64 KB pipe; `ACPEngineClient`'s synchronous `fileHandleForWriting.write` ran on the client's ONE serial state queue — the same queue carrying request-id allocation, pending-registration, the `asyncAfter` request deadline, and `close()`'s opening `queue.sync` barrier. A blocked writer therefore defeated:
- the request timeout — the deadline sat queued behind the stuck send and never fired (`ACPEngineClient.swift` base bb4bfa26: L177 `queue.async { self.send(raw) }`, L180 `queue.asyncAfter(deadline:)`);
- Stop/lifecycle — a follow-up request starved at id-allocation/registration `queue.sync` (base L154, L168), `session/cancel` queued behind the write (base L197);
- teardown — `close()` began with `queue.sync` (base L203) behind the stuck writer, so SIGTERM/SIGKILL were never reachable, and `EngineHost`'s close callers (`killChat`, `withOneShot` defer, `shutdownAll`) run on MainActor — an app-wide unbounded hang on restart/quit (availability, APP-DOWN class; argus cycle-4, severity high, executed standalone repro: 2M-char request at 0.1 s timeout over an inert `/bin/sleep` child — no completion, watchdog `close()` never returned, probe killed at 12 s).
Unticketed by design — no issue exists, the slug is the key.
## Fix
Stdin writes — and the stdin write-handle's own close — move off the state queue onto a dedicated serial `writerQueue` (`Museion/ACPEngineClient.swift` +42/−8, the only production file touched):
- `send(_:)` frames and writes on `writerQueue`; `request`, `notify`, and `dispatch`'s server-reply (-32601) all funnel through it — wire order preserved (one serial FIFO, same enqueue-order semantics).
- The state queue is now I/O-free: id allocation, registration, deadlines, and `close()`'s bookkeeping barrier always run; `close()` does SIGTERM → 1 s grace → SIGKILL → reap without ever queueing behind the writer.
- The stdin WRITE handle closes ON the writer queue after kill+reap — a blocked write may still be in `write(2)` (unblocks with EPIPE once the child's read end died, which the kill arranged); closing under a live write would race Foundation. Reader handles close on the caller as before (handlers off first, no writers exist for them).
- Blocking writes kept (boring over clever): a blocked writer now wedges only itself.
## Verification (review seat, independent re-runs — clone `~/athena-reviews/museion/`, base re-pinned live: trunk `main` = bb4bfa26 unchanged at review, merge-base = base, so the branch is unintegrated and diffed against exactly bb4bfa26)
- **RED at `33b7fe0`** (base tree + regression tests), focused serialized `EngineSmokeTests` via the full-test.sh rail, run dir `20261117T231035Z-Museion-serialized`: **6 executed / 3 passed / 3 failed** (xcodebuild exit 65) — exactly the three blocked-writer smokes, each on mechanism: `deadline did not fire … still blocked after 5 s`; `bookkeeping starved behind the blocked writer`; `close did not return within 5 s`. 98 SwiftCompile lines (no stale binary). Matches the implementer's RED run.
- **Fix at `89cd377`**, same focused rail, run dir `20261117T231251Z-Museion-serialized`: **6 executed / 6 passed / 0 failed / 0 skipped, exit 0** — all four new smokes started/passed (deadline 0.534 s, stop/bookkeeping 0.739 s, close-bounded 0.232 s, healthy 0.189 s).
- **Full suite at head `ae3b99c`**, serialized rail, run dir `20261117T231415Z-Museion-serialized`: **697 executed / 697 passed / 0 failed / 0 skipped, xcodebuild exit 0** — matches the implementer's 697/697 (the head's docs commit verified docs-only against its parent: CHANGELOG + devlog + INDEX, zero code files).
- **Lint at head**: swiftformat `--lint`: 0/149 files require formatting (exit 0); swiftlint: **0 violations, 0 serious** in 138 files (exit 0) — the gate is zero and the base was clean.
- **GitNexus** at head (fresh index, review clone): `detect-changes` vs base → 8 production symbols in `ACPEngineClient.swift` (writerQueue, pending, framed, ACPEngineClient, request, notify, close, send) + test rig; affected flows: Start→Send, MakeScriptedRig→ACPEngineClient. Impact: `send` **LOW (5 impacted, 3 direct, 1 process)** — matches the implementer; `dispatch` LOW (2, 1 direct). Divergence disclosed: on this fresh index `notify`/`close`/`request` label HIGH (149 impacted at depth 2) where the implementer's worktree index reported LOW(0)/LOW(0)/UNKNOWN(0) — the count is transitive fan-out through the EngineTransport seam with **direct = 1 and processes_affected = 0** on all three, i.e. graph closure state, not a defect signal: every direct caller is either in the same file and updated by this diff, or pinned green by the full suite and the healthy-contract smoke. Advisory tool only; no action.
- **Owner-apply patch** `git apply --check` at branch head `ae3b99c`: exit 0 (direct application clean; patch touches exactly `Museion/AGENTS.md` +1 line, `MuseionTests/AGENTS.md` +1 line — the consent-gated DOX updates).
- **Mergeability**: `git merge-tree --write-tree` vs `origin/main`@bb4bfa26 → clean, exit 0. Coupling with open PR #198 (`ffb9457`, sole shared file `docs/devlog/INDEX.md`): merge-tree vs `ffb9457` also clean, exit 0, and the merged tree retains BOTH ledger rows (80 rows = 79+1 each side; verified by reading the merged blob) — whichever merges first, the other lands clean.
## Rig discipline
The only child ever spawned by the new tests is the zsh fake: `neverRead` mode execs `/bin/sleep 30` without reading one line (exec = sleep is the DIRECT child, so close's SIGTERM reaches it and no orphan holds the pipe); `serverPing` mode is full behaviour plus one server→client request (id 900) at initialize, logging our reply to `<name>-reply-log`. No real Hermes profile is anywhere near the dead-child smokes.
## Implementer disclosures (verbatim, 4)
1. First focused RED run died at COMPILE (my `Task<String?, Never>` made `awaitBounded`'s `T?` a double optional — two `error:` lines, zero tests executed, the rail's vacuous guard caught it as 0-executed/exit 65). Fixed to `Task<String, Never>`; the recorded RED run is the second, clean one.
2. No testmanagerd wedge encountered this brief (the known hazard did not fire; runs sequenced behind @athena's classis brief-26 verify, which finished 22:21:15 exit 0 before my first xcodebuild).
3. AGENTS.md DOX updates (Museion/AGENTS.md ACP-bridge bullets, MuseionTests/AGENTS.md suite-map lines) are consent-gated → owner-apply patch beside the handoff, `git apply --check` clean vs branch head; the root AGENTS.md session-log 10-row window is left for the write-log tooling (INDEX.md carries the durable row).
4. Docs commit (CHANGELOG + devlog + INDEX) is docs-only; the 697/697 suite ran at its parent (the fix commit) — code identical.
Owner apply line for Alexander at merge time: `git apply ~/daedalus-builds/museion/brief-27-agents-md-owner-apply.patch` (moment-scoped to `ae3b99c`; if `main` rewrites those doc lines before you apply, request a regen).
## Scope (pre-committed criteria: same defect class / file already in footprint / mechanical zero-new-logic)
- In-scope: all four `send` call sites (request, notify, dispatch server-reply — the seeded set; the reply path rides the same `send`, no second site), the deadline scheduling, both request-path `queue.sync`s, and `close()`'s barrier — one writer-queue separation heals all; nothing beyond.
- Disproved with evidence (reviewer re-checked each in-source): `EngineGate.execute` pre-spawn write lands before `process.run()` (no reader exists to block on; in-source 64 KB ceiling note + watchdog own it); `EngineGate.terminateAndReap` has no preceding `queue.sync`; `ReadingPresenter` apex render is a one-shot synchronous render (write→close→read-to-EOF is the operation itself — no deadline/Stop/close machinery to defeat, out of class); `MCPServer` fflush (the app is the child there); `ScriptedEngine` mirrors the queue shape but performs zero FileHandle I/O.
- **EngineHost left untouched — implementer's disclosed out-of-scope call, reviewed and ACCEPTED**: post-fix `killChat`/`withOneShot`/`shutdownAll` call a bounded close (bookkeeping sync on an I/O-free queue; ≤ ~1 s SIGTERM-grace + reap worst case). Hopping them off MainActor would drop the reaped-before-return guarantee the teardown smokes pin — an EngineHost API change beyond this finding. The briefed defect was the unbounded hang; it is gone.
- Scope appendix: no out-of-brief sites migrated; nothing shed — appendix empty.
## Review rounds
Round 1 (2026-11-18, same night): zero must-fix, zero nits — clean on first pass after full independent verification. Converged in 1 round.
Unverified: nothing keyed to `museion/acp-backpressure-defeats-timeout-and-shutdown` — every Verify leg re-executed by the review seat at the exact SHAs above.
[Generated by AI]
___
### **PR Type**
Bug fix, Tests, Documentation
___
### **Description**
- Fix availability bug: blocked stdin writes wedged ACP client
- One serial queue carried writes, deadlines, registration, close barrier
- Hung engine could hang restart/quit app-wide on MainActor
- Move stdin writes to dedicated serial writerQueue
- State queue now I/O-free: deadlines fire, Stop accepted, bookkeeping answers
- close() stays bounded: SIGTERM → grace → SIGKILL → reap, handle close rides writer queue
- Add 4 real-process regression smokes over 2 new fake modes
- neverRead execs /bin/sleep (pipe fills, writer blocks); serverPing pins -32601 reply
- 3 smokes RED-first at base on exactly the three defeated mechanisms
- Document via CHANGELOG entry, session devlog, and INDEX row
___
### Diagram Walkthrough
```mermaid
flowchart LR
REQ["request / notify / server reply"] -- "send()" --> WQ["serial writerQueue"]
WQ -- "blocking write" --> PIPE["stdin pipe (64 KB, may fill)"]
SQ["state queue (now I/O-free)"] -- "id alloc, registration, deadline" --> REQ
CLOSE["close()"] -- "bookkeeping sync" --> SQ
CLOSE -- "SIGTERM → SIGKILL → reap" --> CHILD["engine child"]
CLOSE -- "stdin handle close" --> WQ
SMOKE["+4 EngineSmokeTests"] -- "neverRead / serverPing fakes" --> REQ
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>ACPEngineClient.swift</strong><dd><code>Separate stdin writer from state queue</code> </dd></summary>
<hr>
Museion/ACPEngineClient.swift
<ul><li>Add dedicated serial <code>writerQueue</code>; state queue never touches the pipe, <br>so a full pipe blocks only the writer<br> <li> <code>send(_:)</code> frames and writes on <code>writerQueue</code>; <code>request</code> and <code>notify</code> call it <br>directly (no state-queue hop), preserving wire order via one FIFO <br>queue<br> <li> <code>close()</code> closes the stdin write handle on <code>writerQueue</code> (a blocked write <br>may still own it), keeping bookkeeping, SIGTERM → SIGKILL → reap off <br>the writer<br> <li> Doc comments record the brief-27 invariants at the queue, send, and <br>teardown sites</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/Museion/ACPEngineClient.swift">+34/-8</a> </td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>ACPClientTests.swift</strong><dd><code>neverRead and serverPing zsh fake modes</code> </dd></summary>
<hr>
MuseionTests/ACPClientTests.swift
<ul><li>New fake mode <code>neverRead</code>: execs <code>/bin/sleep 30</code> without reading stdin, so <br>the pipe fills and the client's writer blocks (exec keeps sleep the <br>direct child for SIGTERM)<br> <li> New fake mode <code>serverPing</code>: full behavior plus one server→client request <br>(id 900) at initialize, logging the client's -32601 reply line to <br><code><name>-reply-log</code><br> <li> Header docs updated to describe both modes and their observables</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/MuseionTests/ACPClientTests.swift">+17/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>EngineSmokeTests.swift</strong><dd><code>Four blocked-writer regression smokes added</code> </dd></summary>
<hr>
MuseionTests/EngineSmokeTests.swift
<ul><li><code>awaitBounded</code> helper: bounded one-deadline window; nil result means the <br>task hung<br> <li> Blocked-writer rig: real <code>ACPEngineClient</code> over the <code>neverRead</code> fake, <br>wedged by a 2M-char prompt<br> <li> 3 regression smokes: request deadline fires while blocked; <br><code>session/cancel</code> accepted and follow-up request reaches its own <br>deadline; <code>close()</code> returns bounded and reaps the child (SIGKILL-first <br>teardown settles the base tree)<br> <li> Healthy-contract smoke: initialize round trip to 9.9.9, -32601 reply <br>logged over the wire, idempotent close with reap</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/MuseionTests/EngineSmokeTests.swift">+178/-0</a> </td>
</tr>
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>CHANGELOG.md</strong><dd><code>User-facing changelog entry for the fix</code> </dd></summary>
<hr>
CHANGELOG.md
<ul><li>New Fixed entry for the acp backpressure finding: mechanism (one <br>serial queue defeating deadlines, Stop, close), fix (dedicated writer <br>queue), and test coverage</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/CHANGELOG.md">+2/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md</strong><dd><code>Devlog: finding, disproofs, gates, decisions</code> </dd></summary>
<hr>
docs/devlog/20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md
<ul><li>Session log for the unticketed brief-27 fix: finding, executed <br>standalone repro, and base commit<br> <li> Site-class enumeration with per-site disproofs (EngineGate, <br>ReadingPresenter, MCPServer, ScriptedEngine, EngineHost callers)<br> <li> Gates (RED 3/6 at base, 6/6 at fix, 697/697 full suite, lint, GitNexus <br>impact) and a decisions/rationale table with disclosures</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/docs/devlog/20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md">+53/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>INDEX.md</strong><dd><code>Devlog index row for brief-27</code> </dd></summary>
<hr>
docs/devlog/INDEX.md
<ul><li>Add the newest-first index row pointing at the brief-27 backpressure <br>session log</ul>
</details>
</td>
<td><a href="https://git.babylondreams.de/AlexKucera/museion/src/branch/fix/acp-backpressure-defeats-timeout-and-shutdown/docs/devlog/INDEX.md">+1/-0</a> </td>
</tr>
</table></td></tr></tbody></table>
</details>
___
<hr>
<details> <summary><strong>🛠️ Relevant configurations:</strong></summary>
<br>These are the relevant [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml) for this tool:
**[config**]
```yaml
max_webhook_request_body_bytes: 5242880
git_provider: gitea
publish_output: True
publish_output_progress: True
progress_gif_url:
progress_gif_width: 48
verbosity_level: 0
use_extra_bad_extensions: False
log_level: INFO
use_repo_settings_file: True
use_global_settings_file: True
enable_per_directory_settings: False
per_directory_settings_max_files: 20
per_directory_settings_max_tree_pages: 10
disable_auto_feedback: False
ai_timeout: 120
retry_same_model_on_timeout: True
retry_same_model_on_length: False
custom_reasoning_model: False
response_language: en-US
repo_context_files: [AGENTS.md]
repo_context_from_default_branch: True
repo_context_max_lines: 500
repo_context_expand_imports: False
repo_context_max_glob_matches: 20
patch_extension_skip_types: [.md, .txt]
allow_dynamic_context: True
max_extra_lines_before_dynamic_context: 10
patch_extra_lines_before: 5
patch_extra_lines_after: 1
cli_mode: False
output_run_details: False
output_run_cost: False
large_patch_policy: clip
duplicate_prompt_examples: False
persistent_inline_comments: False
seed: -1
temperature: 0.2
ignore_pr_title: ['^\[Auto\]']
ignore_pr_target_branches: []
ignore_pr_source_branches: []
ignore_pr_labels: []
ignore_pr_authors: []
reaction_on_start: eyes
reaction_on_success:
reaction_on_failure:
ignore_repositories: []
ignore_language_framework: []
bot_user_indicators: [codium, bot_, bot-, _bot, -bot]
restricted_mode: False
is_auto_command: True
propagate_tool_errors: False
enable_ai_metadata: False
add_user_to_requests: False
additional_reasoning_effort_models: []
no_temperature_models: [deepseek/deepseek-reasoner, o1-mini, o1-mini-2024-09-12, o1, o1-2024-12-17, o3-mini,
o3-mini-2025-01-31, o3, o3-2025-04-16, o4-mini, o4-mini-2025-04-16, gpt-5.1-codex,
gpt-5.1-codex-mini, gpt-5.2-codex, gpt-5.3-codex, gpt-5-mini, moonshotai.kimi-k3,
us.moonshotai.kimi-k3, global.moonshotai.kimi-k3, kimi-k3, kimi-k3.1-pro, zai.glm-5]
enable_claude_extended_thinking: False
enable_claude_adaptive_thinking: False
claude_adaptive_thinking_models_override: []
claude_extended_thinking_models_override: []
extract_issue_from_branch: True
branch_issue_regex:
output_relevant_configurations: True
model: openai/glm-5.3
fallback_models: []
reasoning_effort: high
```
**[pr_description]**
```yaml
add_original_user_description: True
extra_instructions:
enable_pr_type: True
enable_pr_description: True
final_update_message: True
enable_help_text: False
enable_help_comment: False
enable_pr_diagram: True
pr_diagram_direction: adaptive
pr_diagram_direction_threshold: 5
publish_description_as_comment: False
publish_description_as_comment_persistent: True
enable_semantic_files_types: True
collapsible_file_list: adaptive
collapsible_file_list_threshold: 6
file_table_collapsible_open_by_default: False
use_description_markers: False
enable_large_pr_handling: True
include_generated_by_header: True
max_ai_calls: 4
publish_labels: True
async_ai_calls: False
generate_ai_title: False
```
</details>
RED at base for the acp-backpressure finding: on the unfixed
transport a hung engine that stops reading stdin fills its pipe,
and the synchronous send wedges the client's one serial queue —
the request deadline never fires, follow-up bookkeeping starves,
and close() blocks behind the stuck write (argus probe: 2M-char
request, 0.1 s timeout, watchdog close never returned).
Three smokes over the existing rig, using a new neverRead fake
mode (execs /bin/sleep — the probe's inert non-reading child;
never a real profile): deadline fires while blocked, Stop +
bookkeeping answer while blocked, close returns bounded and reaps
the child. A fourth smoke (new serverPing fake mode) pins the
healthy contract — round trip, -32601 reply delivery over the
wire, idempotent clean close — and passes at base.
Focused serialized run at base: 6 executed / 3 passed / 3 failed
— exactly the three blocked-writer smokes fail, on mechanism.
A hung engine that stops reading stdin fills the 64 KB pipe, and
the client's synchronous send blocked its one serial queue — the
same queue that carries request deadlines, request registration,
and close()'s bookkeeping barrier. A blocked writer therefore
defeated the request timeout, starved Stop/lifecycle calls, and
made close() queue.sync behind the stuck write before SIGTERM was
ever reachable; EngineHost's MainActor close callers turned that
into an app-wide unbounded hang on restart or quit (argus probe:
2M-char request with 0.1 s timeout never timed out; a watchdog
close never returned).
Separate the writer from the state: stdin writes (and the stdin
handle's own close, which a blocked write may still own) now ride
a dedicated serial writerQueue, so the state queue is I/O-free —
deadlines fire, Stop is accepted, follow-up requests register,
and close() runs bookkeeping, SIGTERM -> grace -> SIGKILL -> reap
without ever queueing behind the writer. Wire order is preserved
(all send sites funnel through the one serial writer queue) and
the healthy-engine contract is untouched.
Focused serialized EngineSmokeTests: 6 executed / 6 passed at the
fix (3 of them RED at base on exactly the three mechanisms).
Docs-only (code identical to the fix commit 89cd377, where the
697/697 suite ran): devlog carries the site-class enumeration with
disproofs, the decisions table, and the gates; CHANGELOG gains the
user-facing acp backpressure entry.
Reviewer fanout (ponytail/security/general) over #199 found no
behavior defects. Apply the accepted non-behavioral findings:
- requestOutcome helper dedups the two outcome tasks; the two
discarded wedge tasks drop their unread do/catch scaffolding
- awaitBounded doc names its real bound (window is green-world
only; the RED-world watchdog is the fake's /bin/sleep 30 exit)
- send() gains a ponytail ceiling comment: queued sends are
unbounded and a send racing close() writes onto a closed handle
(benign, probe-verified) — bounded by the model's sequential
sends; guard if a looping caller appears
- request() doc notes a timed-out request's bytes may still land
on the wire (late replies dropped, ids never reused)
Suite 697/697 green post-change; format+lint clean.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
User description
Finding —
museion/acp-backpressure-defeats-timeout-and-shutdownA hung engine child that stops reading stdin fills the 64 KB pipe;
ACPEngineClient's synchronousfileHandleForWriting.writeran on the client's ONE serial state queue — the same queue carrying request-id allocation, pending-registration, theasyncAfterrequest deadline, andclose()'s openingqueue.syncbarrier. A blocked writer therefore defeated:ACPEngineClient.swiftbasebb4bfa26: L177queue.async { self.send(raw) }, L180queue.asyncAfter(deadline:));queue.sync(base L154, L168),session/cancelqueued behind the write (base L197);close()began withqueue.sync(base L203) behind the stuck writer, so SIGTERM/SIGKILL were never reachable, andEngineHost's close callers (killChat,withOneShotdefer,shutdownAll) run on MainActor — an app-wide unbounded hang on restart/quit (availability, APP-DOWN class; argus cycle-4, severity high, executed standalone repro: 2M-char request at 0.1 s timeout over an inert/bin/sleepchild — no completion, watchdogclose()never returned, probe killed at 12 s).Unticketed by design — no issue exists, the slug is the key.
Fix
Stdin writes — and the stdin write-handle's own close — move off the state queue onto a dedicated serial
writerQueue(Museion/ACPEngineClient.swift+42/−8, the only production file touched):send(_:)frames and writes onwriterQueue;request,notify, anddispatch's server-reply (-32601) all funnel through it — wire order preserved (one serial FIFO, same enqueue-order semantics).close()'s bookkeeping barrier always run;close()does SIGTERM → 1 s grace → SIGKILL → reap without ever queueing behind the writer.write(2)(unblocks with EPIPE once the child's read end died, which the kill arranged); closing under a live write would race Foundation. Reader handles close on the caller as before (handlers off first, no writers exist for them).Verification (review seat, independent re-runs — clone
~/athena-reviews/museion/, base re-pinned live: trunkmain=bb4bfa26unchanged at review, merge-base = base, so the branch is unintegrated and diffed against exactlybb4bfa26)33b7fe0(base tree + regression tests), focused serializedEngineSmokeTestsvia the full-test.sh rail, run dir20261117T231035Z-Museion-serialized: 6 executed / 3 passed / 3 failed (xcodebuild exit 65) — exactly the three blocked-writer smokes, each on mechanism:deadline did not fire … still blocked after 5 s;bookkeeping starved behind the blocked writer;close did not return within 5 s. 98 SwiftCompile lines (no stale binary). Matches the implementer's RED run.89cd377, same focused rail, run dir20261117T231251Z-Museion-serialized: 6 executed / 6 passed / 0 failed / 0 skipped, exit 0 — all four new smokes started/passed (deadline 0.534 s, stop/bookkeeping 0.739 s, close-bounded 0.232 s, healthy 0.189 s).ae3b99c, serialized rail, run dir20261117T231415Z-Museion-serialized: 697 executed / 697 passed / 0 failed / 0 skipped, xcodebuild exit 0 — matches the implementer's 697/697 (the head's docs commit verified docs-only against its parent: CHANGELOG + devlog + INDEX, zero code files).--lint: 0/149 files require formatting (exit 0); swiftlint: 0 violations, 0 serious in 138 files (exit 0) — the gate is zero and the base was clean.detect-changesvs base → 8 production symbols inACPEngineClient.swift(writerQueue, pending, framed, ACPEngineClient, request, notify, close, send) + test rig; affected flows: Start→Send, MakeScriptedRig→ACPEngineClient. Impact:sendLOW (5 impacted, 3 direct, 1 process) — matches the implementer;dispatchLOW (2, 1 direct). Divergence disclosed: on this fresh indexnotify/close/requestlabel HIGH (149 impacted at depth 2) where the implementer's worktree index reported LOW(0)/LOW(0)/UNKNOWN(0) — the count is transitive fan-out through the EngineTransport seam with direct = 1 and processes_affected = 0 on all three, i.e. graph closure state, not a defect signal: every direct caller is either in the same file and updated by this diff, or pinned green by the full suite and the healthy-contract smoke. Advisory tool only; no action.git apply --checkat branch headae3b99c: exit 0 (direct application clean; patch touches exactlyMuseion/AGENTS.md+1 line,MuseionTests/AGENTS.md+1 line — the consent-gated DOX updates).git merge-tree --write-treevsorigin/main@bb4bfa26 → clean, exit 0. Coupling with open PR #198 (ffb9457, sole shared filedocs/devlog/INDEX.md): merge-tree vsffb9457also clean, exit 0, and the merged tree retains BOTH ledger rows (80 rows = 79+1 each side; verified by reading the merged blob) — whichever merges first, the other lands clean.Rig discipline
The only child ever spawned by the new tests is the zsh fake:
neverReadmode execs/bin/sleep 30without reading one line (exec = sleep is the DIRECT child, so close's SIGTERM reaches it and no orphan holds the pipe);serverPingmode is full behaviour plus one server→client request (id 900) at initialize, logging our reply to<name>-reply-log. No real Hermes profile is anywhere near the dead-child smokes.Implementer disclosures (verbatim, 4)
Task<String?, Never>madeawaitBounded'sT?a double optional — twoerror:lines, zero tests executed, the rail's vacuous guard caught it as 0-executed/exit 65). Fixed toTask<String, Never>; the recorded RED run is the second, clean one.git apply --checkclean vs branch head; the root AGENTS.md session-log 10-row window is left for the write-log tooling (INDEX.md carries the durable row).Owner apply line for Alexander at merge time:
git apply ~/daedalus-builds/museion/brief-27-agents-md-owner-apply.patch(moment-scoped toae3b99c; ifmainrewrites those doc lines before you apply, request a regen).Scope (pre-committed criteria: same defect class / file already in footprint / mechanical zero-new-logic)
sendcall sites (request, notify, dispatch server-reply — the seeded set; the reply path rides the samesend, no second site), the deadline scheduling, both request-pathqueue.syncs, andclose()'s barrier — one writer-queue separation heals all; nothing beyond.EngineGate.executepre-spawn write lands beforeprocess.run()(no reader exists to block on; in-source 64 KB ceiling note + watchdog own it);EngineGate.terminateAndReaphas no precedingqueue.sync;ReadingPresenterapex render is a one-shot synchronous render (write→close→read-to-EOF is the operation itself — no deadline/Stop/close machinery to defeat, out of class);MCPServerfflush (the app is the child there);ScriptedEnginemirrors the queue shape but performs zero FileHandle I/O.killChat/withOneShot/shutdownAllcall a bounded close (bookkeeping sync on an I/O-free queue; ≤ ~1 s SIGTERM-grace + reap worst case). Hopping them off MainActor would drop the reaped-before-return guarantee the teardown smokes pin — an EngineHost API change beyond this finding. The briefed defect was the unbounded hang; it is gone.Review rounds
Round 1 (2026-11-18, same night): zero must-fix, zero nits — clean on first pass after full independent verification. Converged in 1 round.
Unverified: nothing keyed to
museion/acp-backpressure-defeats-timeout-and-shutdown— every Verify leg re-executed by the review seat at the exact SHAs above.[Generated by AI]
PR Type
Bug fix, Tests, Documentation
Description
Fix availability bug: blocked stdin writes wedged ACP client
Move stdin writes to dedicated serial writerQueue
Add 4 real-process regression smokes over 2 new fake modes
Document via CHANGELOG entry, session devlog, and INDEX row
Diagram Walkthrough
File Walkthrough
ACPEngineClient.swift
Separate stdin writer from state queueMuseion/ACPEngineClient.swift
writerQueue; state queue never touches the pipe,so a full pipe blocks only the writer
send(_:)frames and writes onwriterQueue;requestandnotifycall itdirectly (no state-queue hop), preserving wire order via one FIFO
queue
close()closes the stdin write handle onwriterQueue(a blocked writemay still own it), keeping bookkeeping, SIGTERM → SIGKILL → reap off
the writer
teardown sites
ACPClientTests.swift
neverRead and serverPing zsh fake modesMuseionTests/ACPClientTests.swift
neverRead: execs/bin/sleep 30without reading stdin, sothe pipe fills and the client's writer blocks (exec keeps sleep the
direct child for SIGTERM)
serverPing: full behavior plus one server→client request(id 900) at initialize, logging the client's -32601 reply line to
-reply-logEngineSmokeTests.swift
Four blocked-writer regression smokes addedMuseionTests/EngineSmokeTests.swift
awaitBoundedhelper: bounded one-deadline window; nil result means thetask hung
ACPEngineClientover theneverReadfake,wedged by a 2M-char prompt
session/cancelaccepted and follow-up request reaches its owndeadline;
close()returns bounded and reaps the child (SIGKILL-firstteardown settles the base tree)
logged over the wire, idempotent close with reap
CHANGELOG.md
User-facing changelog entry for the fixCHANGELOG.md
serial queue defeating deadlines, Stop, close), fix (dedicated writer
queue), and test coverage
20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md
Devlog: finding, disproofs, gates, decisionsdocs/devlog/20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md
standalone repro, and base commit
ReadingPresenter, MCPServer, ScriptedEngine, EngineHost callers)
impact) and a decisions/rationale table with disclosures
INDEX.md
Devlog index row for brief-27docs/devlog/INDEX.md
session log
🛠️ Relevant configurations:
These are the relevant configurations for this tool:
[config]
[pr_description]
Failed to generate code suggestions for PR
/review
Failed to review PR