Release 0.0.166: reliable JSONL logging (#86) + compaction-failure recovery (#88) - #90
Merged
Conversation
…ures (#88) #86 — HttpConnectionClosing retries + corrupted trajectory log: - writeJsonLine(): serialize each trace/trajectory record to memory, then write the whole line in one shot. A partial serialization no longer leaves a half-record + leftover buffer bytes for the next record to concatenate onto, so harness.trace/trajectory.jsonl stay valid JSONL even when a write errors mid-record. - back off between transport-flake retries (was zero delay → 3 instant re-fails) and allow one more attempt. - preserve the real network error in last_api_error on give-up, and write an adjacent {"kind":"turn_error"} record so the failure reason survives in the archive instead of only ok:false. #88 — compaction can fail/skip silently, leaving huge context: - compactOrRecover(): never swallow a compaction failure silently; on failure emergency-trim the history at a safe user-turn boundary so the session can't wedge at a huge token count with every tiny follow-up turn failing. - also attempt compaction after a *failed* turn (context-overflow recovery), not only after successful ones. Unit tests for writeJsonLine, cleanUserTurn, emergencyCutIndex. Bump GUI to 0.0.166. Out of scope: #89 (deepseek reasoning-budget) is a gateway-side change, not this harness; #75 collapse and #85 mouse-select auto-copy need an alt-screen TUI rewrite; #74/#78/#79 already shipped in 0.0.165.
…odel auth prompt - New OpenAI-compatible providers fugu (api.sakana.ai) and fireworks (api.fireworks.ai) with model tables; SDKs regenerated (54 models). - graff --version now prints a short what's-new changelog. - /model on a keyless provider offers OAuth login or key paste instead of a dead-end (offerProviderAuth).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TUI/harness fixes for two backend correctness bugs, plus the GUI version bump to 0.0.166. All changes are in
src/main.zig(the Zig harness); the GUI ships the embedded harness, so it gets the fix via the version bump.#86 — HttpConnectionClosing retries give up turn & corrupt trajectory log
Tracer.write/Trajectory.writeLockedserialized JSON directly into the shared buffered file writer andcatch returnon a partial serialize — leaving a half-record plus leftover buffer bytes that the next record concatenated onto (exactly the reported{"text":"You ar{"kind":…garbage). NewwriteJsonLine()builds the whole line in memory first, so a failed write emits nothing and the file stays valid JSONL. Both writers route through it.last_api_errorto the real transport error (was stale/null), and write an adjacent{"kind":"turn_error", "parent":<turn>, "detail":…}archive record so a failed turn's reason survives instead of justok:false.#88 — compaction can fail/skip silently, leaving huge context
compact()'s own summarization request overflows too and fails — and that failure was swallowed (error.ApiError => {}), so the session wedged and every tiny follow-up failed at the same token count.compactOrRecover()surfaces the failure (no more silent skip) and, as a backstop, emergency-trims history at a safeuser-turn boundary (emergencyCutIndex/cleanUserTurn, which correctly refuses an anthropictool_result-only user message as a cut point). Compaction is now also attempted after a failed turn (context-overflow recovery), not only after successful ones.Testing
writeJsonLine,cleanUserTurn,emergencyCutIndexincl. the tool_result-boundary case).zig build+zig build testgreen.turn_errorrecord carrying the preserved error detail.Not in this PR (scope)
gateway.codegraff.com), not this harness — the harness already sendsreasoning_effortand degrades gracefully when rejected.Follow-up (not part of the reported bug)
Agent.emit/guiEmit(the--json/GUI stdout writers) still use the old hand-rolledStringify → writeByte('\n') → flushpattern straight into sharedg_out, so they carry the same #86 torn-write risk. Left out here because it's a hot path (printDelta → emitper streamed chunk) — doing it right needs a shared scratch buffer underg_gui_mu, not a per-call allocation. Worth a focused follow-up.Fixes #86. Fixes #88.