Commit graph

2 commits

Author SHA1 Message Date
sid
e0db651781 test(planctl): parseLastUsage 10 MB buffer regression tests (pre-PR fix)
Pre-PR codex review flagged missing coverage for the 10 MB scanner buffer
called out in design §3.5. Adds:
- TestParseLastUsage_largeLine: 5 MB JSONL line with inert padding still
  extracts the usage object correctly (no silent truncation).
- TestParseLastUsage_oversizedLineErrors: 11 MB line surfaces a scanner
  error cleanly (no panic, nil usage).

Follow-up to parent 1.0, dev/plans/26174-planctl-context-tokens/tasks.md.
2026-04-23 18:59:52 -06:00
sid
935b86b791 feat(planctl): context-window token awareness — core (parent 1.0)
- TokenCtx + Classify + formatTokenCount (R2.2, R3.1-3.5, R4.4)
- ReadTokenCtx orchestrator: env > PID walk > transcript parse (R1.1-1.6, R2.1-2.6)
- parseLastUsage: 10MB scanner, JSONL last-assistant-wins, zero-usage qualifies (R2.1-2.3)
- parsePIDFile: strict two-line layout; rejects partial/corrupted writes (R6.2-6.3)
- resolveViaPIDWalk: 8-hop ancestor walk, liveness + start-stamp check (R1.2, R6.1, R6.3)
- proc_darwin.go (x/sys/unix kinfo_proc) + proc_linux.go (/proc/stat field 22)
- parseStatStartTime: platform-agnostic, handles comm with parens/spaces

Parent 1.0 from dev/plans/26174-planctl-context-tokens/tasks.md
2026-04-23 17:38:37 -06:00