Skip to content

refactor(telegram): remove redundant test coverage - #155040

Merged
roboclaw-bot merged 11 commits into
mainfrom
test/telegram-test-pruning
Sep 23, 2026
Merged

roboclaw-bot merged 11 commits into
mainfrom
test/telegram-test-pruning

Conversation

@obviyus

@obviyus obviyus commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #155003

What Problem This Solves

Telegram test maintenance carries redundant coverage that repeats mock behavior and the same contracts across multiple layers.

User Impact

User impact: primarily test maintenance. Retained regressions also exposed two existing delivery defects: a stale answer block could be sent after a message-tool final, and with reply threading off a quoted reply deleted its streamed preview and re-sent the answer as a new message. After merging #155906, its shared final-delivery lifecycle already retires the pending block, so this PR keeps only the quote-policy repair; the message-tool case remains covered by retained tests and live proof. No new settings, migration, required user action, or runtime/CI speedup is claimed.

Landing preparation requested. Exact-head CI and the hosted ClawSweeper review must pass before merge. No auto-merge is authorized.

Why This Change Was Made

This requested cleanup removes mock echoes, identity/Promise inventories, redundant send/action/dispatcher/history matrices, and unused support. Contracts are consolidated at stronger existing owners, while distinct authorization, ordering, replay, and media regressions remain; original tests are retained where replacements did not establish equivalent coverage.

The scope also includes private test-only seam cleanup, test-worker routing, shrink-only line-cap updates, and Telegram test-ownership guidance. Before the readiness repairs below, the cleanup campaign's production edits totaled six files and 42 net lines removed.

At 52abfe2655d, against the original cleanup baseline, test code falls from 111,122 to 64,651 lines (−46,471; 41.8%) and support from 7,493 to 5,686 lines (−1,807): 48,278 net lines removed combined (40.7%). These counts include all new and restored tests/helpers; they are campaign measurements, not GitHub's PR diff statistics.

Evidence

Maintainer compatibility decision (3eb1bab78c1)

Maintainer decision (Ayaan): this PR changes no user config or stored-data contract, so no migration or upgrade compatibility proof is required. Checked against the complete diff from the merge base: no config schema, default, manifest, migration or SQLite schema change. Production edits are the quote-policy repair (bot-message-dispatch-payload.ts, bot-message-dispatch-delivery.ts) and removal of test-only seams: message-cache.ts drops test-supplied store/bucket parameters (production store, bucket key, keys and serialization unchanged), update-offset-persistence.ts drops an inspection getter (write ordering and on-disk form unchanged), the internal test-only resetMissingDefaultWarnFlag export is removed, and action-runtime.ts calls the same operations with the same authorization arguments without its test indirection. The ClawSweeper flag came from unknown-truncated-pull-files on this 280-file diff, not from a detected change.

Merge with #155906 and live Telegram proof (3eb1bab78c1)

Merged current main (including #155906, which moved Telegram final delivery onto the shared live-preview lifecycle). Conflicts resolved at the new owner: bot-message-dispatch-turn.ts takes main's lifecycle callback, whose finalStarted guard now retires the pending answer block, so this PR's separate reset was dropped. Test files this PR had already consolidated stay deleted; #155906's new final-delivery-lifecycle suite is kept intact. Retained tests were aligned with the landed contract: the delivery outcome matrix now expects the delivery warning for failed and partially delivered finals, lane tests assert returned delivery results instead of retired deliverer flags, and clear-count assertions that #155906 also removed are gone. No assertion was loosened beyond #155906's own changes.

  • Extension production and test typechecks passed. Full Telegram extension suite: 2577/2579 passed. The two failures were timing-sensitive under full local load (typing cadence 5290ms vs 5000ms, and a 10s webhook timeout); both files passed in isolation (88/88). Local declaration lint is still refused by the nested-checkout ancestor install; hosted lint is the gate.
  • Telegram Test Server proof (leased QA user, real Gateway, scripted provider), each run also against a control build with the fix reverted:
Scenario Fixed build Control (fix reverted)
Progress + block streaming; answer block, then final via message tool, then NO_REPLY one message: the tool-sent final tool-sent final plus a stale Checking the result… message
replyToMode: off, partial streaming, user replies with a native quote preview edited in place into the final; one send, no delete preview edited, deleted, then the answer re-sent as a new message

Both scenarios were re-run on the merged head 3eb1bab78c1 with the same result as the fixed build. The quote scenario used a local proof-only harness extension (quoted send action) that is not part of this PR.

Previous readiness checkpoint (e4045b8ef8f7)

Hosted CI is green on this exact head: run 35792794579, attempt1, 139 successful jobs, 15 skipped, zero failed/cancelled/pending. GitHub reports the PR mergeable; auto-merge remains disabled.

The published current-head ClawSweeper review reports no code or security findings. Its verdict remains needs-human / blocked for required live Telegram proof and two generic compatibility checklist items. The detailed review identifies no user-config or stored-data contract change, but those checklist flags have not been cleared; this is not represented as approval. Required current-candidate Telegram Test Server proof remains blocked by the documented runner prerequisites. This PR is not yet landing-ready; no merge is authorized.

Concurrency fixture repair (e4045b8ef8f7)

The next CI run passed the preview suite, but exposed five obsolete /stop resolver waits. Phase traces showed both control updates completing and Telegram acknowledging the stop in topic 100; the shared dispatcher handles /stop through fastAbortResolver/finishFastCommand before the model resolver. The test now asserts that real acknowledgment and update completion instead of waiting for an impossible callback. All six cases, authorization controls, held ordinary work, cross-topic cancellation, later completion, and final deadlines remain. No production or metadata-admission guard changed.

  • Reproduced the blocked wait with a diagnostic-only short deadline; the complete six-case file then passed with normal deadlines and again in its CI predecessor order.
  • Decoded the actual CI plan and checked every remaining relevant Telegram file behind the earlier bail: 29 files, 354 passed, zero failures/skips. This includes all nine config-74 owners and all twenty downstream config-98/99 Telegram files. Unrelated iMessage/Matrix groups were not included in that local claim.
  • Extension-test types, formatting, conflict/diff hygiene, line-cap/max-lines/assertion-safety checks passed. Independent scoped P0–P2 review returned no actionable findings. Hosted CI subsequently passed as recorded above; mandatory live Telegram proof remains externally blocked.

Terminal-fallback diagnostics (9391ef162c31)

The 24495e034358 CI run passed its other checks, including hosted lint and static checks, but recorded one failure: an unaccepted-preview model failure left zero visible fallback messages. That failure remains unexplained; this commit is not a claimed causal fix.

The original nine-file CI order passed172 cases on both Node26 and CI-matched Node24.19.0. The Node24 full preview suite passed30 cases, and CI-mode terminal/replay controls passed4. The strengthened test asserts the actual preview precondition, no longer broadly permits internal delivery errors, and attaches synthetic HTTP history to the unchanged one-visible-message assertion. Production behavior, deadlines, retries, and suppression are unchanged; the scoped independent review found no actionable P0–P2 issue. Fresh hosted CI is required, and the separate mandatory live-proof blocker remains.

CI repair (24495e034358)

  • Addressed the failed fixture/routing contracts without changing production binding refusal: removed a retired test-inventory entry; initialized the actual ingress runtime; registered and cleaned up the explicit no-binding account owner used by real bot construction; and limited the controlled sticker scenario to its authored providers.
  • Paragraph tests now require string HTTP text instead of coercing arbitrary objects. The unchanged quote predicate moved to the existing payload/quote owner; line caps and baselines were not increased.
  • 366/366 affected cases passed across eight routed invocations (257.81s), plus 11/11 paragraph and missing/predecessor-owner controls (38.42s). Extension-test types, formatting, line-cap/max-lines/assertion-safety ratchets passed. The scoped independent P0–P2 review returned no actionable findings.
  • Fresh hosted CI must validate this head; local declaration lint remains environment-blocked. The separately documented live Telegram prerequisite is still blocked, so this is not a landing-ready claim.

Landing preparation (3eece00d38a4)

  • Reconciled main through e9df70639592b85e6c6f15e609b5a4a1c53b1b18, preserving the shared coalescing cutover, binding-authority controls and the pruning’s stronger owners. Two real /help initialization rows replace the newly added symbol-identity/helper checks; they verify selected-session activity and reject wrong peer/parent destinations.
  • 198/198 cases passed across five complete latest-main suites (166.63s wrapper): DM session12, disabled bindings9, history12, create-bot86, bot79. Reverting core initialization to unconditional bound-parent selection makes the topic row fail on missing selected-session interaction activity; the source was restored. The route-spread-only probe did not discriminate and is not claimed as mutation evidence.
  • The three earlier failing owners now pass: reply-target/command-detail HTTP 36/36, and preview/directive/progress-card/lane siblings 46/46. Two small runtime repairs retire pending progress at observed final delivery and align off-mode preview reuse with the sender’s threading policy. The token test now checks replacement before a headline intentionally suppresses reasoning rows, and explicitly checks suppression afterward. No oracle or final deadline was weakened.
  • Fixtures use owned per-test session storage and scoped/restored loopback transport prerequisites. Earlier transport/proxy-policy controls passed98/98. The repair delta received a scoped-clean independent P0–P2 review. Final-main chunked review was also completed: its timer-leak concern is covered by the shared HTTP fixture’s afterEach owner, and supported hyphen normalization is exercised by the retained cross-channel-shadow handler cases.
  • Remaining gates: exact-head hosted CI, substantive ClawSweeper review, and required current-candidate Telegram Test Server proof. Local declaration lint refuses this nested checkout’s ancestor install; clean-checkout CI is required rather than bypassing that boundary. Live proof is blocked before execution: the local runner lacks uv, and the configured Testbox path has no verified supported private broker injection. The prerequisite and cleanup report records the required owner action; no lease or live scenario ran. No current-head live-platform success is claimed yet.

Review follow-up (52abfe2)

The preservation review identified nine real coverage gaps. They are repaired at retained owners: routed-agent /think text; indexed preview rotation and skip cleanup; preceding-answer recovery with an active preview; config acceptance/rejection; polling/webhook reaction subscriptions; voice echo account/thread routing; compaction reactions; bot-stop ordering; and asynchronous sticker lookup fallback.

  • 38 focused cases passed across 10 test files, including all 12 cases in the extracted recovery suite. The three active-preview cases also passed after correcting the optional metadata field's type. These are scoped results, not a full-file run of every affected suite.
  • 10 deliberate mutations were caught: missing agent forwarding, reaction subscription, indexed rotation, skipped-block cleanup, preview recovery metadata, audio thread metadata, bot-stop ordering, strict preflight validation, sticker lookup fallback, and compaction reaction signaling. Production sources were restored byte-for-byte afterward.
  • The explicit 11-path changed gate passed: extension-test types, formatting, extension/script lint, line caps, boundary guards, and dead-export checks. No cap increase or coverage deletion was used; transcript recovery moved into a coherent sibling suite registered with the database workers.
  • Independent P0–P2 review of the repair returned no actionable findings. A subsequent optional-field fixture type correction passed its targeted cases and the full changed gate.
  • This follow-up adds 291 test lines net and one test-routing entry; no production code changes.
Focused per-file execution cost

Measured case-duration totals from the 38-case run, excluding collection/build overhead. The complete invocation took 133.90 seconds including prerequisite build and worker preparation; no CI timing claim is made.

Test file Cases run Case time
bot-message-dispatch.preview.telegram-http.test.ts 2 3.25s
bot-message-dispatch.reply-targets.telegram-http.test.ts 4 3.67s
bot-message-context.body.test.ts 3 7.76s
sticker-cache.test.ts 3 1.56s
bot-message-dispatch.recovery.telegram-http.test.ts 12 27.07s
bot-native-command-dispatch.delivery.test.ts 2 1.79s
polling-session.test.ts 4 0.37s
webhook.test.ts 1 0.12s
config-schema.test.ts 6 0.03s
telegram-ingress-worker.runtime.test.ts 1 0.02s

Earlier pruning-head evidence

  • The earlier explicit 248-path scripts/check-changed.mjs check passed: production and extension-test types, formatting, lint, guards, zero dead-export entries in the checked scopes, and zero runtime import cycles. Its separate doctor checks passed 6/6.
  • Earlier full-file results for the exercised owners cover 43 files / 872 cases: 869 passed, 3 failed. Reruns and focused subsets are not double-counted. These three original regressions were retained rather than deleted or weakened, and are resolved by the readiness follow-up above:
    • bot-message-dispatch.progress-command-detail.telegram-http.test.ts: progress tool-result acceptance times out.
    • bot-message-dispatch.reply-targets.telegram-http.test.ts: quote-off context produces two messages where one is expected.
    • bot-message-dispatch.progress-card.test.ts: message-tool progress leaves an extra “Checking the result” message.
  • Independent review completed. Its accepted captionless-media fixture finding was corrected and independently source-verified; the full bot-message-context.body.test.ts run then passed 49/49 (90.47 seconds wall time), followed by the passing changed-path check. Other reported findings were adjudicated against source; this is not a claim that the review reported no findings.

The earlier 272-path PR diff also included earlier Telegram-specific integration and tooling cleanup; the final 248-path check does not mean every PR path was rerun. Validation is scoped local proof, not an all-green full-repository run. Separate userbot proof on c15d097087 exercised the Telegram Test Server with a deterministic model backend: core DM/command/streaming/media/history/topic flows passed, but the post-click provider-menu update and distinct reaction-status transitions remained unverified. No new live-platform claim is made for that earlier test-only follow-up; current-candidate live proof remains a separate required gate.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 scripts Repository scripts commands Command implementations extensions: qa-lab size: XL maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 23, 2026, 3:29 AM ET / 07:29 UTC (Revision 11).

ClawSweeper review

What this changes

Consolidates Telegram tests, removes private testing hooks, updates test routing, and preserves streamed answers in place when reply threading is disabled.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: the requested consolidation and quote-policy repair remain useful. Current-head Telegram evidence resolves the earlier proof blocker, and this review found no actionable correctness or security defect.

Priority: P3
Reviewed head: 3eb1bab78c1ee9b2e4dff931d601634183b0b44b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful consolidation with repaired preservation gaps, relevant current-head live observations, and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The hash-matched body records real Telegram Test Server runs through the Gateway on the pinned head: reply-off quoted streaming preserves one message through finalization, and message-tool finalization leaves no stale progress. Reverted controls distinguish both failures, satisfying the earlier proof request. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The hash-matched body records real Telegram Test Server runs through the Gateway on the pinned head: reply-off quoted streaming preserves one message through finalization, and message-tool finalization leaves no stale progress. Reverted controls distinguish both failures, satisfying the earlier proof request. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduction and clean checkout: Inspected the complete changed-path inventory and production hunks from the pinned base to head. The checkout is the original PR head, and final status and diff whitespace checks were clean. The supplied stale test merge was not used to infer removal of current-main behavior.
Quote repair matches the existing sender policy: The quote predicate now respects replyToMode off while preserving explicit replyToTag and replyToCurrent overrides. The existing sender applies that same policy in bot/delivery.replies.ts:759–763; the HTTP regression verifies one send, no reply parameters, and one final visible answer.
Current-head real Telegram evidence: Read the complete live PR body and verified SHA-256 dd2b8046cba2c7f642f6e3435b3927b43351f3383efd0bd740f960e03095a65d against the captured source. It records leased Test Server users, a real Gateway, a scripted provider, reverted controls, and reruns on the pinned head: message-tool finalization leaves one final message, and reply-off quoted streaming uses one send with no deletion. This addresses the previous review's sole retained rank-up move. Prepared screenshots were inspected but belong to the related final-delivery PR and were not credited as proof of this quote repair.
Findings None None.
Security None None.

How this fits together

The Telegram plugin turns incoming conversations and agent output into Telegram messages. Its delivery layer coordinates previews, reply targets, final answers, and transport recovery.

flowchart LR
  A[Telegram conversation] --> B[Agent reply]
  B --> C[Telegram delivery policy]
  D[Reply settings and quote context] --> C
  C --> E[Reuse streamed preview]
  C --> F[Send separate reply]
  E --> G[Visible Telegram answer]
  F --> G
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #155003
Summary: This PR implements the linked pruning request; merged final-delivery work overlaps only one incidental repair.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep distinct Telegram contracts at their strongest test owners and use the existing reply policy consistently for preview finalization.

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

Yes for the retained quote defect: current main treats quote context as requiring separate delivery even with reply threading off; the retained HTTP scenario and reported Test Server reverted control exercise that path. This reviewer did not execute it.

Is this the best way to solve the issue?

Yes. Aligning preview reuse with the sender's existing reply policy is a narrow repair, and the inspected consolidation preserves the previously identified distinct regressions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The hash-matched body records real Telegram Test Server runs through the Gateway on the pinned head: reply-off quoted streaming preserves one message through finalization, and message-tool finalization leaves no stale progress. Reverted controls distinguish both failures, satisfying the earlier proof request. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: The primary deliverable is requested test-maintenance cleanup with a bounded repair to existing reply behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The hash-matched body records real Telegram Test Server runs through the Gateway on the pinned head: reply-off quoted streaming preserves one message through finalization, and message-tool finalization leaves no stale progress. Reverted controls distinguish both failures, satisfying the earlier proof request. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The hash-matched body records real Telegram Test Server runs through the Gateway on the pinned head: reply-off quoted streaming preserves one message through finalization, and message-tool finalization leaves no stale progress. Reverted controls distinguish both failures, satisfying the earlier proof request. No stored-data contract changes.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The quote-policy repair changes observable Telegram message reuse; the recorded Test Server evidence covers it.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Inspected the complete changed-path inventory and production hunks from the pinned base to head. The checkout is the original PR head, and final status and diff whitespace checks were clean. The supplied stale test merge was not used to infer removal of current-main behavior. (3eb1bab78c1e)
  • Quote repair matches the existing sender policy: The quote predicate now respects replyToMode off while preserving explicit replyToTag and replyToCurrent overrides. The existing sender applies that same policy in bot/delivery.replies.ts:759–763; the HTTP regression verifies one send, no reply parameters, and one final visible answer. (extensions/telegram/src/bot-message-dispatch-payload.ts:80, 3eb1bab78c1e)
  • Current-head real Telegram evidence: Read the complete live PR body and verified SHA-256 dd2b8046cba2c7f642f6e3435b3927b43351f3383efd0bd740f960e03095a65d against the captured source. It records leased Test Server users, a real Gateway, a scripted provider, reverted controls, and reruns on the pinned head: message-tool finalization leaves one final message, and reply-off quoted streaming uses one send with no deletion. This addresses the previous review's sole retained rank-up move. Prepared screenshots were inspected but belong to the related final-delivery PR and were not credited as proof of this quote repair. (3eb1bab78c1e)
  • Earlier preservation concerns addressed: Read the earlier methodology review and checked retained coverage for routed-agent thinking text, indexed rotation and skipped-preview cleanup, preceding-answer recovery with active previews, config acceptance/rejection, polling/webhook subscriptions, voice routing, compaction reactions, teardown ordering, and asynchronous sticker lookup failure. The body additionally records ten discriminating mutation controls; those executions were not repeated during this read-only review. (extensions/telegram/src/bot-message-dispatch.recovery.telegram-http.test.ts:199, 3eb1bab78c1e)
  • Private seams and unchanged storage contracts: The cache change removes test-supplied store and bucket injection while preserving the production store, namespace, keys, serialization, and promotion path. Offset persistence loses only an inspection getter. The warning reset was explicitly internal/test-only, and action calls retain the same operations and authorization arguments. No user configuration, public SDK contract, persisted format, or migration change was identified. (extensions/telegram/src/message-cache.ts:341, 3eb1bab78c1e)
  • Related merged work does not supersede the cleanup: GitHub confirms fix(telegram): keep a visible outcome when final delivery fails #155906 merged as 6121469. Current main contains its finalStarted guard but retains the old quote predicate. This PR drops its redundant progress reset and retains distinct consolidation and quote work. The local tag-containment check returned no containing release tag for that related merge; no shipped-fix claim is made. (extensions/telegram/src/bot-message-dispatch-delivery.ts:197, 3ab93b4ea598)

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-22T20:39:04.038Z sha 3eece00 :: blocked before merge. :: none
  • reviewed 2026-09-22T20:46:40.917Z sha 3eece00 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:07:50.753Z sha 3eece00 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:24:46.612Z sha 24495e0 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:33:10.942Z sha 24495e0 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:57:14.354Z sha 9391ef1 :: blocked before merge. :: none
  • reviewed 2026-09-22T23:31:48.892Z sha e4045b8 :: blocked before merge. :: none
  • reviewed 2026-09-22T23:44:46.016Z sha e4045b8 :: blocked before merge. :: none

@obviyus obviyus changed the title refactor(telegram): remove low-value tests and dead test seams refactor(telegram): remove redundant test coverage Sep 22, 2026
@obviyus

obviyus commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Classes of test-quality mistakes found in this cleanup

  • Implementation mirrors: private keys, object identity, and async mechanics asserted instead of observable behavior.
  • Mocks that hide bugs: identical mocks for different media APIs; persistence assertions against stores the mock never writes.
  • Self-confirming expectations: production renderers also generated expected output, hiding shared rendering mistakes.
  • Fake lifecycles: fixtures supplied receipt/admission/callback ordering instead of exercising the owner of that behavior.
  • Duplicate coverage: shared policies replayed across layers and matrices without a distinct failure mode.
  • Misleading fixtures: a “captionless media” case contained no media; the name promised more than the input exercised.
  • Scaffolding accumulation: redundant tests kept unnecessary helpers and test-only production seams alive.

Review bar: name the observable contract, the plausible bug that would fail the test, and why existing coverage is insufficient. Use the cheapest adequate owner boundary. Mocked, static, slow, or failing tests are not automatically junk; meaningful regressions stay.

@roboclaw-bot roboclaw-bot left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: requested compaction-end check added

Added in 9b0e796: one test file, 17 added lines, no production changes. The existing success case now waits for its tool-reaction phase, then requires a new accepted thinking reaction after compaction end and before final delivery. Startup thinking cannot satisfy the check.

Validation:

  • Focused reaction matrix: 4 passed, 22 unrelated cases excluded; final one-worker invocation 15.03s wall, 3.51s case time. No full-file or live-platform pass is claimed.
  • Negative control: temporarily deleting only compaction-end's setThinking() caused the success case to fail waiting for the missing transition (10-second diagnostic timeout). Production source was restored byte-for-byte, then the four-case matrix passed again.
  • Explicit one-path changed gate passed: formatting, extension-test types, lint and repository guards. Independent P0–P2 review returned no actionable findings.
  • Local test traffic required loopback exclusions in NO_PROXY/no_proxy; without them, both the unchanged PR baseline and candidate hit the same final-send network error. Only the test process environment was adjusted.
  • The initial unsynchronized probe exposed a separate in-flight reaction transition concern. This patch sequences the existing tool phase to test the requested compaction transition; it does not claim to fix the broader reaction-controller race.

PR remains draft; no merge or ready transition requested. CI timing/results for this commit are not yet established.


Original review (before the preservation repairs)

Test-pruning methodology review

I agree with the direction, but I would not yet endorse “no meaningful regression protection lost.” This PR contains genuinely better tests—not just fewer tests—but it also removes some distinct regression checks without equivalent replacements. I would continue the methodology in smaller, contract-focused batches after tightening that preservation step.

Reviewed at c15d097087bfb8e56a70d13532cb148bd05bcdf9 against merge base bb3a9b0f40e1a08c4835d2adbd9efd295ecd3664, including independent dispatcher, ingress/durability, and context/command audits. These are source-based coverage findings, not claims that the PR introduces the corresponding runtime bugs. I did not execute the tests or mutation experiments, and this is not an assertion-by-assertion certification of all 272 changed files.

What is good about it

The central diagnosis is right: a test can execute plenty of code while proving almost nothing independently.

Several changes here address that directly:

  • Actual media bytes instead of mocked forwarding. The registered-action replacement checks the uploaded attachment contents, not merely whether a helper received the expected paths. Example
  • A real leak-window assertion. The modifying-hook test holds the hook unresolved, checks that no non-typing HTTP writes have escaped, then verifies that only the permitted final content remains. Positive controls establish that previews otherwise work. This is materially stronger than checking a mocked “preview allowed” decision. Example
  • Independent persistence expectations. The spool test now checks literal persisted event IDs, the topic lane, and actual dispatch order rather than generating the expected event ID with the same helper being tested.
  • Shared policy stays with its owner. Removing Telegram copies of core drain retry/tombstone rules is reasonable where core tests retain those rules and Telegram tests still cover admission, acknowledgement, and lifecycle integration.

Removing the mutable action-runtime test indirection is also a useful production simplification. And retaining the three known failing cases instead of deleting or weakening them is the right discipline.

Important gaps I would repair

1. A known routed-agent /think regression loses its test

The deleted test checks a non-default agent whose per-model thinking setting is high or off while the shared setting is low. It asserts the displayed current thinking level. It was added for a specific prior bug, not as an implementation inventory. Deleted regression

The replacement menu test checks a max button and topic routing, but neither the displayed current level nor a routed non-default agent. Removing the still-required agentId forwarding in bot-native-command-builtins.ts:219 would undo the old fix without violating those replacement assertions.

Small repair: add the routed-agent high/off rows to the new registered-bot test and assert the menu text. No need to restore the old harness.

2. Queued assistant-block rotation is not replaced by ordinary preview coverage

The removed draft-rotation suite exercised two queued blocks with different assistant-message indices, including ordering and cancelled/skipped blocks. The production code still uses those indices to decide when one mutable preview must become a separate message. Removed example

The retained explicit queued-block case is unindexed and runs in progress mode, which excludes this rotation branch. The new multi-paragraph producer case runs with streaming off.

A plausible regression is making takeQueuedAnswerBlockRotation() always return false: a later assistant answer can overwrite the earlier preview. Stream-primitive tests cannot establish that the dispatcher preserves assistant boundaries.

Small repair: one real-preview scenario with two indexed assistant blocks, plus a discriminating cancellation/skip case.

3. “Preceding input answer” is retained in the wrong mode for one important risk

The new preceding-input recovery check uses mode: "off". The deleted cases also protected an earlier answer from being replaced by a longer active preview, including a media-bearing answer. Current replacement

The active-preview recovery calls still exist in lane-delivery-text-deliverer.ts. If a Telegram caller stops passing the payload metadata to the shared recovery helper, the helper's own tests can stay green while the wrong answer is substituted.

Small repair: retain an active-preview case, with earlier/latest answers deliberately different. Off-mode transcript recovery is a separate scenario.

4. Runtime behavior does not replace config-validation coverage

The PR removes the schema's acceptance and invalid-type tests for disableAudioPreflight. The new runtime test correctly checks group/topic precedence, but supplies an already-constructed config directly; it does not validate that user configuration. Deleted schema checks

A schema could reject a documented valid setting while that runtime test still passes. Similarly, the retained topic test only asserting rejection of { agentId, unknownField } does not prove that agentId itself remains accepted.

Small repair: compact positive/negative schema examples, or pass representative runtime fixtures through the real validator. Config shape is a public contract, not automatically “literal slop.”

5. Reaction handling does not prove Telegram subscribes to reaction updates

allowed-updates.test.ts disappears, and I found no retained assertion on allowed_updates. Yet polling and webhook registration still construct that field. The remaining reaction tests inject reaction updates after subscription would have occurred. Deleted guard

Dropping message_reaction from the subscription can leave handler tests green while real users' reactions never arrive.

Small repair: assert the required inclusion and unsupported-stop exclusion in a captured polling/webhook request—or retain a small independent helper contract. Copying grammY's entire default inventory is unnecessary.

Additional narrower preservation gaps
  • Audio transcript echo routing: deleted cases checked the account, destination and DM/forum thread passed into audio preflight. New cases stub transcription and check model input, not that routing context. The echo sender actually consumes those fields. Extend a voice case to check the preflight context or actual echo destination. See bot-message-context.body.ts:315–328 and the deleted cases.
  • Compaction reactions: new compaction tests cover progress text with no status-reaction controller; the real-reaction matrix does not exercise compaction. They cannot detect Telegram ceasing to call setCompacting(). Add compaction to the existing reaction scenario. Owner
  • Bot teardown ordering: the deleted test explicitly asserted handler completion before bot.stop(). Retained tests establish that overall shutdown waits, but not that bot teardown itself waits. Preserve an observable bot-stop check while settlement is held; do not rely on an inert mocked stop.
  • Sticker-cache lookup failure: register/search failure coverage remains, but the asynchronous lookup-rejection case is removed. The narrower missing protection is that lookup still uses the best-effort fallback—not whether the shared fallback works at all. This can be a cheap failure-table row.

I would address these by extending the retained owners, not restoring thousands of lines wholesale.

How I would generalize the methodology

The recurring problem is “covered elsewhere” at too coarse a level. A shared helper test does not prove a caller supplies the right metadata. A broader HTTP test does not replace a smaller test if it runs in a mode that bypasses the relevant branch.

I would use this deletion bar:

  1. Map each meaningful removal to a named retained test and failure mode. Not just “covered by HTTP tests.” Record the relevant mode, account/topic scope, lifecycle state, and negative outcome. Group genuinely identical cases; no need for a bureaucratic row per assertion.
  2. Check sensitivity, not just green results. For risky replacements, deliberately break the claimed contract: omit the routed agent ID, disable rotation, remove a subscription, drop recovery metadata. Confirm that the replacement fails for the intended reason. Use a small targeted set, not a mandatory whole-repository mutation campaign.
  3. Keep independent positive and negative controls. A rejection test can pass because an unrelated guard rejects everything. Pair it with the nearest valid case.
  4. Choose the cheapest adequate boundary—not always the highest boundary. Small parser/config/helper tests can protect real public contracts. HTTP simulation is excellent for wiring and serialization, but does not independently validate every Telegram rule; this fixture is deliberately permissive.
  5. Batch by owner and measure cost. This diff has 78,797 changed lines across 272 paths, making coverage equivalence hard to review. Prefer independently reviewable groups. Track maintained contracts, execution cost and fixture complexity; treat deleted LOC as a result, never a target.

Evidence and verdict

The PR reports 869 passed / 3 failed cases across 43 files and a 248-path static check. That is useful scoped evidence, but not proof that all removed contracts survive. The exact-head GitHub checks I inspected during review were administrative/meta checks, not a completed Telegram test run. I independently ran only the diff whitespace check; I did not reproduce the reported tests or live Telegram behavior. No source files or PR state were changed during the review.

My recommendation: keep going with behavior-first consolidation, but repair these coverage gaps before using this PR as the template for a broad rollout. The goal should be less duplicated proof, with every distinct failure still detectable—not fewer tests, and not “integration tests replace unit tests.”

The stated review bar is sound. This PR shows both why it is valuable and where the “same contract” judgment needs to become more precise.

@obviyus

obviyus commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed all nine coverage findings from the review in 52abfe2:

  • Routed-agent /think: assert displayed high/off against conflicting shared defaults.
  • Preview boundaries: indexed rotation, skipped-block cleanup, and preceding text/media versus a longer active preview.
  • Config: valid group/topic booleans and topic agent IDs, plus discriminating rejection cases.
  • Reactions: required polling/webhook subscriptions and real compaction reaction writes.
  • Lifecycle/routing: bot teardown waits for settlement; voice echo preserves account and DM/forum thread context.
  • Sticker cache: asynchronous lookup rejection retains best-effort fallback.

Proof: 38 focused cases passed; all 10 deliberate mutations were caught; the 11-path static gate passed; independent repair review returned no actionable findings. The extracted recovery suite is registered in the database-worker lane. Production code is unchanged by this follow-up.

Size: +291 test LOC net; overall test reduction remains 41.8%. PR body updated with scope, timings, and existing validation limits. Still draft; not merged.

Require a new accepted thinking reaction after compaction completes, excluding startup thinking and checking before final delivery. Sequence the existing tool reaction before compaction.

Co-authored-by: obviyus <[email protected]>
@roboclaw-bot roboclaw-bot added the size: accepted-large Maintainer-accepted large change; exempts ClawSweeper size closure, not review or CI. label Sep 22, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 22, 2026
Preserve current-main regression coverage, isolate retained fixtures, retire pending progress after observed final delivery, and honor off-mode quote policy during preview finalization.

Co-authored-by: obviyus <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Readiness preparation checkpoint: b34fdc03ce232f68bcfb55cf8f59f1a9989ba024 is now on this branch.

This preserves the pruning and the first main reconciliation. Retained tests exposed two small delivery defects, now repaired at their owners: observed final delivery retires an accepted pending progress block, and preview finalization respects replyToMode: off while retaining explicit reply overrides. Fixtures now use owned test storage and controlled loopback transport; the reasoning-token test follows the existing headline-suppression contract rather than waiting for an intentionally hidden row.

Verification: reply-target and command-detail HTTP suites passed 36/36; preview/directive/progress-card/lane siblings passed 46/46. The focused final repair review returned no actionable P0–P2 findings. Earlier full-review concerns were checked against complete source, reachable table rows, and retained coverage outside the review chunks. No assertion was weakened to manufacture green.

Still in preparation: integrating newer main e9df70639592b85e6c6f15e609b5a4a1c53b1b18, including its binding-initialization and message-coalescing regressions. Production/test types and local guards passed in the prior reconciliation; declaration-based lint requires clean-checkout CI because this local nested checkout is refused by the declaration boundary. Final-head CI and substantive ClawSweeper review remain required.

The PR remains draft; no merge or auto-merge has been requested.

@clawsweeper clawsweeper Bot added proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 22, 2026
Keep consolidated test owners, migrate real bound-session help initialization with negative destination checks, and preserve the shared coalescing cutover and replay/cancellation controls.

Co-authored-by: obviyus <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 22, 2026 20:40
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Review follow-up for 3eece00d38a4ec4cb7710aa10ccc56f2001daaf2:

  • The earlier draft-only hold described the previous phase. The author subsequently requested landing preparation, not a merge. The PR is now ready for review, its body describes the two delivery corrections and current evidence, and auto-merge is disabled. No merge is authorized by this task.
  • Config compatibility was checked against the pinned introduction boundary e9df70639592b85e6c6f15e609b5a4a1c53b1b18. This PR changes no user config schema, config defaults, plugin manifest, or migration. The incoming-main binding/coalescing changes remain upstream changes, not newly introduced config behavior here. The two delivery corrections enforce the existing off-mode and terminal-delivery contracts.
  • Stored-data compatibility was checked against the complete local inventory and the six original runtime cleanup files. The cache retains the same default store, namespace, bucket construction, keys, serialization and existing migration owner. Only unsupported test injection parameters are removed. The offset persistence writer/commit ordering and on-disk representation are unchanged; only a test-only getter is removed. The warning reset was explicitly internal/test-only, and the action indirection now calls the same operations with the same authority arguments. No data-model migration or upgrade transformation is needed. This agrees with the review’s own “Private seams and storage compatibility” evidence; unknown-truncated-pull-files is not a detected schema change.

Required current-candidate Telegram Test Server evidence is still in progress through the configured isolated proof environment, and exact-head hosted CI is running. Neither is being replaced by mocked proof or marked complete prematurely.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Required live Telegram proof is blocked before execution; this PR is not yet landing-ready.

The Telegram review standard says: “Telegram behavior PRs need real Telegram proof when they touch transport, streaming, topics, callbacks, authorization, or reply context.” That applies to the two delivery corrections here; the passing HTTP tests do not replace it.

The local runner lacks uv. Existing broker connection configuration is present, but no credential lease or live readiness was claimed. The configured blacksmith-testbox alternative passed read-only doctor checks, then failed before allocation/sync: environment forwarding is unsupported for that provider, including the injected run-ID field. Its configured hydration does not supply the broker pair. No safe private broker injection path was verified, so I did not embed secrets, switch providers, install/login, or weaken the proof gate. No Testbox or Convex lease was created; no proof processes or credential scratch remain.

Smallest prerequisite to unblock: the proof-runner owner can make an approved uv executable available on the local proof host. Alternatively, the configured Testbox dispatch and private broker hydration path need owner repair. Tokens should not be posted in this PR or chat. After that, the runner still must pass readiness on the same lease used for the two exact scenarios.

Exact-head CI is being followed separately; its baseline-ratchet failure is under investigation. The PR remains open and no merge or auto-merge is authorized.

Initialize the real runtime and no-binding account owner, bound controlled provider discovery, validate HTTP text types, remove a retired test entry, and place quote policy with payload projection without increasing line caps.

Co-authored-by: obviyus <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
Consolidate Telegram tests at their behavioral owners and remove redundant mock inventories and private test seams while retaining distinct routing, authorization, replay, media, and streaming regression checks.

Align retained delivery tests with the landed shared final-delivery lifecycle. Respect replyToMode off when finalizing a quoted preview so the answer is edited in place instead of deleted and re-sent.

Exact-head hosted CI passed. The PR records current-head Telegram Test Server proof with reverted controls and the remaining validation limitations.

Work session: https://team.openclaw.ai/chat/roboclaw/dashboard/7320cd5b-9414-4cf6-99fe-0abb9a51df58

Co-authored-by: obviyus <[email protected]>
Co-authored-by: steipete <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…nclaw#156466)

Close fixture responses so grammY cannot reuse a socket as the native HTTP server expires its idle lifetime. Preserve production ambiguity handling and the terminal-delivery assertions.

Refs openclaw#155040. Reproduced the PR openclaw#156189 run 35834470541 typing-only failure at the native idle boundary; the same case passes with the fixture header. Linux proof includes 30 delayed-response stress trials, 243 tests across 13 files, check:changed, and independent review.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…igns (openclaw#156316)

## Problem

Agents keep adding tests that restate implementation or repeat the same contract across layers, and `test-audit` had no repeatable workflow for pruning a whole subsystem's tests.

## Fix

The `test-audit` authoring gate now checks new tests against a shared junk-pattern list (tests the retention bar protects are exempt). It requires one primary test per contract at its strongest boundary and one regression per bug. A new campaign mode (`CAMPAIGN.md`) records the step order from the Telegram cleanup in openclaw#155040.

## User impact

No user-visible change. Agents writing tests reject known junk patterns, and maintainers can run the same subsystem-wide test cleanup on other areas.

## Proof

A fresh read-only agent ran the revised skill on `extensions/policy`: 7 lanes, a 329-declaration ledger (296 retain, 26 consolidate, 7 delete), one test-only seam flagged for a maintainer decision, and both deliberately junk test proposals correctly rejected by the authoring gate. Ambiguities it found were fixed in the final commit.

Co-authored-by: Ayaan Zaidi <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
amittell added a commit to amittell/openclaw that referenced this pull request Oct 1, 2026
Carries openclaw#132409 ("fix(channels): preserve messages stalled
before adoption", open; issue openclaw#127229, P1 message loss) onto the 9.6 carry.
Applied as diff(9a4114b..217ef6a), the PR's own base to its
Sept 10 head, by 3-way merge onto 1d5d6c8.

Why that head and not the Sept 27 merge head cc8f0d0: the 9.6 tag's
ingress files equal main of 2026-09-22 (814a7e7). cc8f0d0 merges
main of 09-27 and integrates the PR with openclaw#158637's claim custody through
settlement, which the tag does not have; applied here it conflicts in 4
production files. 217ef6a predates openclaw#158637, applies with one import
conflict, and has a green hosted CI run (34543782080). The 09-27 head adds
an abort-aware quiescence wait and idle-wake accessors that only openclaw#158637's
retained owner and main's reworked monitor use. On this tree the owner is
deregistered at abort, so a replacement drain recovers the claim at once;
settleStalledClaim checks isStopped() only between attempts, so an attempt
already waiting for quiescence still makes its one release write after
stop, and the claim token fences that write.

What it fixes on the bots: a second update from the same chat waits in
grammY sequentialize behind a deferred handler with no heartbeat. At the
300 s adoption watchdog the drain released it for retry while the first
callback was still blocked; the retry met the in-process update tracker
as a duplicate, returned no outcome, and the row was completed without a
recorded processing outcome (rh-bot, updates 735980139 and 735980143,
2026-09-29). Now the stalled claim keeps its lease and heartbeat until the
old dispatch and deferred bookkeeping quiesce, then settles the retry; a
separate stall-settlement wake repumps the monitor; Telegram's tracker
records an owner-aborted deferred update as incomplete.

Conflict resolution:
- ingress-monitor.ts: import-only; the fork's split imports kept, the
  wake scheduler import added.
- ingress-drain.watchdog.test.ts: main's two tests added after 09-08 kept;
  in the PR's rewritten "rearms a live deferred wait" test the tag's
  1_666 ms heartbeat-cadence assertion is kept (cc8f0d0 dropped it).
- polling-session.test.ts: the PR's hunk for "requeues buffered spooled
  claims when deferred processing times out" is not applied. At the tag
  the deferred participant settles itself on owner abort (openclaw#150080), so
  the claim is released at the stall without a manual settle; main later
  deleted the test (openclaw#155040).

ingress-drain.ts equals 217ef6a plus exactly the tag's own 09-08..09-22
drift; drain-state, drain-wake, drain.test, zalouser and mattermost tests
are byte-identical to 217ef6a.

Original implementation by PollyBot13, with the maintainer fixup in
217ef6a; see openclaw#132409. Drop this commit when an upstream equivalent
reaches the fork's base tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram commands Command implementations extensions: qa-lab maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: accepted-large Maintainer-accepted large change; exempts ClawSweeper size closure, not review or CI. size: XL 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.

Prune low-value Telegram tests while preserving behavioral contracts

2 participants