Repository navigation
refactor(channels): own thread binding cleanup in managers - #124221
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 15, 2026, 2:17 PM ET / 18:17 UTC. ClawSweeper reviewWhat this changesThis PR makes Telegram and Matrix managers clear their own live thread bindings on stop, replaces aggregate test resets with explicit manager teardown, and removes Telegram’s obsolete test sidecar. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this protected maintainer PR open. The lifecycle repair is coherent, but its new Telegram contract load bypasses the standard public facade and the tests do not directly prove the live-binding cleanup it changes. Priority: P2 Review scores
Verification
How this fits togetherTelegram and Matrix account managers maintain in-memory conversation-to-session bindings while accounts run. Stopping an authoritative manager should discard only live state, while persisted rows are reloaded on the next manager startup. flowchart LR
A[Channel account starts] --> B[Thread-binding manager]
B --> C[Live binding map]
B --> D[Persisted binding store]
E[Account stop] --> F[Authoritative manager check]
F --> C
D --> G[Bindings reload on restart]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +8, Tests -5. Total +3 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the standard bundled public facade for Telegram and add focused tests proving transient bindings disappear on stop, persisted bindings reload, and a stale manager cannot clear a replacement. Do we have a high-confidence way to reproduce the issue? Yes, from source: on current main, bind a non-persistent Telegram conversation and stop its authoritative manager; the manager is removed but the live binding remains. This read-only review did not execute that scenario. Is this the best way to solve the issue? No: manager-owned cleanup is the right design, but the new core contract load must use the public facade and the changed live-state behavior needs direct regression proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8f59226bc93a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for
The latest ClawSweeper comment reviewed the prior head and listed exactly the two items above: #124221 (comment). Both rank-up moves are applied; the post-review commit contains only those requested proof/boundary corrections. Known proof gaps: none for this internal manager-lifecycle refactor. No SQLite schema, protocol, docs, changelog, or live-channel behavior changed. |
|
Merged via squash.
|
…124221) * refactor(channels): own thread binding cleanup in managers * test(channels): prove thread binding lifecycle cleanup
What Problem This Solves
Telegram and Matrix thread-binding tests relied on aggregate reset functions that stopped every manager and cleared global maps. Telegram’s production
stop()removed the adapter/manager but left live account bindings behind, so the test reset—not the lifecycle owner—was responsible for invalidation. Core contract tests also loaded a Telegram test-only sidecar solely to call that reset.Why This Change Was Made
The currently registered manager generation now owns live binding cleanup in
stop(). Persisted rows are intentionally untouched and reload on restart; non-persisted bindings disappear. The authoritative-manager check prevents a stale retained manager from clearing a replacement generation.Tests retain and stop the managers they create. Telegram restart cases now stop and recreate the manager, including persisted unbinds, metadata, stale ACP cleanup, read failures, and lifecycle updates. Matrix tests use the existing
stop()owner. The core registry contract retains Matrix/Telegram managers, loads Telegram through its realchannel-plugin-api, and deletes Telegram’s obsoletesession-binding-contract-api.tssidecar.User Impact
Account shutdown no longer leaves stale live Telegram binding rows in process memory. Persisted binding behavior is unchanged and remains covered across restart. Matrix keeps its existing lifecycle behavior with a stronger authoritative-generation guard.
Evidence
--isolate=false— 32 passedchannel-plugin-api.jsthrough the standard bundled-plugin public facadenode scripts/check-changed.mjs -- <changed files>— passed via the documented local fallback; core/extension type checks, lint, dead exports, runtime sidecars, plugin boundaries, auth guards, native schema guard, and import cycles were greenpnpm build— passed, including bundled artifact generation after deleting the Telegram sidecargit diff --check— passedProduction delta: -10 net lines. Test/test-support delta: +70 net lines. Total delta: +60 lines; the test-support growth replaces reset APIs with explicit manager lifecycle ownership and adds pre-fix-failing lifecycle proof. No SQLite schema, protocol, docs, or changelog change is required.