Skip to content

fix(telegram): edited-caption history test fails on every changed-extensions run - #199169

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/telegram-edited-caption-history
Nov 14, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/telegram-edited-caption-history

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Related: #189231

What Problem This Solves

Fixes: extensions/telegram/src/send.history.test.ts > "refreshes authoritative edited captions without hiding later group history" fails on every run on main, which turns any PR that triggers the changed-extensions shards red (for example #198489, which only touches scripts/e2e, docs and package.json). Main's own CI does not run those shards, so main looks green.

User Impact

No user-visible change. PRs that select the changed-extensions shards stop failing on this test.

Why This Change Was Made

The test was wrong; the product behavior is the one #189231 intended.

6274d9e (#189231) made resolveTelegramProviderObservedThreadSpec return { scope: "none" } when no topic was requested and a supergroup message has message_thread_id without forum proof (is_topic_message or chat.is_forum). That is how Telegram shapes a reply chain in a non-forum group. The PR names the edit path as a target: "This covers every outbound recorder, including the edit path". editMessageTelegram derives its thread from the edited message, so an edit response without forum proof is now recorded as an explicit topicless correction, and the message cache drops it from topic history by design (see "persists an explicit topicless correction" in message-cache.retained.test.ts).

The failing case sends to topic 77 and then edits the message, but its fixture message had message_thread_id: 77 with no forum proof. Its edit response therefore had exactly the non-forum reply-chain shape #189231 fixed, so the edited message 902 left topic 77 history. Telegram marks messages in a forum topic with is_topic_message: true.

Changes, all in extensions/telegram/src/send.history.test.ts:

No product code changed.

Evidence

Head: 859770fce302c449b6da757e944e01a3ff36e0d3, on base 210458b3d434db20073789863d9e493a54217358. Red was reproduced on da85264b9eab47c6e1aba4ddbd43e3e396d66344. The two main commits since then (#199098, #199138) touch no Telegram code.

  • Red on unmodified main (da85264b9ea): node scripts/run-vitest.mjs extensions/telegram/src/send.history.test.ts gives 1 failed / 28 passed, with the same assertion as CI job 132555493862 (expected 902 then 903, received only 903).
  • Breaking commit: reverting only the provider-thread-proof.ts hunk of 6274d9e on main makes the original test pass (29/29).
  • Green on this head: send.history.test.ts gives 30/30 passed (rerun on 859770fce30 after the rebase).
  • Red for the new guard: with the same 6274d9e hunk reverted on this head, the new case fails (expected [] to match object [ { messageId: '902', … } ]), and the forum case still passes.
  • Neighbors: outbound-message-context, message-cache, message-cache.retained, message-cache.conversation-context, send.telegram-http, send.caption-checkbox.telegram-http, send.literal-fallback.telegram-http, send.recovery.telegram-http, thread-spec, bot.create-telegram-bot.history and action-progress-edit.telegram-http all pass.
  • node scripts/check-changed.mjs (lane extensionTests: tsgo:extensions:test, oxlint, format, ratchets, dead-export scan): exit 0, with no type or lint errors.
  • Test-file audit: every case, helper and import in send.history.test.ts is still used. Temp state comes from the HTTP fixture's media dir, each case gets its own session store path, and mocks and the database are reset in afterEach. Nothing was pruned.

Not run: live Telegram proof of forum-topic edit responses. The forum fixture uses the documented Bot API is_topic_message field and was not observed against a live forum.

The edited-caption history case sent to topic 77 and then edited the
message, but its provider responses carried message_thread_id without
is_topic_message or chat.is_forum. Since openclaw#189231, an edit response shaped
like that is classified as a non-forum reply chain and recorded as
topicless, so the case failed on main.

Mark the fixture as a forum topic message the way Telegram does, and add
an edit-path guard that a non-forum reply-chain edit stays in unthreaded
group history.
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS labels Nov 14, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 088178a into openclaw:main Nov 14, 2026
104 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/telegram-edited-caption-history branch November 14, 2026 20:29
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds forum-topic proof to the edited-caption fixture and checks that non-forum edits remain in unthreaded group history.

Example: The caption-history test edits message 902 in topic 77 while later message 903 remains visible.

  • Before: The fixture lacks forum proof, so the intentional classifier treats edited message 902 as unthreaded and the topic-history assertion fails.
  • After: The fixture includes is_topic_message: true, preserving both messages in topic 77; a separate case protects unthreaded reply-chain edits.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A correct, narrowly scoped test repair supported by production-path integration coverage, reported negative controls, and green exact-head CI.
Proof confidence 🦐 gold shrimp (3/6) Only tests change; supplied validation exercises the production edit recorder with a real transport client against local HTTP responses and SQLite, so live Telegram proof is unnecessary for this scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Otherwise unrelated PRs can fail Telegram history validation because a forum-topic fixture resembles a non-forum reply chain.
Reason: The focused test repair preserves the maintainer-approved runtime behavior and retains meaningful caption, ordering, and topic-binding assertions.

Merge readiness

✅ Ready for maintainer review

This PR repairs an inconsistent Telegram test fixture without weakening its assertions or changing production behavior; no actionable findings remain, and exact-head CI is green.

Priority: P2
Reviewed head: 859770fce302c449b6da757e944e01a3ff36e0d3

Before merge

None.

Findings

None.

Agent review details

How this fits together

Telegram edit responses pass through thread classification and the outbound context recorder into SQLite-backed history; these tests exercise that path using a real grammY client and a local HTTP fixture.

flowchart LR
  A[Test provider response] --> B[Local HTTP server]
  B --> C[grammY edit client]
  C --> D[Outbound context recorder]
  D --> E[Thread classifier]
  E --> F[SQLite message history]
  F --> G[History assertions]
Loading

Technical review

Best possible solution:

Land the fixture correction and focused edit-path regression while preserving the existing production classifier and history assertions.

Do we have a high-confidence way to reproduce the issue?

Source inspection explains why the original edit response loses its topic binding; the author reports red/green and revert-control runs, which this read-only review did not rerun.

Is this the best way to solve the issue?

The smallest complete repair is to correct the forum fixture and protect the distinct edit-response boundary using the existing HTTP and SQLite setup, as this PR does.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bb905f76e55d.

Provenance checked

  • Edited-caption history fixture keeps the original intent (b06666e: Consolidate redundant tests while retaining authoritative caption updates and later group-history visibility.)
  • Non-forum edit classification keeps the original intent (6274d9e: Keep reply-chain messages finalized through edits in unthreaded group history rather than treating chain roots as forum topics.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b06666e adds extensions/telegram/src/send.history.test.ts:219 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b06666e3add6; files: extensions/telegram/src/send.history.test.ts)

PR surface

Tests +21. Total +21 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 22 1 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 22 1 +21

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: A deterministic test-fixture failure disrupts unrelated PR validation without changing shipped Telegram behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A deterministic test-fixture failure disrupts unrelated PR validation without changing shipped Telegram behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 14, 2026, 3:29 PM ET / 20:29 UTC.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…#199169)

The edited-caption history case sent to topic 77 and then edited the
message, but its provider responses carried message_thread_id without
is_topic_message or chat.is_forum. Since openclaw#189231, an edit response shaped
like that is classified as a non-forum reply chain and recorded as
topicless, so the case failed on main.

Mark the fixture as a forum topic message the way Telegram does, and add
an edit-path guard that a non-forum reply-chain edit stays in unthreaded
group history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant