Repository navigation
refactor(channels): centralize inbound orchestration and remove internal compat - #109716
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0200574738
ℹ️ 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".
| @@ -296,7 +314,7 @@ export function createPluginRuntimeMock(overrides: DeepPartial<PluginRuntime> = | |||
| ? await runPreparedChannelTurnMock({ | |||
| ...resolved, | |||
| admission, | |||
| }) | |||
| } as unknown as Parameters<PluginRuntime["channel"]["inbound"]["runPreparedReply"]>[0]) | |||
There was a problem hiding this comment.
Assemble routed turns in the runtime mock
channel.inbound.run can now receive adapters that return the new routed turn shape ({ cfg, route, ... }), which the real kernel expands into routeSessionKey, storePath, and recordInboundSession before dispatch. This cast sends a routed prepared turn straight into runPreparedChannelTurnMock (and the non-prepared path also bypasses the new dispatch assembler), so tests using createPluginRuntimeMock().channel.inbound.run with migrated adapters fail with missing session-recording/store-path wiring instead of exercising the turn. Reuse the same assembly path as dispatchChannelTurnPlanMock before branching on runDispatch.
Useful? React with 👍 / 👎.
0200574 to
f39f405
Compare
|
Merged via squash.
|
…nal compat (openclaw#109716) * refactor(channels): centralize inbound turn orchestration * refactor(runtime): remove stale compatibility paths * chore(guards): reject internal deprecated API use * refactor(channels): simplify core turn planning * chore(guards): keep deprecated checks boundary-focused * refactor(memory): keep modern config off compat barrel * fix(msteams): preserve feedback learning * test(channels): align modern inbound fixtures * refactor(channels): finish modern inbound migration * refactor(channels): tighten core inbound kernel * fix(channels): preserve turn assembly narrowing * test(sdk): keep runtime mock binding immutable * test(matrix): isolate read policy runtime * test(msteams): mock canonical reply factory * test(slack): mock core inbound turn dispatch * test(telegram): inject core session recorder * test(signal): inject core session recorder * test(googlechat): assert canonical inbound routing * test(synology-chat): align core turn fixture * fix(sdk): preserve direct DM runtime compat * refactor(channels): own inbound envelope compat in core * refactor(channels): trim inbound dispatch seams * refactor(channels): remove redundant async wrappers * test(synology-chat): type canonical dispatcher mock * refactor(channels): remove remaining dead compat seams * chore(sdk): refresh API baseline after rebase * fix(channels): preserve direct DM identity metadata
…nal compat (openclaw#109716) * refactor(channels): centralize inbound turn orchestration * refactor(runtime): remove stale compatibility paths * chore(guards): reject internal deprecated API use * refactor(channels): simplify core turn planning * chore(guards): keep deprecated checks boundary-focused * refactor(memory): keep modern config off compat barrel * fix(msteams): preserve feedback learning * test(channels): align modern inbound fixtures * refactor(channels): finish modern inbound migration * refactor(channels): tighten core inbound kernel * fix(channels): preserve turn assembly narrowing * test(sdk): keep runtime mock binding immutable * test(matrix): isolate read policy runtime * test(msteams): mock canonical reply factory * test(slack): mock core inbound turn dispatch * test(telegram): inject core session recorder * test(signal): inject core session recorder * test(googlechat): assert canonical inbound routing * test(synology-chat): align core turn fixture * fix(sdk): preserve direct DM runtime compat * refactor(channels): own inbound envelope compat in core * refactor(channels): trim inbound dispatch seams * refactor(channels): remove redundant async wrappers * test(synology-chat): type canonical dispatcher mock * refactor(channels): remove remaining dead compat seams * chore(sdk): refresh API baseline after rebase * fix(channels): preserve direct DM identity metadata
Closes #109316
What Problem This Solves
Internal and bundled message channels still assembled core-owned route, session, context, history, retry, dispatch, and delivery behavior through deprecated low-level compatibility surfaces. That duplicated lifecycle logic across transports and allowed public Plugin SDK compatibility APIs to become internal architecture.
Why This Change Was Made
Core now owns normalized inbound turn planning and dispatch: route/envelope construction, direct-DM access, session conflict retry, history/media handling, session recording, durable delivery, feedback reflection, and lifecycle ordering. Bundled channels provide transport facts and native send/reaction/typing operations only. Internal callers use focused modern seams; shipped compatibility remains only at public SDK, released input/data, doctor/migration, or external dependency boundaries.
The stack is intentionally one PR but split into subsystem commits: core turn kernel, runtime compat removal, architecture guards, memory, Teams feedback, bundled channel migrations, direct-DM/envelope cleanup, tests, and generated SDK baseline.
User Impact
No intended user-visible behavior change. Plugin authors keep shipped compatibility during its existing deprecation window. Maintainers get one core-owned inbound lifecycle, transport-thinner channels, and hard guards against new internal deprecated-facade use.
Non-test TypeScript using the task's
*.test.tsexclusion: +2525 / -2542, net -17 lines.Deprecation Triage
Raw marker lines and compat registry records are different units: one declaration can be re-exported through multiple public barrels, while registry records track shipped removal windows.
LEGITIMATE keeps: every remaining non-test file outside plugin-sdk
src/agents/agent-runtime-id.tssrc/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/embedded-agent-runner/run/params.tssrc/agents/embedded-agent-runner/runs.tssrc/agents/gpt5-prompt-overlay.tssrc/agents/harness/types.tssrc/agents/model-auth-markers.tssrc/agents/openai-text-verbosity.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/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/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/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.tssrc/logging/diagnostic.tssrc/media-understanding/types.tssrc/media/audio.tssrc/media/fetch.tssrc/memory-host-sdk/dreaming.tssrc/pairing/pairing-store.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.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.tsEvidence
Current exact head
f39f405915bf1673f3c535be79aad16596b4acba:pnpm plugin-sdk:api:check— green.pnpm plugin-sdk:surface:check— 8,068 public exports, 4,501 callable, 3,005 deprecated; local-only deprecated exports/callables 0/0; forbidden subpaths 0.pnpm check:deprecated-api-usage— green.pnpm lint:extensions:no-deprecated-channel-access— green.pnpm deadcode:dependencies,pnpm deadcode:unused-files, andpnpm deadcode:exports— green with 0 entries.tbx_01kxqfxqh82kb85m1h9xnccmy7, stopped after proof.Broader branch proof before the latest conflict-only rebase:
pnpm check:changed— green across every typecheck lane, full core/extensions/scripts lint, SDK/deprecation/boundary gates, database/runtime/import-cycle guards.pnpm build: green in 2m57s: https://github.com/openclaw/openclaw/actions/runs/29558563873No UI files changed; screenshots not applicable.
AI-assisted implementation and review.