Recreate Telegram ACP session when the child has died - #72
Open
strk-ai-agent wants to merge 1 commit into
Open
Conversation
Telegram's processQuery catches prompt errors and replies with a generic processing message, but the dead ACPClient is left in the in-memory session map. Every subsequent message then keeps failing against the same closed stdio pipe until the bridge restarts. Detect ACP process death (process exit, broken pipe, stdio already destroyed, JSON-RPC send failure) via the new isACPClientDeadError helper. When matched, call recreateACPSession for the thread so the next message is served by a freshly spawned opencode acp child. Transient backend errors are still surfaced as a generic failure; the recovery only fires when the underlying child process is gone. Assisted-By: MiniMax-M3
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.
Telegram's
processQuerycatches prompt errors and replies with a generic processing message, but the deadACPClientis left in the in-memory session map. Every subsequent message then keeps failing against the same closed stdio pipe until the bridge restarts.Detect ACP process death (process exit, broken pipe, stdio already destroyed, JSON-RPC send failure) via the new
isACPClientDeadErrorhelper. When matched, callrecreateACPSessionfor the thread so the next message is served by a freshly spawnedopencode acpchild.Transient backend errors are still surfaced as a generic failure; the recovery only fires when the underlying child process is gone.
This branch is independent of #PR1 and #PR2: it uses only existing public surface (
recreateACPSession,createSession,sendReply) plus a new local helper. Safe to review and merge in any order.Tests:
bun test ./tests/unit/telegram-attachments.test.ts ./tests/unit/telegram-rate-limit.test.ts ./tests/unit/telegram-thread-context.test.ts— 66 pass, 0 fail.tsc --noEmitclean.