Skip to content

Recreate Telegram ACP session when the child has died - #72

Closed
strk-ai-agent wants to merge 1 commit into
ominiverdi:mainfrom
strk-ai-agent:fix/acp-recreate
Closed

Recreate Telegram ACP session when the child has died#72
strk-ai-agent wants to merge 1 commit into
ominiverdi:mainfrom
strk-ai-agent:fix/acp-recreate

Conversation

@strk-ai-agent

Copy link
Copy Markdown

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.

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 --noEmit clean.

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
@ominiverdi

Copy link
Copy Markdown
Owner

Closing under the updated contribution policy. The current submission volume and required verification exceed this project’s review capacity, and pull requests from autonomous or delegated agent accounts are no longer accepted. Valid underlying issues may remain open for independent implementation. Please do not revise, reopen, or replace this pull request.

@ominiverdi ominiverdi closed this Aug 10, 2026
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.

3 participants