Skip to content

feat(acp): resume sessions and route side calls natively - #239

Merged
anthonyhaussman merged 13 commits into
mainfrom
tone/feat/acp-native-feel
Dec 1, 2026
Merged

anthonyhaussman merged 13 commits into
mainfrom
tone/feat/acp-native-feel

Conversation

@anthonyhaussman

Copy link
Copy Markdown
Owner

Description

Stacked on #238 (tone/feat/remove-google-agy).
Merge that one first.

Session resume

Resume the stored agy session with session/resume after a process restart, as long as the configuration fingerprint matches and the last turn finished cleanly.
Only new messages are sent, so the prompt cache survives a restart: a live run resumed with 44,555 cached read tokens and no checkpoint replay.
If agy cannot resume the session, the provider opens a new one and replays the history.

Side calls

Requests whose model.request kind is not primary, such as title generation, now run in a separate agy session that is closed afterwards.
They no longer add turns to the user's main agy session.

Context use

Tool-call steps now report the latest agy usage_update as input tokens instead of zero.
This lets OpenCode's context meter and compaction work during a turn.

Rate limit errors

agy's 429 retry lines are no longer streamed as chat text.
When agy gives up, the provider raises one rate_limited error and marks the turn interrupted.

Tool-result images

Image tool results (image-data, media, image file-data) now reach agy as MCP image content through the bridge, and as ACP image blocks when the result arrives late.
Other inline files are still replaced by a text note.

Out of scope

Closing the agy session when an OpenCode session is deleted, and prewarming a session, are not included because OpenCode exposes no plugin hook for either.
The idle timer already stays alive while OpenCode runs tools.
The context limit stays at 1,048,576 tokens, which matches agy's reported size, and cost stays at $0.

@anthonyhaussman anthonyhaussman self-assigned this Nov 30, 2026
@anthonyhaussman
anthonyhaussman force-pushed the tone/feat/acp-native-feel branch from cbb6fb4 to dbcae8d Compare December 1, 2026 07:02
Base automatically changed from tone/feat/remove-google-agy to main December 1, 2026 17:57
@anthonyhaussman
anthonyhaussman marked this pull request as ready for review December 1, 2026 17:57
Resume the stored agy session with session/resume when a new
process starts and the fingerprint matches, so history is not
replayed and the prompt cache survives. Falls back to session/new
with full replay when resume fails or the last turn was interrupted.

Assisted-by: Claude Opus 5.5
OpenCode tags each model request with a kind. Non-primary kinds
such as title now use a throwaway agy session, so they never
reset or pollute the stored primary conversation.

Assisted-by: Claude Opus 5.5
Tool-call steps finished with zero usage, so the OpenCode context
gauge and compaction stayed blind mid-turn. Use the latest
usage_update context size as input tokens until agy reports usage.

Assisted-by: Claude Opus 5.5
agy reports quota exhaustion as chat text. Drop its retry notices
and turn the final give-up line into a rate_limited error.

Assisted-by: Claude Opus 5.5
Image parts of OpenCode tool results now reach agy as MCP image
content, and as ACP image blocks for late results. PDFs and other
attachments become short text notes instead of type placeholders.

Assisted-by: Claude Opus 5.5
OpenCode points the model at truncated tool output under its
tool-output dir; agy asks permission for that read_file and the
policy rejected it. Allow reads that resolve inside that dir.

Assisted-by: Claude Opus 5.5
When agy ends a turn without finishing a provider-executed call,
emit an error tool result so OpenCode does not fail the step.

Assisted-by: Claude Opus 5.5
OpenCode 2.4 saves truncated shell output under its shell dir,
not tool-output, so agy reads there were still rejected.

Assisted-by: Claude Opus 5.5
agy rewrites one shared bridge schema cache on every tools/list,
so title and compaction side calls listing no tools wiped the
main session schemas. Side calls now list the last tool list
and refuse every call.

Assisted-by: Claude Opus 5.5
Title and compaction side calls now append a text-only
instruction, so agy writes the summary OpenCode expects
instead of looking up tool schemas.

Assisted-by: Claude Opus 5.5
agy model ids now carry the thinking level, and selecting one
sets thought_level, so low/medium/high variants were redundant.

Assisted-by: Claude Opus 5.5
agy can end a turn with reasoning only, which OpenCode took as
an empty answer and compaction rejected. Side calls retry once
in a fresh agy session, other turns get an empty_reply error.

Assisted-by: Claude Opus 5.5
OpenCode can send compaction with another agent's system prompt,
so agy kept doing that agent's work. Compaction side calls now
start the system prompt with a summary-only instruction.

Assisted-by: Claude Opus 5.5
@anthonyhaussman
anthonyhaussman force-pushed the tone/feat/acp-native-feel branch from b96a101 to 24d062c Compare December 1, 2026 18:04
@anthonyhaussman
anthonyhaussman merged commit 5d92066 into main Dec 1, 2026
3 checks passed
@anthonyhaussman
anthonyhaussman deleted the tone/feat/acp-native-feel branch December 1, 2026 18:05
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