已关闭
[MVP-05] Implement Telegram ingress, commands and durable delivery #8
urandon创建于  7月28日关闭于  7月30日
urandon
urandon成员
7月28日 创建

Parent and architecture

  • Implementation epic: #6
  • Architecture: #1
  • Depends on: #4, #5, #7, #16

Outcome

Implement the Go Telegram-facing control plane that durably accepts updates, exposes MVP commands and reliably delivers results without executing AI work inline.

Estimate

  • 8 SP / 5 engineering days
  • Risk: medium

Scope

  • Implement HTTP webhook endpoint and X-Telegram-Bot-Api-Secret-Token validation.
  • Parse private-chat messages, images/files and supported commands; explicitly reject/defer group behavior.
  • Map Telegram identities to opaque internal tenants using the distributed identifier contract from #16.
  • Persist update/run/dispatch-outbox atomically and return 2xx only after durable commit.
  • Implement /connect codex, /compute status, /compute disconnect codex state flows behind interfaces; provider login execution may remain fake until the Codex adapter task.
  • Implement Telegram delivery outbox consumer/sender with retry classification and rate-aware behavior.
  • Record Telegram request/response metadata without logging message contents or secrets by default.
  • Implement explicit clean-context command semantics using a new context epoch, not history deletion.

Failure cases

  • Duplicate/reordered updates.
  • Telegram retry after response loss.
  • File metadata fetch/download failure.
  • Telegram rate limit or transient 5xx.
  • Stale delivery after run cancellation/context reset.

Acceptance criteria

  • Duplicate update_id produces one durable run and at most one logical reply.
  • Attachments are stored under validated tenant/chat prefixes and referenced by manifest.
  • The webhook returns promptly without waiting for a worker.
  • Delivery failures remain retryable through the durable outbox.
  • Two private-chat fixtures prove isolated state and correct recipient routing.
  • Default tests use the Telegram fake; no live bot token is required.
  • Tenant, run and outbox identifiers satisfy the #16 distribution contract and do not create a monotonically increasing hot key.
likedislike
urandonurandon成员
7月29日 修改了issue 的描述
urandon
urandon成员
7月29日 评论:

Implementation sequencing update

This is the next implementation task after MVP-03A. The working branch ai/mvp-05-telegram-ingress has been created from the bounded MR !8 correction.

No Telegram domain changes will be published on top of a red schema baseline: issue #16 remains the hard dependency until the corrected native YDB inspection passes in the GitHub mirror. Once !8 is green/merged, this branch will be rebased onto main and implementation will proceed with the webhook, identity mapping, attachment storage, command flows, and durable delivery outbox.

likedislike
urandonurandon成员
7月29日 关联了pull request:MVP-05: add durable Telegram ingress and delivery
urandon
urandon成员
7月29日 评论:

Implementation update — Telegram ingress and durable delivery

The first MVP-05 vertical slice is published in MR !9, branch ai/mvp-05-telegram-ingress, commit 6627bac.

Delivered

  • authenticated private-message webhook ingress with constant-time secret-token verification;
  • opaque HMAC-derived tenant, actor, conversation, and subscription IDs that are stable across replicas and isolated per chat;
  • text/photo/document normalization, bounded Telegram getFile downloads, tenant-prefixed Object Storage keys, and input manifests;
  • atomic YDB update deduplication plus run, attempt, input manifest, and dispatch outbox;
  • a real control-api webhook route and fail-closed secret/config construction;
  • bucketed durable delivery traversal, serializable claims, two-minute visibility-timeout crash recovery, exponential retry, and terminal states;
  • Telegram sendMessage/sendDocument adapter and a real telegram-sender process;
  • local Telegram fake file APIs, Compose wiring, integration coverage, README update, and a public Telegram runbook.

Local verification

  • make ci passed;
  • YDB and local-integration tagged packages compile;
  • git diff --check and shell syntax checks passed.

Docker is unavailable on the development workstation, so MR !9 remains dependent on mirrored GitHub Actions for real YDB Local, MinIO, Telegram fake, Compose, and image verification.

Issue #8 intentionally remains open. The subscription commands (/connect codex, /compute status, disconnect) and explicit clean-context command are not claimed by this MR and will be implemented next on the same MVP-05 line.

likedislike
urandon
urandon成员
7月30日 评论:

Merge verification — first MVP-05 slice

MR !9 is merged into main as 74d9a3e. The merge contains the CI-fix commit e083de9.

The exact mirrored SHA e083de9a2767842ba4aaf59e1e090c15890fb9c3 passed GitHub Actions run 30469363810:

  • Go verification — passed;
  • YDB schema and state store — passed, including repeatable migrations and the delivery ready-index regression;
  • Local multi-service stand — passed, including initialization, Telegram webhook deduplication, persistent stop/restart, and guarded volume reset;
  • Runtime images — passed.

This completes the authenticated private-message/file ingress and durable delivery slice, including the post-failure corrections for delivery visibility-index cleanup and Docker-local YDB endpoint selection.

Issue #8 deliberately remains open. The following original scope is not part of MR !9 and still needs a follow-up implementation slice:

  • /connect codex;
  • /compute status;
  • /compute disconnect codex;
  • the explicit clean-context command and context-epoch transition.

No full MVP-05 completion claim is made until those flows and their acceptance coverage are merged.

likedislike
urandonurandon成员
7月30日 关联了pull request:MVP-05: add durable Telegram subscription and context commands
urandon
urandon成员
7月30日 评论:

Remaining MVP-05 scope implemented

The subscription and clean-context command slice is published in MR !10, branch ai/mvp-05-telegram-commands, commit 8a5bbbd.

Implemented:

  • /connect codex, /compute status, /compute disconnect codex, and /new;
  • unsupported slash commands resolve to durable help instead of AI dispatch;
  • atomic Telegram-update deduplication + subscription/context mutation + terminal command run + inline delivery outbox;
  • exactly-one context-epoch advancement without deleting Telegram history;
  • command runs create no worker attempt or dispatch outbox;
  • connect stores no credential and enters reauthentication_required until the isolated Codex authorization adapter exists;
  • disconnect clears credential references and enables no API-call billing fallback;
  • the local Compose stand now runs telegram-sender and verifies command replies through Telegram fake;
  • public README and architecture/runbook documentation updated in English.

Local verification passed: make ci, both tagged integration compile gates, shell syntax validation, and git diff --check.

Issue #8 remains open until the GitCode branch reaches the GitHub mirror and all mandatory jobs prove the exact commit against YDB Local, the multi-service stand, and runtime image builds.

likedislike
urandon
urandon成员
7月30日 评论:

Command-slice verification complete

The exact MR !10 head SHA 8a5bbbd8f758ee1ba2a00f32054490f577de44e3 passed GitHub Actions run 30474639513.

Go verification, YDB integration, the two-pass local multi-service stand with durable Telegram command replies, and runtime image builds are all green. The remaining MVP-05 implementation and verification scope is complete; issue #8 remains open only until MR !10 is merged into main and the merge is read back.

likedislike
urandon
urandon成员
7月30日 评论:

Completion report — MVP-05

MVP-05 is complete across MR !9 and MR !10.

MR !10 was merged into main as 85b94ce83ca3ed05a04eaff09f63ea1745676612. Its tree (92f0af2540baccbb209b65bd74c75ee77a53666b) is identical to the validated branch commit 8a5bbbd8f758ee1ba2a00f32054490f577de44e3.

The exact implementation tree passed GitHub Actions run 30474639513:

  • Go verification;
  • YDB schema and state store;
  • local multi-service stand, including stop/restart;
  • runtime images.

Delivered behavior:

  • authenticated, idempotent Telegram text/file ingress with tenant-scoped blobs;
  • durable Telegram delivery with retry and crash recovery;
  • /connect codex, /compute status, /compute disconnect codex, and /new;
  • atomic command state plus inline delivery, with no AI dispatch for commands;
  • explicit context epochs without deleting Telegram history;
  • no stored plaintext credential and no API-billing fallback.

The GitHub main mirror had not yet propagated merge commit 85b94ce at closure time, so the evidence above deliberately names the validated source commit and identical merge tree rather than claiming a post-merge mirror run.

likedislike
urandonurandon成员
7月30日 关闭了 issue
urandonurandon成员
24 天前 添加了label:mvptelegram
urandonurandon成员
24 天前 关联了里程碑:MVP — Core platform (#6)