Repository navigation
refactor(channels): move inbound turn execution into core - #110095
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d36c9e3f72
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d36c9e3 to
abdaf13
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 7:46 PM ET / 23:46 UTC. Summary PR surface: Source -44, Tests +214, Other +8. Total +178 across 63 files. Reproducibility: not applicable. This PR refactors established inbound-turn behavior rather than reporting a separately reproducible product bug. The relevant verification is observing unchanged channel delivery and lifecycle behavior on the final head. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Retain the core-owned turn-plan architecture, then obtain one redacted final-head Telegram/Desktop or equivalent live channel proof after the latest code change, or have a responsible maintainer explicitly accept the existing behavior-neutral test-only proof basis before merge. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors established inbound-turn behavior rather than reporting a separately reproducible product bug. The relevant verification is observing unchanged channel delivery and lifecycle behavior on the final head. Is this the best way to solve the issue? Unclear: the core-owned plan boundary is consistent with the merged predecessor at #109716, but final-head real behavior evidence is still needed before calling this the best proven implementation path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 82fa956d5a22. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source -44, Tests +214, Other +8. Total +178 across 63 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (9 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Maintainer proof override for final head The focused proof covers each changed lifecycle invariant: normal dispatch and delivery-plan execution; session record/finalize ordering; durable delivery and retry; asynchronous delivery-error cleanup; bot-loop and history finalization; Plugin SDK surface preservation; and observe-only turns returning zero visible counts without a visible dispatch signal. The final observe-only regression is in The prior observe-only concern is fixed, regression-covered, replied to, and resolved. Exact-head hosted CI remains the merge gate. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdb186f6c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const delivery = | ||
| admission.kind === "observeOnly" | ||
| ? { deliver: async () => ({ visibleReplySent: false }) } | ||
| : resolved.delivery; |
There was a problem hiding this comment.
Mask observe-only mock dispatch counts
When admission.kind === "observeOnly", this mock only swaps in a no-op delivery adapter and then forwards the assembled dispatch result from the mock dispatcher, so plugin tests using runtime.channel.inbound.run can still see nonzero counts and treat an invisible observe-only turn as a visible reply. Fresh evidence: production now executes assembled observe-only turns but returns the canonical zero-count result, while the test runtime mock's assembled branch does not mirror that masking; this can hide regressions in finalize paths that call hasVisibleInboundReplyDispatch.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
* test(imessage): mock core turn dispatch for media policy coverage PR #110095 missed this iMessage media-policy test file. * test(imessage): mock core turn dispatch for last-route coverage * test(whatsapp): mock core turn dispatch for broadcast coverage * test(imessage): drop type-dead terminal-admission branch in media harness
…10095) * refactor(channels): centralize turn execution lifecycle * refactor(extensions): adopt core channel turn plans * test(channels): ratchet modern dispatch ownership * chore(channels): drop stale max-lines exemption * fix(channels): allow async delivery error cleanup * test(channels): await async delivery cleanup * test(channels): await delivery error callbacks * fix(channels): preserve delivery error contract * fix(plugin-sdk): preserve channel inbound declarations * test(channels): exercise core delivery plans * fix(channels): await delivery error cleanup * fix(channels): preserve async cleanup contract * refactor(channels): trim dispatch boilerplate * fix(channels): mask observe-only dispatch results * refactor(channels): delete unused dispatch exports * fix(msteams): preserve resolver config overrides * refactor(channels): keep Teams turn config internal * test(plugins): drop retired Teams runtime export guard
…0327) * test(imessage): mock core turn dispatch for media policy coverage PR openclaw#110095 missed this iMessage media-policy test file. * test(imessage): mock core turn dispatch for last-route coverage * test(whatsapp): mock core turn dispatch for broadcast coverage * test(imessage): drop type-dead terminal-admission branch in media harness
Feishu DM 中意图静默的 NO_REPLY 会经 block 路径跳过,但 onSkip 原先只记录 final,导致误发“无可见内容”兜底。现将 silent 的 block skip 一并纳入状态,并补充直接回调与完整调度管线回归测试。 同时按 openclaw#110775 / openclaw#110095 对 msteams/slack 的同一模式,移除 feishu delivery-trace 中已失效的 createReplyDispatcherWithTyping 捕获缝,改为直接使用 createFeishuReplyDispatcher 返回的 dispatcherOptions/delivery,修复 main 上既有的金标失败并解除 ci-gate 阻塞。 Related: openclaw#109912 Closes: openclaw#110744
Related: #109316
Follow-up to #109716.
What Problem This Solves
Bundled message channels still owned the core execution half of inbound turns: session recording, dispatcher construction, durable-delivery handling, retry plumbing, reply pipelines, and final lifecycle callbacks. That kept deprecated low-level compatibility calls alive as internal architecture even after the marker sweep reached zero removable declarations.
Why This Change Was Made
Core now owns the complete inbound turn lifecycle. Channel adapters return data-only turn plans containing normalized context plus transport delivery facts; the core runner performs recording, dispatch, retry, durable delivery, typing/reaction lifecycle composition, and finalization. Feishu, iMessage, Matrix, Mattermost, Microsoft Teams, QQBot, Signal, Telegram, and WhatsApp now use that path. Special native Mattermost interactions use the focused core reply seam instead of rebuilding lifecycle logic.
Microsoft Teams folds its sender-timezone fact into the effective per-turn config before handing the plan to core. This preserves the existing behavior without keeping the deprecated dispatcher or adding a one-channel field to the public SDK.
The public Plugin SDK declaration baseline is unchanged. A ratcheted guard rejects bundled production use of prepared-turn callbacks, pre-dispatch failure callbacks, and low-level dispatcher lifecycle calls.
User Impact
No intended user-visible behavior change. External plugins keep the shipped compatibility window. Maintainers get transport-thinner channels, one core execution path, and a hard zero budget for internal deprecated channel lifecycle calls.
Non-test TypeScript using the task's
*.test.tsexclusion: +1797 / -1895, net -98 lines.Deprecation Triage
Raw marker lines and declarations are different units: a declaration may carry several deprecated members or be re-exported through public barrels.
LEGITIMATE keeps: all 110 files outside plugin-sdk
Shipped Plugin SDK/public facade — 63 files
Rationale: reachable through documented Plugin SDK/public barrels. External plugin deprecation window retained; internal and bundled callers use modern focused seams.
src/agents/agent-runtime-id.tssrc/agents/embedded-agent-runner/run/params.tssrc/agents/embedded-agent-runner/runs.tssrc/agents/harness/types.tssrc/agents/runtime-plan/types.tssrc/auto-reply/reply-payload.tssrc/auto-reply/reply/history.tssrc/auto-reply/templating.tssrc/channels/direct-dm-access.tssrc/channels/draft-preview-finalizer.tssrc/channels/inbound-event/context.tssrc/channels/mention-gating.tssrc/channels/message/inbound-reply-dispatch.tssrc/channels/message/send.tssrc/channels/plugins/outbound.types.tssrc/channels/plugins/outbound/interactive.tssrc/channels/plugins/types.adapters.tssrc/channels/plugins/types.core.tssrc/extensionAPI.tssrc/flows/doctor-core-checks.tssrc/infra/approval-gateway-resolver.tssrc/infra/approval-handler-adapter-runtime.tssrc/infra/approval-handler-runtime-types.tssrc/infra/approval-handler-runtime.tssrc/infra/approval-native-runtime.tssrc/infra/brew.tssrc/infra/dedupe.tssrc/infra/exec-approval-reply.tssrc/infra/exec-command-resolution.tssrc/infra/fs-safe.tssrc/infra/net/fetch-guard.tssrc/infra/outbound/deliver-runtime.tssrc/infra/outbound/deliver.tssrc/infra/outbound/reply-payload-normalize.tssrc/infra/secret-file.tssrc/interactive/payload.tssrc/logging/diagnostic.tssrc/media-understanding/types.tssrc/media/audio.tssrc/media/fetch.tssrc/memory-host-sdk/dreaming.tssrc/plugins/agent-tool-result-middleware-types.tssrc/plugins/hook-before-agent-start.types.tssrc/plugins/hook-before-tool-call-result.tssrc/plugins/hook-types.tssrc/plugins/hooks.tssrc/plugins/manifest.tssrc/plugins/plugin-api.types.tssrc/plugins/plugin-command.types.tssrc/plugins/plugin-definition.types.tssrc/plugins/provider-auth-token.tssrc/plugins/provider-catalog.types.tssrc/plugins/provider-claude-thinking.tssrc/plugins/provider-model-compat.tssrc/plugins/provider-openai-chatgpt-oauth.tssrc/plugins/provider-plugin.types.tssrc/plugins/provider-replay-helpers.tssrc/plugins/provider-replay.types.tssrc/plugins/runtime/runtime-channel.tssrc/plugins/runtime/runtime-tasks.types.tssrc/plugins/runtime/types-channel.tssrc/plugins/runtime/types-core.tssrc/plugins/runtime/types.tsProvider/dependency compatibility — 14 files
Rationale: compatibility owned by a shipped provider or upstream dependency contract. Core and bundled callers do not use the deprecated entry points.
src/agents/anthropic-payload-policy.tssrc/agents/auth-profiles/constants.tssrc/agents/cli-credentials.tssrc/agents/copilot-dynamic-headers.tssrc/agents/embedded-agent-runner/openrouter-model-capabilities.tssrc/agents/gpt5-prompt-overlay.tssrc/agents/model-auth-markers.tssrc/agents/openai-text-verbosity.tssrc/llm/providers/stream-wrappers/anthropic-family-tool-payload-compat.tssrc/llm/providers/stream-wrappers/minimax.tssrc/llm/providers/stream-wrappers/moonshot-thinking.tssrc/llm/providers/stream-wrappers/openai.tssrc/llm/providers/stream-wrappers/proxy.tssrc/llm/providers/stream-wrappers/zai.tsReleased CLI/config/data contracts — 32 files
Rationale: shipped CLI input, config, gateway, or persisted-data compatibility. Canonical runtime fields remain modern; parsing, schema, wire, or migration boundaries retain the old names.
src/cli/config-set-input.tssrc/cli/gateway-cli/run-options.tssrc/cli/plugins-cli.tssrc/cli/plugins-uninstall-command.tssrc/commands/onboard-types.tssrc/config/types.agent-defaults.tssrc/config/types.agents.tssrc/config/types.base.tssrc/config/types.channels.tssrc/config/types.cron.tssrc/config/types.discord.tssrc/config/types.gateway.tssrc/config/types.googlechat.tssrc/config/types.messages.tssrc/config/types.openclaw.tssrc/config/types.plugins.tssrc/config/types.slack.tssrc/config/types.telegram.tssrc/config/types.tools.tssrc/config/types.tts.tssrc/config/zod-schema.agents.tssrc/config/zod-schema.allowdeny.tssrc/config/zod-schema.session.tssrc/context-engine/types.tssrc/cron/service/state.tssrc/cron/types.tssrc/proxy-capture/env.tssrc/proxy-capture/paths.tssrc/proxy-capture/types.tssrc/routing/resolve-route.tssrc/security/dm-policy-shared.tssrc/system-agent/setup-inference.tsDoctor/migration bridge — 1 file
Rationale: migration-only helper for the retired shipped JSON pairing store; not used by steady-state canonical runtime.
src/pairing/pairing-store.tsEvidence
Exact pushed head:
bdb186f6c8b710e141c407460ff3a366723abe7don merge baseb42dc728510be52c5a50a2d817c1347330b8b5d8. GitHub reports it mergeable with currentmain.Final broad changed gate: format, all core/extension/script production and test typechecks, full core/extension/script lint, Plugin SDK API/surface checks, deprecated API usage, plugin boundaries, runtime-cycle, storage, pairing, and package guards — green (run).
Final public-surface simplification: 58 focused core/Teams/provider tests, four typecheck lanes, targeted format, unchanged Plugin SDK baseline, and deprecated API usage guard — green (run).
Final rebase overlap proof: Feishu 92/92, channel kernel 36/36, SDK baseline, and deprecated API guard — green (run).
CI-driven runtime API guard cleanup: focused contract suite 6/6 — green (run).
Blacksmith Testbox: 143 focused core, Feishu, and Telegram regression tests;
pnpm format:check;pnpm tsgo:prod;pnpm check:test-types;pnpm lint:extensions:no-deprecated-channel-access; both Plugin SDK gates; andpnpm build— green (run).Follow-up Testbox: exact hosted-CI lint command, 161 focused regressions, plugin production types, and all test-type lanes — green (run).
Final review-fix Testbox: observe-only dispatch-result regression, 35 channel-kernel tests, and exact hosted-CI lint command — green (run).
Final exact-head follow-up Testbox: 91 channel-kernel and WhatsApp regressions, full lint/format, and the hard-zero production/full-tree/script unused-export gates — green (run).
Rebased resolver-contract Testbox: 330 core, Teams, provider-dispatcher, and resolver regressions; full lint; production/UI/extension and all test types; Plugin SDK API/surface gates; hard-zero unused exports — green (run).
Final combined-baseline Testbox after rebase: 98 tooling tests plus focused core, provider-dispatcher, Teams, package-workflow, and UI regressions; exact full lint; production and all test types; Plugin SDK API/surface gates; hard-zero unused exports — green (run).
Earlier rebased-patch Testbox proof: 42 targeted integration regressions plus production/test type checks, internal-deprecation guard, and both Plugin SDK gates — green (run).
Focused core and bundled channel suites — green across Feishu, iMessage, Matrix, Mattermost, Microsoft Teams, QQBot, Signal, Telegram, WhatsApp, direct-DM, reply dispatch, and Plugin SDK runtime mocks.
git diff --check— green.Fresh full-branch review found and drove the Teams effective-config simplification; final branch and cleanup autoreviews — no accepted/actionable finding.
No UI files changed; screenshots not applicable. No changelog: internal behavior-neutral architecture refactor.
AI-assisted implementation and review.