Skip to content

0.5.0: review fixes for the Thread / Turn / Item API - #1

Merged
NoHarry merged 40 commits into
mainfrom
codex/api-redesign
Nov 7, 2026
Merged

NoHarry merged 40 commits into
mainfrom
codex/api-redesign

Conversation

@NoHarry

@NoHarry NoHarry commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Fixes from the review of the 0.5.0 public API redesign (dc90409, already on main), before releasing 0.5.0.

  • Public API before the freeze: thread option patches keep saved defaults, settings() no longer resets limits(), stability markers, AgentRuntime in agent-api, named turn error codes, internal assembly and VFS helpers, migration guidance.
  • Turns: turn ids separate from execution attempts, steering binds a question only when asked to, repeated provider tool-call ids, denied or expired approvals continue the turn, a new approval policy applies to the running turn, a web host approved in a turn is not asked again in it.
  • Storage and privacy: complete thread deletion across runtimes (event log, SQLite, run records), damaged files no longer block listing or deletion, JSON-aware redaction that keeps tool JSON valid and leaves answers as written, image blobs and per-turn snapshots, history limits that count images but keep the newest run.

./gradlew apiCheck ciCheck passes locally (1,848 tests). The design, handoff and review notes are in docs/design/.

🤖 Generated with Claude Code

NoHarry and others added 30 commits November 6, 2026 23:01
Preserve the review handoff before grouped repairs; keep Bothy phone and location filtering disabled as explicitly requested.

Co-Authored-By: Codex <[email protected]>
Keep basic loop budgets stable and advanced tuning and event payloads experimental. Expose durable log creation through SessionEventLogs instead of a plugin-named JVM facade.

Validated with apiDump, ciCheck, Bothy compilation and independent review.

Co-Authored-By: Codex <[email protected]>
Treat null resume options as unchanged, allow explicit override resets, and retain limits when settings only change advanced behavior. Cover saved approval policy and model request behavior across runtime recreation.

Validated with apiDump, ciCheck, Bothy compilation and independent review.

Co-Authored-By: Codex <[email protected]>
Move AgentRuntime and its diagnostic contracts to agent-api. Keep construction and runtime inspection in agent-runtime, with Kotlin companion extensions and the existing Java create factory.

Verified API-only consumers, Kotlin/Java factories, module boundaries and API dumps; independently reviewed.

Co-Authored-By: Codex <[email protected]>
Remove workspace ports, hook registration records, VFS implementation helpers and the generated completion-gate overload from host API. Retain the public builder and VFS entry points.

Validated API boundaries and affected runtime tests; independent review caught and corrected the stale public inventory.

Co-Authored-By: Codex <[email protected]>
A host that changes a thread's policy (Bothy's approval mode switch) while a turn waits for an approval now has
that approval decided by the new policy, and later approvals in the same turn follow it too. Thread turns no
longer let the network backend remember hosts on its own, so remembered areas have one owner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approvals now wait inside the turn, so the scheduling tests check that a waiting approval keeps its execution and
queues the thread's next turn, that concurrent responses cannot start a second execution, and that interrupting or
replacing an approved turn cannot revive it, instead of the old release-and-resume path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
resumeThread wrote the thread's metadata file on every call. It now writes only when the merged options differ
from the saved ones, and startThread/resumeThread say in their KDoc that they do this small I/O before returning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
NoHarry and others added 10 commits November 7, 2026 01:34
…hes the model as cancelled

A turn's history is saved with the call shown as waiting before the approval wait starts. When the process died
during that wait, or a newer turn of the same thread replaced it (whose start makes the older run's own record a
no-op), the next turn's model still saw the call as waiting. A run now closes such calls in the history it starts
with: no earlier run of the same session can still be waiting then.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…story

Counting images toward the history guard made trimming drop every run, the one just finished included, once a turn
carried more than half the guard in images (about 2 MB by default): the next turn's model had no context. Earlier
runs now lose their images first, then the oldest runs go, and the newest run always stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er blocks deleting threads

Deleting a thread read every other run's record to learn its owner and refused when one could not be read (a
record cut short by a killed process, or one from an older version), so no thread could be deleted again. Such a
record now belongs to nobody and is left to retention. Once an event-log writer's writes had failed, every later
deletion refused too, often when disk was full and deletion was what the user needed; a writer that failed has
stopped writing, so deletion goes ahead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steering accepted while an approval waited was lost when the approval expired: the turn ended, the input was never
consumed and the next turn's model never saw it. A voice host that talks instead of tapping the card hit this
often. Expiry now works like a denial: the call does not run, the model gets a CONFIRMATION_EXPIRED result and
the queued input, and the tool item is DECLINED.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t turn

Giving thread turns a single owner for remembered areas also dropped the network backend's per-run memory, so under
ASK every fetch from the same host in one turn asked again. The thread now remembers, for the rest of the turn, the
web hosts the person approved; other areas are still asked each time. The policy decisions moved into one function
so they can be tested on their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… JSON

MCP text content often carries a JSON document as a string. Filtering that string as text let the secret pattern
take a key's closing quote and value but leave its opening quote, so a host that parsed the text after a restart
got invalid JSON. Such a string is now parsed and filtered structurally, then written back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… fixes

- Deleting a thread now waits until nothing an event-log writer accepted can still reach storage. A writer refusing
  new events because its queue was full keeps writing, so letting deletion go ahead on any failure (the previous
  commit) could write a deleted thread's events back.
- A message that was only images keeps "[image omitted]" when an earlier run loses its images: Anthropic refuses
  empty content, which failed every later turn of the conversation.
- Only the person's own yes to a web host carries over for the rest of the turn; one a policy gave ends with it.
- Stored tool payloads nested past 64 levels are filtered as text instead of parsed, so a hostile document cannot
  exhaust the stack.
- CHANGELOG: phone filtering applies to string values; numbers stay numbers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@NoHarry
NoHarry merged commit 3e9b212 into main Nov 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant