Skip to content

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

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

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
Contributor

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

2 participants