aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/KNOWN-ISSUES.md68
-rw-r--r--docs/PLAN.md75
2 files changed, 112 insertions, 31 deletions
diff --git a/docs/KNOWN-ISSUES.md b/docs/KNOWN-ISSUES.md
new file mode 100644
index 0000000..44d9f07
--- /dev/null
+++ b/docs/KNOWN-ISSUES.md
@@ -0,0 +1,68 @@
1# Known issues
2
3Understood, deliberately not fixed. Each one has a reason, and a note on what
4would change the decision.
5
6## Concurrent sessions can interleave
7
8Two processes appending to the same session file will interleave messages and
9corrupt the conversation, permanently, because history is never rewritten.
10`flock(LOCK_EX | LOCK_NB)` on the session fd at open would refuse the second
11process. Not done yet because the failure needs deliberately resuming the same
12id in two shells, and the fix is easy to add later. If it ever happens once,
13add the lock.
14
15## `--yolo` has no floor
16
17`--yolo` approves everything, including in `$HOME` or `/`. There is no check
18that the directory is a git repository, so the documented undo does not exist in
19some of the places it will run. Refusing `--yolo` outside a repository (or in
20`$HOME`) would be a small change; it is deferred because the acceptance test runs
21in an empty temp directory.
22
23## `--list` reads every transcript
24
25Listing costs O(total bytes of all sessions), because it parses each header and
26counts messages. At current sizes this is milliseconds; a 200 MB session file
27makes it visibly slow. An index or a `--json` format would fix it.
28
29## `edit` loads the whole file
30
31`edit` reads the file, matches, and writes it back through a temporary file. On
32the 32-bit target a file near the address-space limit fails with an out-of-memory
33error rather than a clean refusal. A >32 MB file should be rejected up front with
34"too large for edit; use write".
35
36## Editor width is approximate
37
38The line editor counts one column per character, so wide (CJK) characters,
39combining marks and raw tabs (from a paste) mis-place the caret. The width is
40read once per prompt, so a resize mid-edit mis-renders.
41
42## No transcript viewer
43
44Reasoning is stored beside each assistant message for humans, but the only way to
45read it is `cat` on the JSONL. A `--show <id>` renderer would make auditing a
46`--yolo` run practical.
47
48## Approval state is per process
49
50Restarting the harness re-prompts for the first edit even when resuming a
51session. That is intentional (see CONTEXT.md), but it is worth knowing.
52
53## `--doctor` fails on an unlisted model
54
55If `GET /models` does not list the model id you use (some gateways only list a
56subset), doctor exits 1 even though a turn would work. `--doctor --probe` sending
57a one-token completion would test what actually matters.
58
59## Retry budget is fixed
60
61Four attempts, 1 s / 2 s / 4 s, no jitter, no per-status policy. A 429 for a
62model with a long reset window will still fail after ~7 s.
63
64## No per-turn summary
65
66The status line reports steps, time, tokens and allowance, but not what changed:
67no "3 files written, 5 commands run, 1 denied". For a `--yolo` run that is the
68summary you actually want.
diff --git a/docs/PLAN.md b/docs/PLAN.md
index 9be54fa..f22b230 100644
--- a/docs/PLAN.md
+++ b/docs/PLAN.md
@@ -31,17 +31,23 @@ line-mode, six tools. Built for understanding, not parity with anything.
31 unless `--yolo`. Prompts happen after the stream ends, never mid-token. 31 unless `--yolo`. Prompts happen after the stream ends, never mid-token.
32- **Turn/step.** A turn ends when the model answers with no tool calls, on user 32- **Turn/step.** A turn ends when the model answers with no tool calls, on user
33 abort, or on a non-retryable provider error. **No step cap** — the brake is the 33 abort, or on a non-retryable provider error. **No step cap** — the brake is the
34 step counter on the status line and Ctrl-C. 34 step number printed on every tool line, the allowance in the status line, and
35 Ctrl-C.
35- **Tool errors are data.** Failures, non-zero exits, and denials are returned to 36- **Tool errors are data.** Failures, non-zero exits, and denials are returned to
36 the model as results. Only transport/auth/process failures end a turn. 37 the model as results. Only transport/auth/process failures end a turn.
37- **Sessions.** Append-only JSONL of wire messages (see ADR 0002). No compaction, 38- **Sessions.** Append-only JSONL of wire messages (see ADR 0002). No compaction,
38 no truncation, no summarisation. Overflow is the provider's 400. 39 no truncation, no summarisation. Overflow is the provider's 400.
39- **Prompt.** Snapshot at session start: fixed system prompt, a 3-line 40- **Prompt.** Snapshot at session start: fixed system prompt, one environment
40 environment block (cwd, platform, git branch), and `AGENTS.md` from cwd up to 41 line (cwd, platform, arch, git branch), and `AGENTS.md` from cwd up to the git
41 the git root. Frozen for the session; mtime change prints a notice only. 42 root — never above it, and only the working directory outside a repository.
42- **UI.** Line-mode. ANSI only when stdout is a TTY. Plain `read_line` plus 43 Frozen for the session; the session records the starting directory and warns if
43 `/paste` (reads until a lone `.` or EOF). No alt-screen, no raw mode, no 44 resumed elsewhere; an mtime change prints a notice only.
44 history, no markdown rendering, no syntax highlighting. 45- **UI.** Line-mode. ANSI only when stdout is a TTY, and disabled by `NO_COLOR`
46 or `TERM=dumb`. A small raw-mode line editor: arrow-key history persisted to
47 disk, bracketed paste as one block, ctrl-a/e/u/k/w editing, ctrl-c abandons the
48 line, ctrl-d exits. Raw mode is on only while a prompt is being read, so Ctrl-C
49 during a turn stays a signal. No alt-screen, no markdown rendering, no syntax
50 highlighting.
45- **Ctrl-C.** SIGINT handler sets a flag; the stream loop closes the socket and 51- **Ctrl-C.** SIGINT handler sets a flag; the stream loop closes the socket and
46 ends the turn. Second Ctrl-C exits. 52 ends the turn. Second Ctrl-C exits.
47- **No model metadata.** No cost display, no pre-flight context check. Token 53- **No model metadata.** No cost display, no pre-flight context check. Token
@@ -163,30 +169,37 @@ Independently rebuilt and re-run outside the agent both times.
163## Layout 169## Layout
164 170
165``` 171```
166src/main.rs args, mode selection, exit codes 172src/main.rs args, mode selection, exit codes, /paste
167src/config.rs TOML-free config if possible; env precedence CLI > env > file 173src/config.rs precedence CLI > env > file; key source
168src/provider.rs request construction, ureq call, SSE parsing 174src/provider.rs request construction, retry, SSE parsing, model list
169src/session.rs id, JSONL append/load, replay 175src/session.rs id, JSONL append/load/replay, listing, permissions
170src/agent.rs turn/step loop, tool dispatch, approval hooks 176src/agent.rs turn/step loop, tool dispatch, approval hooks, prompt
177src/line.rs raw-mode line editor, history
178src/signal.rs SIGINT -> cancel flag
179src/doctor.rs --doctor checks
171src/tools/ read, write, edit, bash, grep, glob 180src/tools/ read, write, edit, bash, grep, glob
172src/ui.rs streaming render, diffs, approval prompt, status line, /paste 181src/ui.rs streaming render, diffs, approval prompt, status line
173tests/mock.rs mock provider over std TcpListener 182tests/mock.rs provider over std TcpListener (SSE, retry, truncation)
174scripts/check-glibc.sh 183tests/loop.rs agent loop, abort and repair invariants
184tests/tools.rs tool semantics and edge cases
185tests/sessions.rs session round-trip, listing, permissions
186tests/cli.rs argument validation and exit codes
187tests/doctor.rs --doctor against a mock provider
188tests/sse.rs decoder at every byte boundary
189tests/prompt.rs instruction scope
190scripts/check-glibc.sh, scripts/mock-provider.py
175``` 191```
176 192
177Input is kept behind a single `read_input() -> Option<String>` function so a 193## Settled against the live API
178raw-mode editor with history can replace it later without touching the loop. 194
179 1951. `stream_options: {"include_usage": true}` is honoured; usage arrives in the
180## Open questions to settle against the live API 196 chunk that carries `finish_reason`. ✅
181 1972. Accounting is nested: `usage.opencode.allowance` and `.list_cost`. ✅
182Blocked on a fresh `OPENCODE_API_KEY` (the stored one returns `api_key_expired`). 1983. `reasoning_content` is the delta field. ✅
183 1994. `x-opencode-session` is mandatory: without it the gateway answers 400
1841. Is `stream_options: {"include_usage": true}` honoured, and does usage arrive in 200 `MissingSessionID`. Any opaque stable id works. ✅
185 the final chunk? 2015. Two consecutive user messages are accepted, so a turn that failed after
1862. Exact shape and location of `opencode.allowance`; which unit it is in. 202 writing its prompt can be resumed without editing the transcript. ✅
1873. Is `reasoning_content` the delta field name across all reasoning models, or 2036. The default model accepted a 500k-token prompt, so overflow is rarer than
188 only DeepSeek-derived ones? 204 assumed. The exact limit is unknown and deliberately not modelled. ✅
1894. Does the gateway accept `reasoning_effort`, or is reasoning configured 2057. `reasoning_effort`: not sent; unverified.
190 elsewhere?
1915. Error body shape for context overflow, to map it to "start a new session".
1926. Whether `x-opencode-session` has format constraints (opaque vs UUID).