xonecas.io
64875
Mc

mini-coder / commit 1c06090

chore: remove AUDIT-REPORT.md

xonecas2026-03-21 1c06090992e5f37a5ce2cdac1695d5ca837d70f1 parent d76b814

1 file changed

AUDIT-REPORT.md+0−106
@@ -1,106 +0,0 @@
1-# Audit Report — mini-coder v0.2.0
2-
3-**Date:** 2026-03-21
4-**Auditor:** Automated audit via mini-coder audit skill
5-**Scope:** Full code review + multi-provider interactive/one-shot testing
6-
7----
8-
9-## Summary
10-
11-Reviewed all ~15K lines of TypeScript across 90 source files. Ran `bun run check` (303 tests pass, 0 lint/type/formatting issues). Tested 5 provider paths (zen/claude-haiku-4-5, zen/gemini-3-flash, zen/gpt-5.4-nano, zen/glm-5, anthropic/claude-haiku-4-5 via OAuth) in both one-shot and interactive tmux sessions. Exercised multi-turn tool use, model switching, ESC interrupt, `/new`, `/undo`, `/help`, `!` shell integration, and `listSkills`.
12-
13-**Overall assessment:** The codebase is well-structured, adheres closely to the core idea, and works correctly across all provider paths. The architecture is clean with good separation of concerns. The issues found are minor.
14-
15----
16-
17-## Code & Architecture
18-
19-### Correctness Issues
20-
21-1. ~~**`supportsThinking()` + haiku = 400 error**~~ **FIXED** (`24592bc`) — Zen claude models were sent the `effort-2025-11-24` beta format (`output_config: { effort }`) which Zen's proxy crashes on (HTTP 500: `"Cannot read properties of undefined (reading input_tokens)"`). Confirmed via direct curl probes: the legacy `thinking: { type: "enabled", budget_tokens: N }` format returns HTTP 200 on Zen. Fix: detect `zen/claude-*` models in `getAnthropicThinkingOptions` and use the legacy format wit …
22-
23-2. ~~**`autoTitleSession` overwrites title on every turn**~~ **NON-ISSUE** — `setSessionTitle` in the DB layer uses `AND title = ''` in the UPDATE predicate, so it only writes when the title is empty. The session title correctly stays as the first message.
24-
25-3. ~~**`maxOutputTokens` hardcoded to 16384**~~ **FIXED** (`19a9755`) — Added `max_output_tokens` column to `model_capabilities` (DB v6), parsing `limit.output` from models.dev. Propagated through `ModelCapabilityRow` → `RuntimeCapability` → `ModelInfo`. `buildStreamTextRequest` now calls `getMaxOutputTokens(modelString) ?? 16384`.
26-
27-4. ~~**DB lock / WAL file growth**~~ **FIXED** (`19a9755`) — Upgraded the startup checkpoint from `PASSIVE` to `TRUNCATE`, which zeroes the WAL file after applying writes. Same busy-safe wrapper; external readers still won't block startup.
28-
29-### Architecture Alignment with Core Idea
30-
31-- ✅ **Append-only scrolling log** — No redraws, strict hierarchy works correctly.
32-- ✅ **Shell-first tool surface** — `shell`, `listSkills`, `readSkill`, MCP, and optional web tools. Minimal and correct.
33-- ✅ **`mc-edit` exact-text edits** — Deterministic, well-tested (94 tests).
34-- ✅ **16 ANSI colors only** — Uses yoctocolors consistently, inherits terminal theme.
35-- ✅ **Status bar** — Shows model, session ID, git branch, thinking effort, token counts, context %.
36-- ✅ **Context pruning** — Rolling per-step pruning with Anthropic cache preservation. Well-designed.
37-- ✅ **Single system prompt** — No provider-specific branches. Works across all providers.
38-- ✅ **Community config standards** — AGENTS.md discovery, skills from `.agents/skills/` and `.claude/skills/`.
39-- ✅ **Session management** — SQLite-backed, with resume, list, new session.
40-- ✅ **MCP support** — StreamableHTTP with SSE fallback, stdio transport.
41-- ✅ **OAuth login** — Anthropic OAuth with PKCE flow.
42-- ✅ **ESC interrupt** — Works cleanly, preserves partial response in history.
43-
44-### KISS / DRY / YAGNI
45-
46-- **Good**: The codebase is lean. No unnecessary abstractions. Provider routing is simple prefix-based dispatch.
47-- **Good**: jscpd reports only 0.16% duplication (23 lines across 129 files).
48-- **Minor**: `turn-execution.ts` has substantial complexity in `StreamToolCallTracker` and `StreamTextPhaseTracker` for handling provider quirks (OpenAI commentary phases, synthetic tool call IDs). This is justified given the real provider differences, but the file is dense at ~300+ lines. Could benefit from a short doc comment explaining the overall stream normalization strategy.
49-- **Minor**: `cli/` module has 43 files — the largest module. Most are appropriately scoped, but the input handling is spread across 6 files (`input.ts`, `input-buffer.ts`, `input-completion.ts`, `input-control.ts`, `input-editing.ts`, `input-images.ts`, `input-loop.ts`). This is understandable for complexity management but makes the input pipeline harder to trace.
50-
51-### Things NOT in Known Issues Worth Noting
52-
53-- **No conversation summary on max context** — The pruning approach (`pruneMessages` from AI SDK) silently removes messages. When context is exhausted, the user gets a generic error. The known issues already track this.
54-- **`onError: () => {}`** in `turn-request.ts` — Correctly suppresses SDK's default `console.error()`. Errors still propagate through `fullStream` as `{ type: "error" }` chunks, which `mapStreamChunkToTurnEvent` handles by throwing. Not related to hangs.
55-
56----
57-
58-## UI/UX Alignment
59-
60-### Provider Comparison
61-
62-| Feature | zen/claude-haiku-4-5 | zen/gemini-3-flash | zen/gpt-5.4-nano | zen/glm-5 | anthropic/claude-haiku-4-5 (OAuth) |
63-| ---------------------- | -------------------- | ------------------ | ---------------- | --------- | ---------------------------------- |
64-| One-shot simple | ✅ | ✅ | ✅ | ✅ | ✅ |
65-| One-shot with tools | ✅ | ✅ | ✅ | N/T | N/T |
66-| Interactive multi-turn | ✅ | ✅ | ✅ | ✅ | ✅ |
67-| Tool calls displayed | Clean | Clean | Clean | Clean | Clean |
68-| Token tracking | Accurate | Accurate | Accurate | Accurate | Accurate |
69-| Context % | 3% | 0-1% | 1% | 3% | 5% |
70-| ESC interrupt | ✅ | ✅ | N/T | N/T | N/T |
71-| Model switching | ✅ | ✅ | ✅ | ✅ | ✅ |
72-
73-N/T = Not specifically tested in interactive mode, but one-shot works.
74-
75-### UI Observations
76-
77-- **Banner**: Clean, shows version, model, cwd, AGENTS.md, skill count. Matches spec.
78-- **Status bar**: Updates correctly after each turn. Token counts accumulate properly. Context window percentage is color-coded (green/yellow/red). Model and session ID always visible.
79-- **Tool rendering**: Shell commands show the command, exit code, and line count. Output is properly boxed with `│` prefix. Short outputs show inline (`out: hello world`). Long outputs get line-counted display.
80-- **`/help` output**: Lists all commands and all 20 skills with descriptions and source (global/local). Includes keyboard shortcuts.
81-- **Spinner**: Shows during thinking/tool execution. Clears cleanly on interrupt.
82-- **`/new`**: Clears screen and reprints banner — feels like a fresh start.
83-
84-### One Surprising Behavior
85-
86-- **`!` shell output stays local** — The `!echo "test"` shell integration runs the command and adds the output to history for the LLM, but doesn't trigger a model response. This is by design (spec says "sends the output to the llm as user message") but users might expect the LLM to comment on it. The current behavior is arguably better — it's like pasting context.
87-
88----
89-
90-## Recommendations
91-
92-### Code Changes
93-
94-1. ~~**Guard `supportsThinking()` more conservatively**~~ **RESOLVED** — Fixed by detecting `zen/claude-*` models and switching to the legacy `budget_tokens` API format, confirmed correct via curl probes against `opencode.ai/zen/v1`.
95-
96-2. ~~**Derive `maxOutputTokens` from model info**~~ **FIXED** (`19a9755`) — See item 3 above.
97-
98-3. ~~**Add a brief architecture comment at the top of `turn-execution.ts`**~~ **FIXED** (`19a9755`) — 6-line block comment added explaining `StreamToolCallTracker` and `StreamTextPhaseTracker`.
99-
100-### Polish
101-
102-4. ~~**Status bar: `showReasoning` in signature**~~ **FIXED** (`HEAD`) — Removed `showReasoning` from `StatusBarData`, `RunnerStatusInfo`, and `buildStatusBarSignature`. Toggling `/reasoning` no longer triggers a spurious status bar redraw.
103-
104-5. ~~**Shell tool truncation**~~ **FIXED** (`19a9755`) — Truncation now snaps to the last `\n` in the partial chunk, preventing broken mid-line cuts.
105-
106-6. ~~**WAL file growth**~~ **FIXED** (`19a9755`) — See item 4 above.