Repository navigation
fix(telegram): retry unnamed topics after failed auto-labeling - #191879
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherTelegram 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
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +41, Tests +182, Other +2. Total +225 across 8 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 3, 2026, 7:41 AM ET / 12:41 UTC. |
|
Merged via squash.
|
…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]>
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
84937aba088a1adab294aaa96f933e46c3ccf049because 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
84937aba088a1adab294aaa96f933e46c3ccf049through head6da9c3eb6accac173af273821283d797a6a05e7c. 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 head6da9c3eb6accac173af273821283d797a6a05e7c(production and test code unchanged at the final head) with no blocking findings and independently passed 46 action-runtime, topic-cache, and recovery tests plusgit diff --check.Final head
182dab4a9eabf385fa813519b2871de9d5e62ae6also passed fresh full-branch Claude P0–P2 autoreview with no actionable findings. The sole change after independent re-review removes the now-stale./send.jsmock-export waiver, because the regression harness preserves real exports viaimportOriginal. The focused mock-export ratchet passes.Persistence compatibility: the stored
TopicEntryfields and the namespace/key, validation, hydration, read, and write functions are unchanged from latest stablev2026.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 andopenclaw/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.