Skip to content

refactor: share channel binding session classification - #190957

Merged
roboclaw-bot merged 5 commits into
mainfrom
refactor/channel-fork-binding-owner
Nov 3, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
refactor/channel-fork-binding-owner

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Discord, Telegram and Matrix duplicate ordinary-session versus ACP classification. Landing CI also exposed a pre-existing Matrix restart failure: a queued turn could invoke callbacks after its plugin consumer was released.

User Impact

Preserve ordinary-session binding lifecycle, canonical ACP/subagent fast paths, main/global metadata aliases and approved opaque plugin targets without arbitrary agent ownership. Unreadable storage and revoked authority still refuse. Queued inbound turns now retain plugin custody through observation/delivery and settlement, rather than producing a closed-consumer failure.

Why This Change Was Made

One SDK-private classifier behind the existing thread-bindings-session-runtime facade serves all three adapters. The old core implementation/test are removed. Storage stays lazy via the narrow existing reader; managers retain effect authority. Public-operation fixture seams delegate to real classification; private reader policy tests remain SDK-owned. No new public subpath, API/test hook, registry, manager, store, schema, config, dependency or permission policy.

Same-target/public-kind refresh ownership persists without inheritance across child placement, replacement targets or kind changes. Native/action hints are not replayed from stored metadata.

Current head cbf3d3b adds the owning runtime fix to the reviewed classifier baseline e986cb3. Matrix supplies a top-level adoption lifecycle; core selected it instead of the custody-bound resolved-turn lifecycle. Deferral therefore never retained custody. The repair binds custody at that actual selection point while preserving prepared-turn identity and the closed-consumer guard.

Evidence

Queued-ingress lifecycle repair

  • Original owner negative control:13 passed,1 failed with closed-consumer error after deferral, dispatch return and queued observation. Final owner suite:14/14 passed,39.24s runner wall.
  • Core production and affected test type graphs, touched-source lint/format, exact test-line guard and whitespace passed. Three-file final manifest verified before and after commit. Test credit62 covers actual new regressions; no shared scalar or exception changed.
  • Fresh independent final-candidate review and required local P0-P2 autoreview both completed clean. Final source hashes match the tested/reviewed candidate.
  • Isolated QA delivered all three Matrix restart markers and settled the remote run. That execution precedes only the final type-safe optional-custody narrowing; it is not labeled exact-final-source QA. The deterministic owner negative control is causal proof; a passing replay alone is not called a fix.
  • Scheduled main8051834 showed the identical original error before this classifier existed. Original F CI41490754249 remains failed, not relabeled green. Its accepted request was retired through the native owner before replacement; new-head CI and explicit replacement recovery remain required.

Classifier baseline e986cb3 — retained source-bound proof

Pinned main d6c8ad3 is an ancestor. Six prerequisite conflicts used exact reviewed/tested bytes after confirming no subsequent main edits to those paths. Incremental baseline14 paths,+455/-173 centralizes responsibility, not an overall LOC reduction.

  • Node130 (binding/real-producer96 plus SDK/core34),112.14s; pinned Bun96,142.12s. Required siblings119 passed:77 before restart plus42 recovered Discord cases163.48s. Interrupted SIGTERM proof remains an interruption. TLS/egress guards were unchanged.
  • Relevant types3.81s, lint/format102.65s, global4,920-file extension guard and all nine ratchets138.07s passed. Classifier credit103+166=269 was recomputed after landed prerequisite credit; repair adds62, not a scalar increase.
  • Baseline full build368.80s, SDK inventory/export/subpaths and zero runtime value cycles passed. Existing private-local facade and all161 typed public entrypoint source blobs match the base. No full revision-render API comparison is claimed.
  • Complete-context baseline P0-P2 review:14 paths/50 frozen context files,39.04s, scoped-clean. Three committed cold snapshots qualified8.11s at e986; dependency closure was not attested. These are not a new cbf3 build or performance-parity claim.
  • A rejected broad-facade variant added199 first-use modules/2,021,394 bytes. Accepted narrow-source proof restored the earlier private-leaf814-module/9,441,392-byte multiset exactly; fast paths add none. This is prior-input scope, not statistical new-main latency/RSS parity.
  • Original per-file Node walls: classifier12/3.15s, Discord22/51.66s, Telegram35/65.58s, Matrix27/45.16s. Local walls do not represent hosted CI seconds.

Landing

The ordinary binding prerequisite is landed. Current-head CI/security/native admission and retained-request replacement recovery are required. No native Discord/Slack or operator Gateway deployment is claimed. Private-QA dist is not a public packaging candidate.

@clawsweeper

clawsweeper Bot commented Nov 2, 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 docs Improvements or additions to documentation channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram size: M labels Nov 2, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR centralizes ordinary-session, ACP, and subagent binding classification for Discord, Telegram, and Matrix.

Example: Bind the main alias for agent ops when its session metadata identifies ACP ownership.

  • Before: Each channel independently classifies the binding as acp.
  • After: The shared classifier produces the same acp classification.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported consolidation with reported in-process validation and no actionable introduced defect; supplied evidence does not exercise a shipped channel entry point.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored refactor is outside the ordinary contributor proof gate; supplied evidence reports classifier and channel-manager tests, build and cold-import checks, and explicitly excludes new native-channel traffic.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated channel classification logic can drift and assign inconsistent lifecycle behavior to equivalent binding targets.
Reason: The collaborator-authored direction consolidates an existing shared responsibility with a complete caller cutover and unchanged user contracts.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored draft open: the extraction consolidates three equivalent classifiers without an actionable introduced defect, and remains stacked on an open prerequisite.

Priority: P3
Reviewed head: 7061fd1e37ee2567f4ba6ecaecb89c118dfb685c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped channel run is supplied for the extraction; ordinary real-behavior proof is not required for this collaborator-authored PR.
Agent review details

How this fits together

Channel binding adapters pass target keys, metadata, and current-authority callbacks to the shared binding owner, then their existing managers create native threads and persist binding records.

flowchart TD
  A[Binding request] --> B[Channel adapter]
  B --> C[Shared target classifier]
  C --> D[ACP metadata reader]
  C --> E[Channel binding manager]
  E --> F[Native thread and binding store]
Loading

Technical review

Best possible solution:

Keep one classifier in the existing binding adapter owner while preserving channel-owned persistence and final-effect authority checks.

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

This is a refactor; source comparison establishes equivalent classification branches, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The extraction is appropriately placed in the existing shared owner, removes all three replaced implementations, and introduces no competing state or manager.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Discord, Telegram, and Matrix classification keeps the original intent (26fa359: The prerequisite distinguishes ordinary bindings from ACP ownership while retaining explicit subagent and canonical ACP fast paths.)
  • Shared binding adapter ownership keeps the original intent (2fec39f: Centralize shared binding projection and dispatch while leaving platform storage, expiry, and delivery policy with their existing owners.)
  • Worker-backed metadata reader and test fixtures keeps the original intent (ac4c248: Keep ACP metadata operations off the Gateway thread while preserving source authority and read-failure semantics.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2fec39f adds src/infra/outbound/session-binding-adapter.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2fec39f57319; files: src/infra/outbound/session-binding-adapter.ts)
  • BTofu: Raw commit 2a30b52 adds extensions/telegram/src/thread-bindings.ts:89 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2a30b52a603e; files: extensions/telegram/src/thread-bindings.ts)

PR surface

Source -6, Tests +103, Docs +10, Other +1. Total +108 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 74 80 -6
Tests 4 114 11 +103
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 11 199 91 +108

Review metrics

Metric Value Why it matters
Production versus test growth Production +74/-80; tests and fixtures +114/-11. Production shrinks by six lines; the 103 added test and fixture lines cover classifier boundaries and migrate existing reader mocks.

Labels

Label changes:

  • add P3: This is a behavior-preserving internal consolidation without a new user-facing capability or an urgent introduced failure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a behavior-preserving internal consolidation without a new user-facing capability or an urgent introduced failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 2, 2026, 2:52 AM ET / 07:52 UTC.

Base automatically changed from feat/channel-fork-bindings to main November 2, 2026 16:07
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 2, 2026 17:23
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) November 2, 2026 17:33
@roboclaw-bot
roboclaw-bot disabled auto-merge November 2, 2026 17:44
@roboclaw-bot
roboclaw-bot merged commit 1f161cf into main Nov 3, 2026
136 checks passed
@roboclaw-bot
roboclaw-bot deleted the refactor/channel-fork-binding-owner branch November 3, 2026 09:30
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
* fix(channels): preserve ordinary thread session bindings

Co-authored-by: vincentkoc <[email protected]>

* refactor: centralize thread binding target classification

Co-authored-by: vincentkoc <[email protected]>

* refactor(sdk): isolate thread binding classification and fixtures

Co-authored-by: vincentkoc <[email protected]>

* fix(channels): retain plugin custody for queued inbound turns

Co-authored-by: vincentkoc <[email protected]>

---------

Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: matrix Channel integration: matrix channel: telegram Channel integration: telegram docs Improvements or additions to documentation P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

1 participant