Skip to content

fix(telegram): retry unnamed topics after failed auto-labeling - #191879

Merged
vincentkoc merged 3 commits into
mainfrom
fix/telegram-thread-auto-title-20261103
Nov 3, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/telegram-thread-auto-title-20261103

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Related: #183368, #184821.

What Problem This Solves

Fixes private Telegram topics staying named "New Thread" after automatic naming returns no label, model inference fails, or Telegram rejects the rename.

User Impact

With automatic topic naming enabled, a later message can retry naming a topic still observed as "New Thread", even after the first reply has completed. Successful naming stops these recovery attempts.

This recovery is scoped to the literal "New Thread" placeholder; localized or other implicit names are not newly covered. A deliberately chosen title identical to "New Thread" is indistinguishable from this placeholder and remains eligible. Persistent failures retry once per later incoming message, not on a background timer; no attempt cap is introduced. It does not add refinement of successfully generated titles or change reset/new-session naming policy.

Why This Change Was Made

Reply completion was being treated as successful title completion. The naming path now keeps observed placeholder topics eligible, checks for an observed name change before editing, and updates the existing account-scoped topic cache after Telegram accepts the rename. Explicit private-topic edits write to that same metadata-owner/account scope, so a successful manual rename remains protected even without an incoming Telegram service-message echo. Group-forum metadata keeps its existing scope.

#183368 proposes refinement of generated names, while #184821 addresses the broader reset-aware naming lifecycle. This patch isolates recovery from a failed initial naming attempt; it neither replaces nor incorporates those proposals.

Evidence

  • Three dispatch regressions cover an empty generated label, a model error, and a Telegram edit error. Each verifies a second naming attempt after reply completion, successful cache update, and no further naming after recovery.

  • All three regressions fail against base 84937aba088a1adab294aaa96f933e46c3ccf049 because only one naming attempt occurs; all three pass with this fix.

  • A fourth dispatch regression performs a real topic-edit request against a local HTTP fixture after failed labeling, then verifies the explicit title is preserved without an incoming rename echo. Restoring the old unqualified cache writer makes this regression fail; the repaired writer passes.

  • All 50 focused tests pass: four recovery cases, 38 registered-action cases, four topic-cache cases, and four adjacent dispatch cases. The action cases include private/group metadata-owner scope and account isolation.

  • Targeted type-aware lint, import-boundary lint, formatting, whitespace, and line-cap checks pass. The focused 50-test batch took 99.27 seconds including two isolated test configurations and compilation/setup. After strengthening the asynchronous preservation assertion, all four recovery cases passed again in 31.91 seconds including setup; hosted CI timing is not yet available.

  • The dedicated 180-line test allocation covers the new failure-recovery and cache-ownership regressions; the shared baseline is unchanged.

  • Fresh landing autoreview (Claude, P0–P2; Codex CLI unavailable) reviewed base 84937aba088a1adab294aaa96f933e46c3ccf049 through head 6da9c3eb6accac173af273821283d797a6a05e7c. It judged the patch correct and raised two robustness suggestions: persist implicit-name metadata and cap retries. Both are retained as explicit tradeoffs above: broader implicit-name handling is outside this literal-placeholder fix, and a permanent cap can strand naming again after an outage. Independent re-review passed head 6da9c3eb6accac173af273821283d797a6a05e7c (production and test code unchanged at the final head) with no blocking findings and independently passed 46 action-runtime, topic-cache, and recovery tests plus git diff --check.

  • Final head 182dab4a9eabf385fa813519b2871de9d5e62ae6 also passed fresh full-branch Claude P0–P2 autoreview with no actionable findings. The sole change after independent re-review removes the now-stale ./send.js mock-export waiver, because the regression harness preserves real exports via importOriginal. The focused mock-export ratchet passes.

  • Persistence compatibility: the stored TopicEntry fields and the namespace/key, validation, hydration, read, and write functions are unchanged from latest stable v2026.10.10 (7dc3350cb9f08fcf9a0af5c4845a20d5b2f1a8be) and the PR base. The four real-SQLite cache tests cover database reopen, retained creator metadata, LRU behavior, and account/store isolation. Account-qualified private-topic ingress already exists on the PR base; this patch aligns the explicit-edit writer with that reader. No schema or stored-value conversion is introduced. This source comparison and reopen coverage are not a full stable-to-candidate runtime upgrade test.

  • Native review artifacts validate as ready for preparation at the final head. The exact-head build-artifacts job passed; successful preflight logs confirm checkout revision 6da9c3eb6accac173af273821283d797a6a05e7c. The prior-head PR CI run passed every selected job except the stale mock-export waiver and its aggregate gate. Final-head PR CI passed all 38 selected jobs, including baseline ratchets and openclaw/ci-gate. The one-line waiver cleanup changes no production or test code. The earlier manual attempt rejected an invalid validation-tier selection before building and supplies no passing proof.

Live Telegram and native-ingress proof remain unverified. The isolated runtime preparation fence could not establish separation from an unrelated managed process. These tests use mocked model/transport boundaries and a local HTTP topic-edit fixture; they are not live end-to-end evidence. A full stable-to-candidate runtime upgrade is also unverified. No deployment or restart has been performed.

@clawsweeper

clawsweeper Bot commented Nov 3, 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: M labels Nov 3, 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR retries failed automatic naming of private Telegram topics still called "New Thread" and preserves observed explicit renames.

Example: A private Telegram topic named "New Thread" receives "Review an invoice", but label generation fails.

  • Before: After the reply completes, subsequent messages never retry automatic naming.
  • After: A later message retries naming, records "Invoice review" after Telegram accepts it, and stops further recovery attempts.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent, but supplied mocks and fixtures do not establish the required shipped behavior or existing-state compatibility.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Private Telegram topics can remain named "New Thread" permanently after their first automatic naming attempt fails.
Reason: Recovery restores an existing default-enabled capability, and the maintainer-authored PR explicitly defines its narrow placeholder and retry tradeoffs.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this maintainer-authored PR open: it addresses a current topic-naming defect with a focused repair, and no concrete introduced bug was found.

Priority: P2
Reviewed head: 6da9c3eb6accac173af273821283d797a6a05e7c

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply actual Gateway/Telegram ingress evidence showing failure followed by successful later-message recovery, no subsequent automatic rename, explicit-name preservation, and an existing-state upgrade from the latest stable release.
Agent review details

How this fits together

Telegram dispatch receives authorized private-topic messages, uses session and account-scoped topic metadata to decide naming eligibility, and sends generated titles to Telegram.

flowchart LR
  A[Private topic message] --> B[Telegram context]
  B --> C[Message dispatch]
  D[Session and topic metadata] --> C
  C --> E[Label generator]
  E --> F[Telegram topic edit]
  F --> D
Loading

Technical review

Best possible solution:

Keep recovery in Telegram dispatch and use the existing account-scoped topic cache to preserve explicit names and record successful automatic naming.

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

Current-main source establishes the failure path: naming fails, reply completion sets systemSent, and subsequent turns skip naming; the author also reports base-red/head-green regressions, which were not rerun in this read-only review.

Is this the best way to solve the issue?

The patch is a small, coherent repair using existing dispatch and cache owners; the added scope resolver replaces the action-local calculation and serves both affected writers without introducing another state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • First-turn automatic naming changes intended behavior with a stated reason (466debb: Generate a descriptive title after the first private-topic message without blocking reply delivery.)
  • Private-topic account scope keeps the original intent (df3c47e: Track private native topic names in account-scoped metadata and propagate them through the canonical session title path.)
  • Action topic metadata persistence keeps the original intent (5182ebc: Persist successful topic mutations so later context can resolve their names without waiting for service events.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5ffeff1 adds extensions/telegram/src/bot-message-dispatch.ts:433 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5ffeff12269c; files: extensions/telegram/src/bot-message-dispatch.ts)

PR surface

Source +41, Tests +182, Other +2. Total +225 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 62 21 +41
Tests 4 184 2 +182
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 8 248 23 +225

Labels

Label changes:

  • add P2: Failed automatic naming leaves private Telegram topics with an unhelpful placeholder, but replies and ordinary conversation remain usable.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Failed automatic naming leaves private Telegram topics with an unhelpful placeholder, but replies and ordinary conversation remain usable.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the Gateway/Telegram recovery and upgrade evidence described in the proof assessment.

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 3, 2026, 7:41 AM ET / 12:41 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 3, 2026 12:45
@vincentkoc vincentkoc self-assigned this Nov 3, 2026
@vincentkoc
vincentkoc merged commit 2ac42c8 into main Nov 3, 2026
133 checks passed
@vincentkoc
vincentkoc deleted the fix/telegram-thread-auto-title-20261103 branch November 3, 2026 13:23
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

* fix(telegram): retry unnamed topics after failed auto-labeling

* fix(telegram): preserve explicit topic edits during label recovery

* test(telegram): remove retired send mock waiver

Co-authored-by: Vincent Koc <[email protected]>
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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant