Repository navigation
refactor(plugins): root-owned conversation-binding pending requests - #118075
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 1:22 PM ET / 17:22 UTC. ClawSweeper reviewWhat this changesThis PR makes pending plugin conversation-binding approvals module-owned, clears them during gateway shutdown, and removes tests and fields tied to the retired process-global Symbol map. Merge readinessKeep this PR open for explicit maintainer handling: it has the protected Priority: P2 Review scores
Verification
How this fits togetherPlugin conversation binding creates an approval request during a command or interaction, then a later Telegram, Discord, or Slack callback resolves it. The request state must survive that cross-request interval but must not survive gateway shutdown or a subsequent gateway lifecycle. flowchart LR
A[Plugin requests conversation binding] --> B[Pending approval state]
C[Telegram Discord or Slack callback] --> D[Resolve approval]
B --> D
E[Gateway shutdown] --> F[Clear pending approvals]
F --> G[Fresh next gateway lifecycle]
Decision needed
Why: The Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests -1. Total -3 across 5 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the lifecycle-owned module slot only after exact-head build/runtime evidence confirms core and plugin-SDK callback paths share one emitted instance and gateway shutdown turns a pending approval into the existing Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal ownership refactor, not a reported user-facing defect. Source inspection establishes the relevant state flow from request creation through channel callbacks and gateway shutdown. Is this the best way to solve the issue? Yes, conditionally: putting gateway-lifetime pending requests in a lifecycle-cleared module slot is the narrower canonical owner boundary, provided the unified output truly gives all supported consumers the same module instance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 492b8841c837. 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
|
|
Exact-head operational proof for the two remaining review items (head Single-emission invariant (exact-head build output). Shutdown transcript (dist-driven, ephemeral gateway, isolated
Exact-head CI: green (all checks on |
|
Merged via squash.
|
What Problem This Solves
src/plugins/conversation-binding.tsheld its pending-approval requests in a process-global Map guarded by aSymbol.forglobal-registry slot — the last survivor of the shared-globals pattern the plugin lifecycle series (#117372, #117587, #117749) removed elsewhere. The Symbol indirection existed to survive a split-module emission bug that no longer exists, and the map had no lifecycle owner: nothing cleared it on gateway shutdown.Why This Change Was Made
This is the pattern pilot for the remaining ambient-state sites. The Symbol originated in
65594f972c2cafter a real external-Codex/lazy-Telegram split-module duplication failure. That risk is gone in the supported graph:tsdown.config.tsbuilds core, SDK subpaths, and bundled plugins in one unified emission specifically so singletons emit once. Verified against built output — a singledist/conversation-binding-*.jschunk imported by both SDK entrypoints, and the retired Symbol string appears nowhere in dist.State analysis: pending approvals are cross-request, gateway-lifetime state (one request writes; a later channel callback reads and synchronously deletes). Not plugin contribution data (registry bundle), not request-local (ALS scope). The right owner is a lifecycle-owned module slot: deep SDK call paths keep ambient access, and the gateway root clears the slot during terminal shutdown (
src/gateway/server-close.ts). The rent note at the slot documents the contract.Also removed: the obsolete Symbol reset in tests, a synthetic cache-busted pending-request test that only proved the retired mechanism, and the unused
requestedAtfield (no TTL, no reader).User Impact
None visible. Pending conversation-binding approvals behave identically; gateway shutdown now deterministically drops any orphaned pending requests instead of leaking them process-wide.
Evidence
vi.mocksweep🤖 Generated with Claude Code