Skip to content

feat: support asynchronous Telegram requests with status and cancellation - #36

Merged
boly38 merged 5 commits into
mainfrom
dev/issue-31-async-telegram-requests
Oct 24, 2026
Merged

boly38 merged 5 commits into
mainfrom
dev/issue-31-async-telegram-requests

Conversation

@boly38

@boly38 boly38 commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Closes #31

Overview

This PR turns long-running Telegram prompts into durable, trackable requests. Users receive an immediate request card, can monitor or control active work, and get the final answer separately. Request metadata supports safe recovery after a bridge restart without storing prompt or response text or blindly resubmitting work.

Telegram controls and commands

  • /status [reference] — inspect the active request or a previous request from this chat. For an active request, the result is added to its request card with a timestamp; status-check entries disappear after three minutes.
  • /cancel [reference] — cancel the active request or one identified by its reference. Submitted work is aborted through OpenCode, and the chat remains busy until the stop is confirmed.
  • /abort — stop the active request; alias for /cancel.
  • /allow [letter] — approve a pending permission once (the default).
  • /allowAll <letter> — remember an eligible permission rule.
  • /deny [letter] — reject a pending permission.

The active request card also provides Status and Abort buttons, plus explicit permission-decision buttons when needed. Permissions are never approved automatically.

Scope by commit

feat: support durable asynchronous Telegram requests (#31)

Accept and acknowledge requests before background processing, assign each request a reference, prevent overlapping requests in one chat, and persist lifecycle/correlation metadata for deduplication and safe recovery. Prompts and responses are not stored in the request database.

feat: improve long-running Telegram request tracking

Monitor OpenCode asynchronously, retry transient status/history timeouts, and show safe progress, elapsed time, observed usage, and tool summaries. The default request limit is five days; on timeout the bridge requests an abort and does not release the chat until OpenCode confirms it stopped.

feat: add Telegram permission controls

Surface pending permissions for the active request and its child sessions. Let the user make an explicit one-time, remembered-eligible, or reject decision through commands or request-card buttons.

feat: improve Telegram request card lifecycle

Keep progress, controls, timestamped status checks, and permission requests on the original acknowledgement card. On completion, replace the active card with a summary and send the model's final answer separately.

feat: expire Telegram status checks

Remove status-check entries from the request card three minutes after they were added. This affects only the requested status-check history, not the live progress shown while the request is running.

Validation

  • make test — 126 tests passed.
  • python3 -m compileall -q bot/telegram/bloc_bridge — passed.
  • git diff --check — passed.
  • No live Telegram/OpenCode end-to-end test was run.

Benefits for users

  • Users get an immediate acknowledgement instead of waiting for a long task to finish.
  • They can see whether work is progressing, ask for its status, or request that it stop.
  • The bot avoids starting overlapping work in the same chat and can safely recover after a restart.
  • Permission decisions remain under the user's control, and the final answer stays easy to find.

Created by an LLM using the OpenCode harness and the GPT-6 Luna model.

@boly38
boly38 force-pushed the dev/issue-31-async-telegram-requests branch from eaea717 to 70859e5 Compare October 24, 2026 14:24
@boly38
boly38 merged commit 1215938 into main Oct 24, 2026
1 check passed
@boly38
boly38 deleted the dev/issue-31-async-telegram-requests branch October 24, 2026 14:29
@boly38 boly38 added this to the v1.0.2 milestone Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support asynchronous Telegram requests with status and cancellation

1 participant