Skip to content

Commit eef675b

Browse files
committed
docs: close plan phase 0 on paper and record what phase 1 did without a decision (plan r9)
The three gates still open after r8 (0.3 on the Rust side, 0.7, 0.8) are written down, together with the parts of phase 1 that need no decision. Nothing here changes behaviour that was not already committed; every behaviour-changing decision is a proposal for the user (section 10.11, twelve items), not a change. - docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md: section 10.11 (PR #9's second CI run, the e2e suite and the two product bugs it found, the cold-start latency before and after, the 13 disk-read call sites in 8 files, the 13-case resume matrix, the landing design of ADR1 with the sandbox ordering and the PR slicing, the 12-scenario permission-mode probe, what changed, what was run, what was not, the twelve proposals); appendix A (capability matrix with every row marked decided / proposed / open, the ACP version pairing and the upgrade rules, the per-method table); B.4 (how to reproduce); the checklist ticks and the r9 revision-log line. - docs/baselines/tui.md: pi-pager 5,577 -> 5,602 (the four new groups of tests), the full ten-suite run on WSL2 (8,659 passed / 0 failed / 22 ignored = CI's 8,634 + 25), the path-filter change. - CHANGELOG.md, [Unreleased]: the session list is read in pages, the pager no longer sends mcp_servers and the agent says it ignores them, the agent-exit fixes. - AGENTS.md: the resume matrix, the mode probe and python_agent_e2e.rs (PI_E2E_PYTHON). packages/pi-agent-cli/AGENTS.md: what the pager shows when the agent exits on its own. Verification: scripts/tui_baseline.py test exits 0 (10 suites, 8,659 passed / 0 failed / 22 ignored); pytest 2,352 passed on Linux (WSL) and 2,351 on Windows; scripts/tests/test_tui_pty.py 19 passed with pyte; ruff check and ruff format --check clean with the venv's 0.16.10 and with CI's pinned 0.16.0. All of it is WSL2's or Windows' own run; this branch has not been pushed, so the first CI run confirms or corrects the numbers and the new e2e install step.
1 parent d426253 commit eef675b

5 files changed

Lines changed: 317 additions & 38 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ AgentMessage[] → transform_context() → convert_to_llm() → LangChain BaseMe
5050

5151
## Development
5252

53-
Python monorepo (`pi-agent-core`, `pi-agent-harness`, `pi-agent-cli`) + Rust TUI workspace `tui/` (vendored grok-build fork, binary `zypi`). Packages installed editable; tested via `pytest`. TUI: `cd tui && cargo check -p pi-pager-bin` (WSL; Cargo reads `CARGO_TARGET_DIR` from WSL env exclusively). Rust tests run through `python scripts/tui_baseline.py test` (manifest `scripts/tui_baseline.toml`, numbers in `docs/baselines/tui.md`); it clears `PI_HOME` and friends, which a WSL login shell may export pointing at the real home — do not run test binaries or `zypi` without clearing them, and build on the Linux file system, not `/mnt/<drive>`. With a built `zypi`, `scripts/tui_pty/` drives it under a pseudo-terminal on Linux (smoke test, exit matrix, `-p` shutdown; README there).
53+
Python monorepo (`pi-agent-core`, `pi-agent-harness`, `pi-agent-cli`) + Rust TUI workspace `tui/` (vendored grok-build fork, binary `zypi`). Packages installed editable; tested via `pytest`. TUI: `cd tui && cargo check -p pi-pager-bin` (WSL; Cargo reads `CARGO_TARGET_DIR` from WSL env exclusively). Rust tests run through `python scripts/tui_baseline.py test` (manifest `scripts/tui_baseline.toml`, numbers in `docs/baselines/tui.md`); it clears `PI_HOME` and friends, which a WSL login shell may export pointing at the real home — do not run test binaries or `zypi` without clearing them, and build on the Linux file system, not `/mnt/<drive>`. With a built `zypi`, `scripts/tui_pty/` drives it under a pseudo-terminal on Linux (smoke test, exit matrix, `-p` shutdown, the matrix of flags that resume a session, a probe of which permission modes the agent honours; README there). The pager's ACP client is also run against the real Python agent without a terminal: `tui/crates/codegen/pi-pager/tests/python_agent_e2e.rs`, which needs `PI_E2E_PYTHON` (a Python with `pi_agent_cli` installed; TUI CI sets it and `PI_E2E_REQUIRED=1`, locally an unset variable makes the tests skip with a note).
5454

5555
### Virtual environments (uv)
5656

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- **The TUI keeps the agent's stderr**: `zypi` points its own stderr at `/dev/null` and the agent inherited it, so a Python traceback or warning from the agent went nowhere. It is now appended to `<home>/logs/agent.stderr.log` (mode 0600 on Unix, one `--- agent started ... ---` line per run, moved to `agent.stderr.log.1` once it is over 1 MiB at the next start). `zypi -p` is unchanged: the agent's stderr stays on the terminal.
1313
- **A sandbox that cannot be put in force says so (TUI)**: on a kernel without Landlock (Linux before 5.13, or with it disabled) `zypi --sandbox <profile>` used to start without the file and network limits and without a word; the only trace was an `ApplyFailed` line in `sandbox-events.jsonl`. It now prints a warning on stderr at start-up and shows `sandbox:<profile> (not enforced)` in the welcome page's top bar and the status bar, where the label of an applied profile is drawn. Where the sandbox is applied nothing changes.
1414

15+
- **`session/list` comes in pages (`pi-agent-cli`, `pi-agent-harness`)**: the agent answers with at most 50 sessions, newest first, and a `nextCursor` while more follow; the cursor is opaque, carries the position in it (the agent keeps nothing between requests, so it survives a restart) and anything the agent did not issue is `invalid_params`. The TUI keeps asking until the cursor is gone, so its session picker still lists everything. For library users `JsonlSessionRepo.list_page(...)` returns one page and `JsonlSessionRepo.find(id)` reads one session's header instead of the directory. With 1,000 sessions of 120 entries on Windows, the first answer took 2.0 s and a `session/load` of one of them 2.0 s; reading a file's first line no longer reads the file and a lookup by id no longer lists the directory, which makes them 0.11 s and 0.12 s (`scripts/session_list_bench.py`; numbers and method in `docs/PLAN/PLAN-RUST-AGENT-RUNTIME-REMOVAL.md` §10.11). `updated_at` is still the file's mtime and need not follow the list's order, which is by creation time.
16+
- **The agent says which MCP servers a session ignored (`pi-agent-cli`)**: the agent connects to no MCP server (a Phase 4 non-goal), which departs from ACP's "an agent MUST support stdio servers"; `session/new`, `load` and `resume` used to drop the list without a word. Each session set up with a non-empty list now logs a warning and sends one agent message naming the servers (names only: `env`, `headers`, `args` and `url` hold tokens). `zypi` no longer forwards what it finds in `.mcp.json`, `~/.claude.json` and Cursor's `mcp.json`, so there the message never shows; it is for other ACP clients, an editor that passes its own servers, say.
17+
1518
### Fixed
1619

20+
- **`zypi` told the user nothing when the agent failed to start or died**: a missing agent program surfaced as `channel closed ... recv_failed`, and an agent that exited as soon as it started (a Python without `pi_agent_cli`, say) left `connect` waiting forever; an agent that died in the middle of a turn left the requests in flight waiting too. The stdio bridge now notices the exit and says what happened: the program, its exit status and the last lines the agent wrote to `agent.stderr.log` (`failed to spawn ACP agent ... PI_AGENT_COMMAND` for a program that is not there). `zypi`'s exit status is unchanged. Found by the new end-to-end suite that runs the pager's ACP client against the real agent (`tui/crates/codegen/pi-pager/tests/python_agent_e2e.rs`; TUI CI installs the agent for it).
1721
- **`zypi -p` left the agent and its tools running when only `zypi` was killed**: `kill <pid>`, `kill -9`, `timeout` or an IDE's stop button reached `zypi` but not the agent, which kept running (and kept running its `bash` call) on the user's terminal. `zypi` now passes its pid in `PI_AGENT_PARENT_PID`; `python -m pi_agent_cli -p` watches its parent and stops the way it stops on a signal (turn cancelled, tools reaped), and `-p` now handles SIGTERM and SIGHUP too (exit status 128 + the signal number). POSIX only; the variable is removed from the environment at start-up, so tools do not inherit it, and it is ignored when it names a live process that is not the agent's parent (a wrapper script).
1822
- **`zypi --sandbox ...` on Linux left the whole process tree running when only the outer `bwrap` was killed**: the sandbox re-launches `zypi` under `bwrap`, which by default just waits for its child, so signalling the process the shell started (`kill $!`, a supervisor) left `zypi`, the agent and its tools on the terminal. `bwrap` now runs with `--die-with-parent`. **Trade-off**: a SIGTERM or SIGHUP sent to that outer `bwrap` now reaches `zypi` as SIGKILL, so the terminal is not restored (alternate screen, raw mode); before, the tree kept running instead.
1923

0 commit comments

Comments
 (0)