From 343f2a8a6148b8004d6f4d74fb779b4f30c9686a Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 15 Nov 2026 03:11:22 +0100 Subject: M1-M5: sessions, six tools, approvals, prompt, Ctrl-C, target gate - append-only JSONL sessions with --continue/--session; reasoning stored, stripped on replay - read/write/edit/grep/glob + bash with timeout and capped output - diff-preview approval for the first edit of a session, per-call approval for bash - system prompt frozen per session with AGENTS.md snapshot and change warning - SIGINT aborts the turn, second Ctrl-C exits - glibc gate ignores weak symbols; verified in linux/386 debian:12 - acceptance test (calculator in C) passes on both x86-64 and i386 --- docs/PLAN.md | 71 +++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 25 deletions(-) (limited to 'docs') diff --git a/docs/PLAN.md b/docs/PLAN.md index 2766664..b1273b1 100644 --- a/docs/PLAN.md +++ b/docs/PLAN.md @@ -73,37 +73,58 @@ Verified: `cargo test` 8/8; 2.0 MB stripped i686 binary, max symbol streams correctly; `scripts/check-glibc.sh` passes and fails as expected; `scripts/mock-provider.py` gives a no-key provider for manual work. -**M1 — Sessions, status line, abort.** JSONL append/load, session id, `--continue`, -`--resume `, status line, SIGINT handling. -*Done when:* a turn survives `kill -9` between steps, `--continue` resumes it, and -Ctrl-C returns the prompt without losing the transcript. - -**M2 — Read-side tools and edits.** `read`, `write`, `edit`, `grep`, `glob`, the -agent loop, tool-call accumulation, the approval prompt with diff. -*Done when:* a canned mock session writes a C file, greps it, edits it, and the -transcript replays byte-identically. - -**M3 — `bash`.** Command execution, timeout, output capping, per-call approval, -head/tail rendering. -*Done when:* the mock session compiles the C file and handles a non-zero exit as -data rather than an error. - -**M4 — Prompt and input.** System prompt, environment block, `AGENTS.md` -snapshot, `/paste`, TTY detection, real-API smoke test. -*Done when:* one real turn against OpenCode Go works end to end. - -**M5 — Target gate.** `scripts/check-glibc.sh` (max symbol version ≤ 2.36), -`cargo check --target i686` clean, release run inside -`docker run --platform linux/386 debian:12`, binary copied to the i386 box. -*Done when:* the acceptance test runs there. +**M1 — Sessions, status line, abort.** ✅ Done. + +JSONL append/load, session id, `--continue`, `--session `, status line, +SIGINT handling (first Ctrl-C aborts the turn, second exits). Verified: a +9-step turn writes 19 lines (header + 18 messages, reasoning stored under +`_reasoning`), `--continue` replays all 18 messages and answers from history +without reading files. + +**M2 — Read-side tools and edits.** ✅ Done. + +`read`, `write`, `edit`, `grep`, `glob`, the agent loop, tool-call accumulation, +diff preview plus approval. Verified by `tests/tools.rs` (uniqueness, ambiguity +with line numbers, no implicit `mkdir`, truncation, glob `**`, grep case) and +`tests/loop.rs` (tool call executed and recorded; a denial returned as data). +The approval prompt was also driven through a real pty. + +**M3 — `bash`.** ✅ Done. + +Fresh shell per call, 120 s timeout that kills the process, capped output +(64 KiB head, 16 KiB tail), exit code or signal reported. Verified: exit codes, +timeout, missing `cwd`, and real `gcc` invocations. + +**M4 — Prompt and input.** ✅ Done. + +System prompt with cwd/platform/arch/branch, `AGENTS.md` snapshot frozen at +session start with a change warning, `/paste`, TTY-aware colour. Verified +against the live API: streaming, tool calls, `reasoning_content`, usage and +`opencode.allowance` in the final chunk, and a 401 surfaced as +`api_key_expired`. + +**M5 — Target gate.** ✅ Done. + +`scripts/check-glibc.sh` (required symbols ≤ 2.36; weak symbols such as glibc +2.39's `pidfd_spawnp` are reported but ignored, since they resolve to NULL). +2.0 MB stripped i686 binary, `GLIBC_2.34` required. Verified by running the +whole acceptance test inside `--platform linux/386 debian:12`. ## Acceptance test (v1) > "Make a simple calculator in C" — run on the i386 box, from an empty directory. Exercises `write` (create files), `bash` (compile, run), `read` (inspect what it -wrote), and terminates on its own. Success is: it compiles, it runs, it does -addition and division, and it did not need more than a handful of files. +wrote), and terminates on its own. + +Two runs, both with `--yolo`: + +| Where | Steps | Wall | Allowance | Result | +|---|---|---|---|---| +| x86-64 dev host | 9 | 55.7 s | $0.000214 | `calc.c` (115 lines), clean `-Wall -Wextra` build, 18 cases tested | +| `linux/386 debian:12` | 8 | 32.1 s | $0.000182 | `calc.c` + `Makefile`, `3 + 4 = 7`, `7 / 2 = 3.5`, `5 / 0` → error, exit 1 | + +Independently rebuilt and re-run outside the agent both times. ## Layout -- cgit v1.2.3