Skip to content

refactor(config): retire legacy flat streaming keys to doctor-owned migration - #104693

Merged
steipete merged 3 commits into
mainfrom
claude/chanref-p2-streaming-flat-keys
Jul 12, 2026
Merged

steipete merged 3 commits into
mainfrom
claude/chanref-p2-streaming-flat-keys

Conversation

@steipete

@steipete steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Related: #104318

Maintainer decision (2026-07-12)

Approved to land by the maintainer with both consequences accepted explicitly: (1) existing flat-key configs become invalid at startup until openclaw doctor --fix (doctor config fixes are not auto-applied on startup; the existing "Legacy config keys detected" machinery names the exact keys and the fix command); (2) the runtime tolerance is removed ahead of the deprecation record's removeAfter 2026-07-26 — deliberate acceleration; the doctor --fix migration itself is retained past that date.

What Problem This Solves

Six legacy flat streaming keys (streamMode, chunkMode, blockStreaming, draftChunk, blockStreamingCoalesce, nativeStreaming) were normalized at steady-state load time, keeping non-canonical shapes alive in the runtime path against the repo's doctor-first rule (runtime reads canonical config only; older shapes migrate in doctor).

Why This Change Was Made

Load-time normalization for these keys is removed so runtime consumes only the nested streaming.* shape; openclaw doctor --fix migrates flat→nested for every channel that supports them. Filled coverage gaps: discord had a migration but no rules (added 2); imessage/msteams had neither (added rules+migrations). Fixed two shared-migration bugs found en route: flat keys weren't removed when the nested key was already set, and a streamMode-conflict removal produced empty changes that doctor discarded (leaving config invalid after --fix). Five channels keep flat keys canonical for now (signal, irc, googlechat, whatsapp, mattermost + the SDK reply-runtime shape) — documented follow-up territory, not silently dropped.

User Impact

See HOLD section. For migrated-config users: none. For flat-key users: a one-time doctor --fix requirement, loudly signposted.

Evidence

  • Testbox tbx_01kx9c9532h5mesb0cej7h5w8c: full battery + pnpm check:changed, exit 0; repo-wide oxfmt --check green up front; all tsgo lanes green.
  • Doctor migration idempotence + per-key mapping tests; runtime-rejects-flat-keys tests.
  • Autoreview (codex gpt-5.6-sol, xhigh), 3 rounds: two accepted fixes (SDK test flat-fallback assertions; streamMode silent-removal); one rejected with an inline invariant (no channel policy in core). Final clean (0.93).

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: msteams Channel integration: msteams channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 8:55 PM ET / July 12, 2026, 00:55 UTC.

Summary
The PR removes six legacy flat streaming-key reads from runtime and SDK resolver paths, adds doctor-owned migrations for affected channels, and updates schemas, callers, tests, metadata, and documentation for nested streaming configuration.

PR surface: Source +99, Tests +250, Docs +7, Generated 0, Other 0. Total +356 across 42 files.

Reproducibility: yes. The latest-head source gives high-confidence paths for the Discord default regression and iMessage invalid migration, while the latest release source proves the changed SDK behavior shipped.

Review metrics: 1 noteworthy metric.

  • Compatibility surfaces: 6 persisted aliases removed from runtime; 1 shipped SDK resolver family changed. Both user upgrades and external plugin callers can break independently of green CI.

Stored data model
Persistent data-model change detected: migration/backfill/repair: docs/channels/slack.md, migration/backfill/repair: docs/concepts/streaming.md, migration/backfill/repair: extensions/discord/src/doctor-contract.ts, migration/backfill/repair: extensions/imessage/doctor-contract-api.test.ts, migration/backfill/repair: extensions/imessage/doctor-contract-api.ts, migration/backfill/repair: extensions/msteams/doctor-contract-api.test.ts, and 10 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #104318
Summary: This PR is a concrete implementation slice under the channel-refactor umbrella; the merged normalization PR is predecessor history with partial overlap.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦪 silver shellfish
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix both channel migration defects.
  • Preserve or explicitly approve removal of the released SDK contract.
  • Attach redacted exact-head real behavior proof.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Automated Testbox and tests are supplemental only; add redacted terminal or linked-artifact proof of startup rejection, openclaw doctor --fix, canonical migrated config, preserved effective behavior, and successful restart. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Released flat-key configurations become startup-invalid until an operator runs openclaw doctor --fix, and no real setup evidence demonstrates that full recovery path.
  • [P1] External plugins using the released flat-aware SDK helpers can break or silently change behavior without a compatibility seam or coordinated removal plan.
  • [P1] Current doctor output can silently disable Discord progress previews and can leave mixed iMessage legacy configurations invalid after repair.

Maintainer options:

  1. Fix migrations and preserve the SDK seam (recommended)
    Correct Discord and iMessage migration behavior, retain deprecated external compatibility, and add live upgrade proof before merge.
  2. Explicitly accept all breaking changes
    Merge only after maintainers accept the SDK break in addition to the already-approved startup and deprecation-acceleration consequences.
  3. Move removal to a coordinated break train
    Pause the runtime and SDK removal if a safe compatibility seam is not desirable in this PR.

Next step before merge

  • [P1] Fix the two migration defects, obtain an explicit decision on the released SDK compatibility seam, and attach real upgrade proof; automation cannot safely choose the API direction or supply contributor-environment evidence.

Maintainer decision needed

  • Question: Should the released flat-aware openclaw/plugin-sdk/channel-streaming helpers remain available as a deprecated external compatibility seam while bundled runtime paths switch to nested-only helpers?
  • Rationale: The latest release includes and tests flat fallback behavior, while repository policy treats shipped plugin SDK APIs as compatibility contracts; choosing to break that API requires maintainer intent.
  • Likely owner: vincentkoc — The shipped helper behavior and its tests appear to originate in this person's merged streaming normalization work.
  • Options:
    • Preserve deprecated SDK compatibility (recommended): Keep external flat-aware helpers temporarily, add nested-only helpers for bundled runtime callers, and document a coordinated removal plan.
    • Approve immediate SDK breakage: Remove flat fallback behavior now and explicitly accept the external plugin upgrade impact with release guidance and compatibility evidence.

Security
Cleared: The dedicated pass found no concrete secret, permission, dependency, workflow, publishing, artifact-download, or third-party code-execution concern.

Review findings

  • [P2] Preserve Discord's progress default during migration — extensions/discord/src/doctor-contract.ts:516
  • [P2] Keep iMessage migration delivery-only — extensions/imessage/doctor-contract-api.ts:125-127
  • [P1] Preserve the shipped flat-aware SDK resolver contract — src/channels/streaming.ts:30-39
Review details

Best possible solution:

Keep steady-state runtime nested-only, use channel-shaped doctor migrations that preserve defaults and schema validity, and retain a documented deprecated flat-aware SDK compatibility seam until an approved plugin API removal train.

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

Yes. The latest-head source gives high-confidence paths for the Discord default regression and iMessage invalid migration, while the latest release source proves the changed SDK behavior shipped.

Is this the best way to solve the issue?

No in the current form. Doctor-owned migration is the correct boundary, but the implementation must preserve channel semantics and avoid silently breaking a released plugin SDK API.

Full review comments:

  • [P2] Preserve Discord's progress default during migration — extensions/discord/src/doctor-contract.ts:516
    When doctor migrates only a non-mode alias, this off fallback writes an explicit disabled mode even though unconfigured Discord uses progress. Preserve the Discord default so repair does not silently disable progress previews.
    Confidence: 0.99
  • [P2] Keep iMessage migration delivery-only — extensions/imessage/doctor-contract-api.ts:125-127
    The generic mode-aware normalizer can write streaming.mode even though iMessage's strict streaming schema accepts only delivery fields. This was equally visible on the previous reviewed head and is being raised late; use a delivery-only migration so mixed legacy input cannot remain invalid after doctor repair.
    Confidence: 0.97
    Late finding: first raised on code an earlier review cycle already covered.
  • [P1] Preserve the shipped flat-aware SDK resolver contract — src/channels/streaming.ts:30-39
    Release v2026.6.11 exports and tests these helpers with flat-key fallback behavior. Add nested-only runtime helpers or retain the existing semantics through a deprecated compatibility API instead of breaking external plugins in place.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ecefc6cab69e.

Label changes

Label justifications:

  • P1: The current head can block existing startup, alter Discord behavior, leave iMessage config invalid, and break external plugin callers.
  • merge-risk: 🚨 compatibility: The PR changes strict config acceptance, doctor migration output, defaults, runtime fallbacks, and released SDK semantics.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Automated Testbox and tests are supplemental only; add redacted terminal or linked-artifact proof of startup rejection, openclaw doctor --fix, canonical migrated config, preserved effective behavior, and successful restart. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +99, Tests +250, Docs +7, Generated 0, Other 0. Total +356 across 42 files.

View PR surface stats
Area Files Added Removed Net
Source 20 291 192 +99
Tests 12 376 126 +250
Docs 8 23 16 +7
Config 0 0 0 0
Generated 1 13 13 0
Other 1 3 3 0
Total 42 706 350 +356

What I checked:

  • Discord migration changes the effective default: The latest head resolves an absent Discord legacy mode with off; when doctor migrates only a delivery alias, it materializes an explicitly disabled mode even though unconfigured Discord uses progress. (extensions/discord/src/doctor-contract.ts:516, ea0747dd55e3)
  • Discord runtime establishes the progress default: The Discord resolver returns progress when no streaming configuration exists, confirming that doctor must preserve that effective default when migrating non-mode aliases. (extensions/discord/src/preview-streaming.ts:9, ea0747dd55e3)
  • iMessage uses a mode-aware migration for a delivery-only schema: The implementation documents iMessage streaming as delivery-only but calls the shared mode resolver and generic normalizer, allowing mixed legacy input to produce unsupported streaming.mode. (extensions/imessage/doctor-contract-api.ts:125, ea0747dd55e3)
  • Flat-aware SDK behavior shipped: Release v2026.6.11 includes plugin SDK tests asserting that exported resolver helpers fall back to flat chunkMode, blockStreaming, nativeStreaming, blockStreamingCoalesce, and draftChunk fields. (src/plugin-sdk/channel-streaming.test.ts:120, e085fa1a3ffd)
  • Public compatibility subpath remains exported: Current main marks openclaw/plugin-sdk/channel-streaming deprecated but continues to export the channel streaming implementation through a package entrypoint, so semantic changes affect external plugin callers. (src/plugin-sdk/channel-streaming.ts:1, ecefc6cab69e)
  • Prior findings remain on the latest head: The relevant Discord, iMessage, runtime resolver, and SDK test files are unchanged between the previous reviewed SHA and the latest head; previously reported blockers were not removed by the final force-push. (ea0747dd55e3)

Likely related people:

  • vincentkoc: Authored the merged nested-streaming normalization that established the released flat-aware resolver behavior and its SDK tests. (role: introduced behavior; confidence: high; commits: 0fdf9e874b7e; files: src/channels/streaming.ts, src/config/channel-compat-normalization.ts, src/plugin-sdk/channel-streaming.test.ts)
  • steipete: Carried several follow-up refactors in doctor compatibility helpers and is connected to the current channel-refactor direction and accepted upgrade consequences. (role: recent area contributor; confidence: medium; commits: 1aee8c55cee4, 283b103e751c, 6d52014ef8cc; files: src/config/channel-compat-normalization.ts, extensions/discord/src/doctor-contract.ts, extensions/imessage/doctor-contract-api.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-11T20:50:03.808Z sha d02ab4d :: needs real behavior proof before merge. :: [P1] Preserve the shipped flat-aware SDK resolver contract
  • reviewed 2026-07-11T23:42:06.485Z sha d02ab4d :: needs real behavior proof before merge. :: [P1] Preserve the shipped flat-aware SDK resolver contract
  • reviewed 2026-07-11T23:52:42.678Z sha d02ab4d :: needs real behavior proof before merge. :: [P1] Preserve the shipped flat-aware SDK resolver contract
  • reviewed 2026-07-12T00:20:55.335Z sha 2937bc1 :: needs real behavior proof before merge. :: [P2] Preserve Discord's progress default during migration | [P1] Preserve the shipped flat-aware SDK resolver contract
  • reviewed 2026-07-12T00:40:27.723Z sha 6b2dcff419bedfdd55d826aad4b7bc08eab987fc :: needs real behavior proof before merge. :: [P2] Preserve Discord's progress default during migration | [P1] Preserve the shipped flat-aware SDK resolver contract

@steipete
steipete marked this pull request as ready for review July 11, 2026 23:31
@steipete steipete changed the title refactor(config): retire legacy flat streaming keys to doctor-owned migration [HOLD: compat decision] refactor(config): retire legacy flat streaming keys to doctor-owned migration Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 11, 2026
@steipete
steipete force-pushed the claude/chanref-p2-streaming-flat-keys branch from d02ab4d to 2937bc1 Compare July 11, 2026 23:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2937bc15b0

ℹ️ 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".

Comment on lines 513 to +516
resolveStreamingOptions: (entry) => ({
resolvedMode: resolveDiscordPreviewStreamMode(entry),
// Runtime mode resolution dropped legacy streamMode reads; the doctor
// resolver keeps them so migration preserves configured intent.
resolvedMode: resolveLegacyAliasStreamingMode(entry, "off"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Discord progress default during migration

When a Discord config only has non-mode aliases such as chunkMode, blockStreaming, or draftChunk, this doctor path now forces openclaw doctor --fix, but normalizeLegacyStreamingAliases only moves those fields and does not write streaming.mode. The repaired config therefore contains a streaming object, and resolveDiscordPreviewStreamMode treats that as configured and falls back to off instead of Discord's no-config progress default, silently disabling progress previews for those users. Have the Discord migration preserve mode: "progress" whenever it creates streaming without an explicit mode.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b2dcff419

ℹ️ 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".

hasLegacyIMessageStreamingAliases(nextImessage) ||
hasLegacyAccountStreamingAliases(nextImessage.accounts, hasLegacyIMessageStreamingAliases);
if (hasStreamingAliases) {
const aliases = normalizeLegacyChannelAliases({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep iMessage migration delivery-only

When an iMessage config has a delivery alias such as chunkMode plus a scalar streaming/streamMode at the same level (or in another account once this gate is true), this generic normalizer also runs the stream-mode migration and writes streaming.mode. iMessage uses the strict delivery-only streaming schema (chunkMode/block only), so openclaw doctor --fix can replace the flat alias with a new invalid streaming.mode key that no later legacy rule removes, leaving startup still blocked. Use a delivery-only alias migration for this path or suppress mode migration for iMessage.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the claude/chanref-p2-streaming-flat-keys branch from 6b2dcff to ea0747d Compare July 12, 2026 00:42
@steipete
steipete force-pushed the claude/chanref-p2-streaming-flat-keys branch from ea0747d to 430bf29 Compare July 12, 2026 01:12
@steipete
steipete merged commit 508f6a2 into main Jul 12, 2026
102 of 103 checks passed
@steipete
steipete deleted the claude/chanref-p2-streaming-flat-keys branch July 12, 2026 01:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 430bf293c5

ℹ️ 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 nested = `${params.pathPrefix}.streaming.${nestedPath}`;
if (target[slot] === undefined) {
target[slot] = updated[flatKey];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inherited stream modes for account alias migrations

When this runs for channels.discord.accounts.* or channels.telegram.accounts.* with only delivery aliases like chunkMode or blockStreamingCoalesce, it creates an account-level streaming object with no mode. Those account resolvers shallow-merge account config over the channel config (mergeDiscordAccountConfig and mergeTelegramAccountConfig), so a root channels.<id>.streaming.mode is replaced after doctor --fix; Discord then falls back to off and Telegram to partial instead of the configured root mode. Copy/inherit the parent mode during account alias migration or deep-merge streaming before persisting.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…igration (openclaw#104693)

* chore(config): regenerate bundled channel config metadata for retired flat streaming keys

* refactor(config): retire legacy flat streaming keys to doctor-owned migration

* fix(config): restore zod locale installer dropped in rebase and repin SDK surface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: msteams Channel integration: msteams channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant