Repository navigation
fix(qa-channel): preserve conversation kind for implicit actions - #137343
Conversation
Keep the QA current target kind-qualified at its context producer while preserving native/root identity, separate thread metadata, shared target precedence, and existing authority checks. This prevents targetless direct and group replies from becoming channel sends and prevents same-ID foreign-kind resource reads. Cover the real QA ingress/message-tool/bus boundary, explicit targets, source-only scope, and root/thread opt-outs. No public or persistent contract changes. Fixes #137339
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 11:45 AM ET / 15:45 UTC. ClawSweeper reviewWhat this changesThe PR preserves direct, group, and channel identity for targetless QA message actions and adds delivery, scope, and threading regression coverage. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this focused QA-channel repair open. Current main has not superseded its four changed paths, and the producer-bound fix preserves typed roots while retaining thread opt-outs; no blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe QA channel is OpenClaw’s synthetic HTTP transport for testing inbound messages and outbound delivery. Its threading context feeds the shared message tool, which selects a conversation before the QA bus records the action. flowchart LR
A[QA inbound message] --> B[Inbound context]
B --> C[QA threading context]
C --> D[Shared message tool]
D --> E[QA action handler]
E --> F[QA outbound bus]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1, Tests +314, Docs +1. Total +316 across 4 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Merge the QA-owned typed-root repair once normal exact-head CI completion permits it, keeping shared target selection and native transport behavior unchanged. Do we have a high-confidence way to reproduce the issue? Yes—high-confidence source reproduction is defined by the new QA ingress-to-bus fixture, and the supplied before/after evidence reports the pre-fix wrong-kind cases. Is this the best way to solve the issue? Yes—the QA threading-context producer owns the lost kind, while the shared message tool and Slack’s distinct native-target handling remain unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aa78c175b966. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Import the existing QA Lab public barrel so the real-bus regression obeys the root test boundary. Keep the guard and production repair unchanged.
|
Land-ready verification for head
Focused CI-repair command: node scripts/run-vitest.mjs test/extension-test-boundary.test.ts test/qa-channel-message-tool-delivery.test.tsPreviously completed owner/sibling proof: 436 tests across QA/shared/Slack/authority surfaces; full changed checks; private QA runtime build. The original-producer negative control still records five expected failures against five passing controls. No public/persistent contract or authority change, and no operator Gateway/state was used. Ordinary implicit QA thread inheritance remains the separately scoped follow-up. Proceeding through native review artifact validation, |
|
Merged via squash.
|
* refs/remotes/origin/main: fix(plugins): reject unverifiable pinned npm installs (#136725) improve(ui): lift sidebar section headers on hover and mark online owners (#136985) test(cron): reuse isolated run suite hooks (#137341) test(channels): reuse shared indexed call guards (#137350) fix(ui): sidebar header controls read misaligned after the + button lost its border (#137317) fix(qa-channel): preserve conversation kind for implicit actions (#137343) fix: target the source checkout in Control UI repair commands (#137354) chore: reduce CI job count and database test overhead (#137352) fix(ios): preserve chat live edge across keyboard transitions (#136660) refactor(control-ui): consolidate mention inbox requests (#137375) fix(openai): preserve ChatGPT HTTP status for retry pacing (#137146) fix(mcp): hide policy-denied plugin tools from ACP sessions [AI] (#136546) test(queue): reuse shared deferred fixtures (#137338) fix(gateway): repair the Gateway E2E shard (browser suite project, skill resource argv, Codex diagnostic) (#137358)
…nclaw#137343) * fix(qa-channel): preserve conversation kind for implicit actions Keep the QA current target kind-qualified at its context producer while preserving native/root identity, separate thread metadata, shared target precedence, and existing authority checks. This prevents targetless direct and group replies from becoming channel sends and prevents same-ID foreign-kind resource reads. Cover the real QA ingress/message-tool/bus boundary, explicit targets, source-only scope, and root/thread opt-outs. No public or persistent contract changes. Fixes openclaw#137339 * test(qa-channel): use public QA Lab API for delivery proof Import the existing QA Lab public barrel so the real-bus regression obeys the root test boundary. Keep the guard and production repair unchanged.
…law#137964) Reuse the QA native target matcher for automatic thread and reply scope. Preserve explicit targets, account boundaries, top-level opt-outs, and the shared selector behavior. Closes openclaw#137929. Related: openclaw#137343.
Closes #137339
Additional instructions
This same-repository branch remains writable by maintainers.
What Problem This Solves
Fixes an issue where QA-channel replies sent without an explicit destination could appear in a channel conversation instead of the original direct or group conversation, even though the conversation ID, account, text, and reply reference were correct. The same kind loss could make targetless resource actions select a same-ID message from the wrong conversation kind.
Why This Change Was Made
Preserve the conversation kind at QA's threading-context producer by encoding the native/root ID with the existing target builder. The default target remains an unthreaded root, while the full messaging target and thread metadata stay separate. This repairs the input consumed by the shared message-action flow without changing shared target precedence, parser defaults, or authorization.
Globally preferring the messaging target would break native-channel resource actions in transports such as Slack. Copying a threaded target into the default would also defeat explicit root opt-outs. The QA-owned producer is the narrow canonical repair.
Production LOC: +17/-16 (net +1). Consolidating duplicate kind selection makes executable code net -1; two invariant-comment lines explain why the root must remain unthreaded. Tests: +325/-11 (net +314). Documentation: +1.
Maintainer decision on ClawSweeper's remaining merge-risk item: retain the +1 net line. The two comment lines protect the root/thread opt-out invariant, while executable code shrinks. No additional guard, fallback, helper, or public surface is introduced; deleting the invariant explanation just to reduce the raw count would make the repair worse.
User Impact
Repo-local QA runs preserve direct/group/channel identity for implicit replies and keep same-ID foreign-kind messages outside the selected resource-action scope. Explicit destinations and root/thread opt-outs remain intact. The QA channel documentation records the behavior.
No public API, configuration option, schema, persistent representation, dependency, source-custody policy, or native execution-authority change. No claim that real Slack/Discord transports had this QA-specific defect. Pre-existing ordinary QA implicit-thread inheritance remains a separate follow-up.
Evidence
The final ten-case regression fixture fails five cases on the original producer and passes all ten with this repair. Failures are wrong-kind direct/group/source-only replies and incorrectly accepted same-ID foreign-kind reads; explicit DM and root/thread controls remain passing. The original producer was restored only for the negative control, then the identical repair patch was reapplied.
The regression uses actual QA HTTP ingress, account polling, session recording, shared message-tool/action dispatch, and HTTP bus readback. It reuses the real loaded plugin for bootstrap metadata instead of source-JIT loading a second copy; it does not mock target parsing, authorization, or delivery, and does not increase a timeout.
An additional 436 tests across nine focused files passed: QA action/threading contracts, shared normalization/threading, exact-current message-action security, capability expiry/revocation, message-tool source/account/hidden-text guards, agent-runner context, and Slack native/routable target behavior.
Changed checks, the private QA runtime build, and
git diff --checkpassed. Fresh isolated Codex autoreview is scoped-clean at its configured P0 priority. Initial fixture placement/type/lint failures were fixed without changing guards, baselines, or tsconfig rules.The first CI run caught one additional test import-boundary violation: the root fixture used QA Lab's
bus-api.jsrather than its accepted publicapi.jsbarrel. Both already export the same bus implementations. The test now usesapi.js; the unchanged boundary guard and all ten delivery cases pass (20 tests total), as do root-test typecheck, targeted lint, and a fresh review of that correction. Production bytes and the real mock-Gateway proof below are unchanged.Real mock-Gateway behavior proof
An actual built Gateway, the real QA plugin/bus, and a loopback mock OpenAI-compatible provider processed three ordinary inbound turns. The provider saw the real message schema and called
messagewith onlyactionandmessage—no target or recipient. All three turns produced exactly one visible message with the exact nonce, account, conversation ID/kind, and inbound reply ID; no thread or attachments were introduced.{ "status": "pass", "proofKind": "real-built-gateway-with-loopback-mock-provider", "runtime": "openclaw", "buildBase": "01cf9f25bde3e5bc1f377109d6e6c8421e7f3228", "candidateQaSourceSha256": "a69a70426953eb94b316c1eaf3ab1a151f9e49d6a75d756984f6c463e0daf07c", "tool": "message", "argumentKeys": ["action", "message"], "cases": [ {"inboundKind": "direct", "outboundKind": "direct", "visibleResults": 1, "status": "pass"}, {"inboundKind": "group", "outboundKind": "group", "visibleResults": 1, "status": "pass"}, {"inboundKind": "channel", "outboundKind": "channel", "visibleResults": 1, "status": "pass"} ], "account": "default", "dmScope": "per-channel-peer", "exactNonceAndReplyToId": true, "threadsOrAttachments": false, "sourceAndBuildCustodyUnchanged": true, "cleanup": "gateway, bus, provider stopped; owned ports closed; temporary runtime removed" }The build base plus unchanged candidate source/build digests bind this pre-commit run to the repair; this is not a fresh authenticated native Codex/provider run. The selected mock runtime did not expose
final, so the provider did not fabricate that argument. Existing boundary coverage separately exercisesfinal: true. The exact upstream Codex 0.152.1 JSON argument-forwarding source was personally inspected during attribution; no Codex-side change is proposed.Proof used isolated synthetic home/state/workspace and non-default loopback ports, with live auth environment removed. Team, operator gateways/state, and real channel accounts were untouched. Original failures remain recorded as failures; the original observation's unrelated SQL instrumentation was not used as delivery proof.