Skip to content

fix: avoid bundled plugin discovery after selecting a message channel - #147492

Merged
shakkernerd merged 2 commits into
mainfrom
fix/selected-target-alias
Sep 13, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
fix/selected-target-alias

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Message routing can discard target-alias metadata after selecting a channel adapter. A missing alias specification from that adapter was treated as a reason to look up bundled metadata, while some target-presence checks consulted the bootstrap adapter even when selected aliases were available.

That mixes two sources of truth. An installed adapter can have different aliases from the bundled adapter with the same channel ID. Its native destination can be overlooked, or an unrelated bundled field can be interpreted as a destination. In the Gateway send regression, overlooking the selected alias causes an account-default target to be inserted; normalization then rejects the conflicting destinations. The fallback also loads bundled plugin code unnecessarily: a source-checkout Slack read with limit=1 spent most of its time in this discovery path.

User Impact

Message actions consistently use the selected adapter's destination metadata. Selected aliases are recognized, an adapter's known absence of aliases stays absent, and account defaults or session-derived destinations are used only when appropriate. Poll-echo and group-reply routing use the catalog captured by the tool.

Callers that have not selected an adapter or captured a catalog retain bootstrap discovery. Account validation, cross-context checks, and final dispatch authority remain in their existing owners; this change does not add plugin grants or change read-authority lifetime, configuration, persistence, or the public SDK contract.

Why This Change Was Made

The selected adapter or captured catalog already owns this information. The internal alias helpers now distinguish an alias specification, known absence (null), and no selection (undefined). Only the last state permits bootstrap discovery.

That same fact is carried through normalization, target-presence and resource checks, session destination recovery, poll-echo/group-reply handling, and the Gateway's default-target decision. Core legacy aliases and cheap screening of standard message parameters remain intact. No new registry or cache is introduced.

The regression fixtures also declare aliases on the selected adapter. In particular, the shared list-pins fixture previously declared chatId only in its bootstrap mock; correcting that fixture preserves its existing dispatch assertion without restoring the faulty fallback.

Evidence

  • Eight regressions fail on main 7a7549b1aad and pass after this repair. They cover selected aliases and absence, resource-versus-delivery handling, canonical session destination recovery, a retained poll catalog after registry replacement, and Gateway default-target conflicts. Existing controls cover unselected discovery, conflicting targets, implicit-target exclusions, opaque resource IDs for direct operators, and poll account/route/expiry boundaries.
  • Remote message-tool, normalization, and Gateway suites passed 495 tests. node scripts/run-vitest.mjs src/infra/outbound/message-action-*.test.ts --reporter=dot passed all 479 action tests after the fixture correction.
  • On final head 2dea84a9518, Testbox passed node scripts/check-changed.mjs --base 7a7549b1aad, pnpm build, and pnpm test:contracts:channels. Final-head CI is green, including build, type, lint, guard, and contract checks. Independent review found no blocking issues; ClawSweeper reviewed that exact head as Platinum.

The native timing comparison ran the message tool, caller wrapper, dispatcher, and bundled Slack adapter against a synthetic HTTP server on the same Linux VM, with Node 24.19.0 and pnpm 12.3.4. Both revisions completed the limit=1 read.

Profiled source-checkout measurement Before After
Read-test duration 145.749 s 0.116 s
CPU-profile time attributed to alias-triggered bundled discovery 140.63 s None

These are instrumented source-checkout fixture measurements, not installed-user latency estimates. The comparison used a local HTTP fixture, not an external Slack service.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:34 PM ET / 23:34 UTC (Revision 4).

ClawSweeper review

What this changes

The PR preserves the selected channel adapter’s destination aliases throughout message routing, avoiding conflicting defaults and unnecessary bundled-plugin discovery.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: fetched main and the latest release retain the faulty discovery fallback. No blocking correctness or security finding was identified, and the prior review has no unresolved findings.

Priority: P2
Reviewed head: 2dea84a95188c71f416b63a7634fdf93955df9ea

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful regression coverage, reported build and contract validation, and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate, and no material authority change triggers an exception. Its reported Linux fixture exercises the production message-tool and Slack dispatch path and shows reduced discovery time; it does not claim live Slack coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate, and no material authority change triggers an exception. Its reported Linux fixture exercises the production message-tool and Slack dispatch path and shows reduced discovery time; it does not claim live Slack coverage.
Evidence reviewed 9 items Introduced change verified: The local merge-base-to-head comparison matches the supplied introduced file set. The later commit only declares list-pins aliases in the selected test fixture; it does not alter the previously reviewed production code.
Current main still needs the repair: Fetched main still invokes bootstrap discovery in target-presence checks and treats missing selected aliases as permission to discover bundled aliases. Its Gateway default-target check also lacks the selected alias specification.
Latest release retains the fallback: The v2026.9.4 implementation also uses bootstrap lookup for target checks and nullish fallback for selected alias metadata; the requested repair is not present there.
Findings None None.
Security None None.

How this fits together

OpenClaw’s message tool and Gateway translate message-action arguments into channel destinations. Selected plugin metadata guides normalization before existing account, conversation, and dispatch checks run.

flowchart TD
  A[Message tool or Gateway request] --> B[Selected channel metadata]
  B --> C{Adapter already selected?}
  C -->|Yes| D[Use selected aliases or known absence]
  C -->|No| E[Discover bootstrap aliases]
  D --> F[Normalize destination]
  E --> F
  F --> G[Validate account and conversation]
  G --> H[Dispatch channel action]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +120. Total +161 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 71 30 +41
Tests 5 129 9 +120
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 200 39 +161

Review metrics

None.

Technical review

Best possible solution:

Keep destination interpretation with the selected adapter and reserve bootstrap discovery for callers that have not selected one.

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

Yes, from source: a selected send adapter with a roomId alias can have that destination overlooked and an account default inserted, causing normalization to reject conflicting targets. Tests were inspected but not executed during this read-only review.

Is this the best way to solve the issue?

Yes. Carrying the existing selected metadata, including known absence, repairs the shared owner boundary without adding another registry, configuration option, or public plugin API.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes bounded message-destination conflicts and unnecessary discovery work without evidence of a widespread urgent outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate, and no material authority change triggers an exception. Its reported Linux fixture exercises the production message-tool and Slack dispatch path and shows reduced discovery time; it does not claim live Slack coverage.

Evidence

What I checked:

  • Introduced change verified: The local merge-base-to-head comparison matches the supplied introduced file set. The later commit only declares list-pins aliases in the selected test fixture; it does not alter the previously reviewed production code. (src/infra/outbound/message-action-runner.test-helpers.ts:208, 2dea84a95188)
  • Current main still needs the repair: Fetched main still invokes bootstrap discovery in target-presence checks and treats missing selected aliases as permission to discover bundled aliases. Its Gateway default-target check also lacks the selected alias specification. (src/infra/outbound/message-action-spec.ts:125, 88112a840a43)
  • Latest release retains the fallback: The v2026.9.4 implementation also uses bootstrap lookup for target checks and nullish fallback for selected alias metadata; the requested repair is not present there. (src/infra/outbound/message-action-spec.ts:125, 3a9d69db306c)
  • Single metadata owner with existing authorization: The internal helper distinguishes selected absence from unselected discovery. Route preparation supplies the selected plugin’s metadata while retaining explicit-account validation, cross-provider policy, external-action preparation, and cross-context enforcement. The public channel adapter type is unchanged. (src/infra/outbound/message-action-routing.ts:381, 2dea84a95188)
  • Regression coverage reaches the Gateway send boundary: The added roomId case exercises message.action and asserts one canonical delivery to owner-room instead of an injected account default. Nearby controls cover default-account routing and rejection when runtime authority closes before dispatch or handoff. (src/gateway/server-methods/send.test.ts:4509, 2dea84a95188)
  • Captured validation and performance evidence: The supplied body snapshot, sourceRevision d96cb0ed4b0d74e4eaa0046e1f95edc0719144b3e102248d226a9a3539ed36a6, reports eight failing-before regressions, passing focused suites, final-head build and channel contracts, and a Linux source-checkout Slack read through the message tool, wrapper, dispatcher, and bundled adapter against synthetic HTTP. Reported duration changed from 145.749 s to 0.116 s. These are contributor-reported fixture measurements, not independently executed live Slack or installed-user results. (2dea84a95188)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Omar Shahine: 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 (3 earlier review cycles)
  • reviewed 2026-09-13T22:45:50.950Z sha e471f75 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T23:01:21.040Z sha 2dea84a :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T23:23:50.085Z sha 2dea84a :: needs maintainer review before merge. :: none

@shakkernerd shakkernerd self-assigned this Sep 13, 2026
@shakkernerd
shakkernerd merged commit 8577a92 into main Sep 13, 2026
204 of 205 checks passed
@shakkernerd
shakkernerd deleted the fix/selected-target-alias branch September 13, 2026 23:34
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: message routing preserves the selected channel's target aliases without rediscovering bundled plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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