Repository navigation
fix(channels): bundled channels reject the documented mediaMaxMb override - #118157
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 12:34 AM ET / 04:34 UTC. ClawSweeper reviewWhat this changesThe branch admits Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain Keep open: the exact head still makes QA Channel’s documented cap valid without enforcing it before attachment delivery, and an active integration comment already identifies that owner-boundary repair. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherChannel plugins validate operator configuration before outbound media is loaded and handed to a channel transport. The QA Channel has its own media sender, which encodes loaded attachments for QA Bus delivery. flowchart LR
A[Operator QA media limit] --> B[QA configuration schema]
B --> C[QA media sender]
C --> D[Shared media loader]
D --> E[QA Bus attachment]
C --> F[Size-limit decision]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +22, Tests +105, Generated 0. Total +127 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Resolve QA’s root/account cap at its outbound owner, pass it to the shared loader without exceeding any transport ceiling, and prove oversized attachments are rejected before QA Bus delivery. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible with high confidence: configure a small QA cap and send an oversized media URL through QA’s direct delivery path; the current loader receives no Is this the best way to solve the issue? No: schema admission alone is not the best fix because QA’s sender never consumes the admitted value; enforcement belongs at the QA outbound loader before QA Bus delivery. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 629a47e3cc20. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (29 earlier review cycles; latest 8 shown)
|
|
Real behavior proof added to the PR body, taken from from-scratch builds on both sides so a stale Before, clean build of After, clean build of this branch: Worth stating explicitly since it differs from the account-scope finding you raised on #118152: both forms here have a real resolver contract. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
97b0a1e to
31f7ba2
Compare
|
Addressed in Rebased onto current
Both gates are clean on the new head, and the eleven schema edits plus the contract test survived the rebase intact: The clean-build before/after transcripts already in the PR body still describe this change; the rebase moved the base and the generated snapshots, not the behavior. |
|
Disclosure that affects how the channel list on this PR should be read, found while gathering clean-build proof for a sibling PR. I have been using the generated channel metadata ( Confirmed end to end on a from-scratch build of What I think this does and does not change:
I would rather you hear this from me than discover it in review. Happy to drop the affected channel from the list, or to keep it with the framing corrected to "declares the key explicitly" instead of "rejects it", whichever you prefer. |
|
Good catch, and it was a real hole. Fixed in this push. You are right that The set is now anchored to media capability instead: const NON_MEDIA_CHANNELS = new Set(["buzz", "nostr", "raft", "reef"]);
const mediaChannels = GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA
.map((entry) => entry.channelId)
.filter((channelId) => !NON_MEDIA_CHANNELS.has(channelId));I checked that split against delivery rather than schema before pinning it: Nostr and Reef declare Proof both directions now fail: The non-media assertion also requires the root schema to be closed first, since Tradeoff worth naming: the four excluded channels are now a literal in the test. I preferred that over deriving from the field, since the derivation is what made the contract self-referential, and capability is not exposed in the generated config metadata today. If you would rather have this driven by exported capability metadata, that is a larger change and I am happy to do it separately. Validation: AI-assisted. |
|
Rebased onto current main; main had moved 185 commits ahead. On the red Validation on the new head: AI-assisted. |
|
Rebased onto current The baseline was not hand-merged. I reset both generated files to main and re-ran both generators, so the artifacts match what CI regenerates: Local proof at head On the red marks: I also think I made that worse: I pushed nine rebases within about a minute, so nine fork CI runs hit dependency install at once. That was my mistake in batching, not a change in the code. Happy to re-push to re-trigger if you would rather see a clean run. AI-assisted. |
|
Rebased onto current The one red, This is the third of my PRs to hit it today, after #119356 and #117287, all on unrelated diffs. The cause I traced on #119356 is the WebSocket wait in This branch changes channel I have not raised that timeout, since larger timeouts are one of the things AGENTS.md names as masking a root cause, and it is shared by every gateway test. Flagging the pattern rather than patching around it. AI-assisted. |
|
Owner-boundary evidence added, as asked. Rebased to You were right that the earlier transcript only proved schema acceptance. The missing half is whether a configured cap actually reaches the send path, so here is the whole chain. 1. Whether the cap can exist at all. Same probe over the generated schema oracle, only Six of the seven refuse 2. What the accepted value does at the send boundary. Driving the real resolver the outbound adapter uses, That is the value So the two halves join up: on One correction to my own method while building this. My first probe printed nothing at all and I nearly read that as "no schema". The export is Validation at
Honest limit: this is the resolver and the schema oracle, not a live channel send. Enforcement of |
|
Rebased onto current main. Worth flagging for review: #129710 landed historyLimit: z.number().int().min(0).optional(),
mediaMaxMb: z.number().positive().optional(),Local checks at the new head: The one mattermost failure is |
|
The failure was my own contract test: Cause: A2A is a new channel plugin, landed in #130008 ( A2A cannot deliver media. Verified: the contract file is 50/50 and the full Worth flagging separately: because #130008 added the plugin without regenerating the bundled channel metadata, the first PR to regenerate it carries A2A's entries into its diff. That is why the generated file in this PR moves more than the mediaMaxMb change alone would explain. |
|
Thanks @ayaangazali. I’m working on maintainer improvements to this PR so the accepted limits reach the native media loaders, preserve each transport’s existing ceilings, and reject oversized attachments before upload or delivery. I’m also adding real-flow regression coverage and running an isolated Gateway/QA Channel check. I’ve seen your latest updates and will preserve your contributor stack when integrating the improvements; no need to open a replacement PR. |
|
Correction to my previous comment. Two claims in it were wrong, and both were unfair to #130008. I said A2A was "not yet present in the committed The error was mine and it was a grep: I searched for What actually happened is simpler. A2A joined the bundled metadata in #130008. Once this branch rebased past that commit, my contract picked A2A up, because the contract derives its expected set from every metadata entry minus an explicit non-media list. A2A landed in that set by default and correctly failed, since it does not offer the cap. The fix in Sorry for the noise on the generated-metadata point. |
|
Thanks for keeping this branch current, @ayaangazali. I have finished the maintainer enforcement improvements and their review, including actual Gateway/QA-bus attachment and configuration-reload testing. I am integrating your latest rebased head while preserving your commits and credit, then running the final exact-head checks before updating this PR. Could you please avoid further rebases or force-pushes on this branch until that integration is finished? No action is needed on the implementation; I will post the final change summary and proof here. |
|
The job log has no failing test. The build succeeds ( One byte over, against a limit of baseline 342930 plus 512 tolerance. The premise was plausible. This PR adds Building locally first said otherwise. At the rebased head That is 80 bytes under the limit, and the check exits 0 with no violations section. The CI number came from head Raising a committed performance budget to absorb an 81 byte measurement difference would be the wrong repair, so I have not touched New head |
Resolve canonical account caps at native byte consumers, publish QA attachments durably, and refresh global media policy without resurrecting manually stopped accounts. Preserve existing local survivor warnings, remote batch atomicity, transport ceilings, and contributor schema work. Co-authored-by: Ayaan Gazali <[email protected]>
Resolve disabled block delivery at message-end so suppressed text callbacks cannot strip the later attachment caption. Preserve enabled break modes and per-turn precedence using the existing boolean owner.
|
The improved branch is now at Final isolated compiled-Gateway/HTTP QA-bus validation passed all 18 assigned probes and 18 recovery barriers. This includes exact 512/1024-byte streamed attachments with captions, captionless controls, global fallback and live tightening, inbound unavailable notices, manually stopped-account preservation, an independent named-account override, and post-restart controls. All six remote fixtures passed exact-byte HTTP 200 preflights. The Gateway process is gone, all three listeners are closed, and the runtime graph hash is unchanged. This is controlled-provider Gateway proof, not authenticated external-channel or real-model proof. Same-trace caption repetition and an exact 3072-byte remote fixture remain explicit live gaps; the distinct-trace repeated-caption case was directly verified. The earlier live failures are retained in the PR's evidence narrative. They led to two additional owner fixes: serialize previews with durable delivery, and stop treating suppressed text callbacks as delivered captions when block streaming is off. The latter absorbs the fix into the existing option resolver with net four fewer production lines. The final production build, changed gate, canonical generated-config checks, SDK API report and normal independent whole-branch Codex review pass. The final integration run passed 540 tests in seven files; earlier broader byte-owner coverage is recorded separately without double-counting. Exact-head hosted CI must still pass before native prepare/merge. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the existing 720-root ceiling and exact-once canonical coverage by moving media tests into the messaging shard. The plugin/platform shard reached 721 roots with the new media contract coverage; the new allocation is 682 and 526 roots. No runtime or test assertions change.
|
Final head: The first hosted run found one real integration issue: 721 roots in the plugin/platform test-type shard, exceeding the existing 720-root ceiling. The fix moves all 39 media roots into the existing messaging shard, producing 682/526 roots while preserving exact-once coverage and the unchanged ceiling. The actual guard fails before and passes after. Both affected type-check shards, eight existing partition tests, the changed gate and fresh independent review pass. The first run's failure and later cancellation are preserved; they are not reported as green. This last commit changes only two test-allocation JSON files. Production and dependencies are identical to live-tested Focused final commands, in addition to the broader runs recorded in the PR body: OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build
node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-directive-aliases.test.ts extensions/qa-channel/src/inbound.test.ts extensions/qa-channel/src/outbound.test.ts extensions/qa-channel/src/channel.test.ts src/gateway/config-reload.test.ts src/gateway/server-reload-handlers.test.ts src/gateway/server-reload-channel-restart.test.ts
node --import ./scripts/tsx.mjs scripts/check-tsgo-core-boundary.mts
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.plugins-platform.json
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.messaging.json
node scripts/run-vitest.mjs test/scripts/tsgo-core-test-shards.test.ts
node scripts/check-changed.mjs -- test/tsconfig/tsconfig.core.test.plugins-platform.json test/tsconfig/tsconfig.core.test.messaging.jsonThe full build and 540-test integration run are at |
|
Merged via squash.
|
What Problem This Solves
Several bundled channels reject the documented
mediaMaxMbsetting, and merely accepting it does not ensure the native media sender enforces it. The original PR identified the schema gap. Maintainer follow-through found unchecked byte consumers, account-resolution mismatches, false media-delivery acknowledgements in QA Channel, and stale channel policy after a global media-limit reload.Why This Change Was Made
The repair follows actual byte ownership. It enables the existing documented root/account setting for ClickClack, Mattermost, QA Channel, SMS, Tlon, and Zalo Personal, and passes the resolved cap into their native byte loaders. Buzz and Twitch do not gain ineffective media settings or new media capabilities. Transport-specific ceilings remain intact.
Account lookup uses the canonical normalized account resolver, including existing iMessage and Signal callbacks. Zalo's native credential-profile selection remains separate from an authoritative routed account; unrelated account caps cannot leak into profile tools. The existing pure resolver is exported through the existing focused
account-helpersSDK entrypoint; the shipped older export stays available.QA Channel now acknowledges media only after durable attachment publication. Existing caption/tool-trace ownership suppresses identical follow-through text without losing new attachments or genuinely different tool traces. Preview updates, deletion, and durable delivery share the existing async lock: a partial callback cannot edit a preview while its deletion is in flight, and one failed operation cannot poison later delivery. Remote batches preload all attachments before publication; shared local reply preparation keeps its established valid-file-plus-warning behavior. Mattermost cannot send an unchecked original URL after a bounded upload fails, while Tlon retains its existing fallback only after a successful bounded download.
The live tests exposed a second caption defect in the shared reply owner: with block streaming off, a suppressed text callback was nevertheless marked delivered before the later media block. The existing option resolver now chooses the message boundary in that mode, preserving the caption on the attachment. Enabled block modes and explicit per-turn precedence are unchanged. The producer repair removes four net production lines; no channel-specific workaround or new state is needed.
Changing the global fallback refreshes registered channel runtimes through the existing reload planner. Contributed plugin rules keep precedence, and automatic reload/rollback preserves manually stopped accounts. Explicit account starts still work. No new dependency, storage schema, protocol, SDK subpath, or parallel reload mechanism is introduced.
User Impact
Configured media limits are accepted where bytes are consumed and enforced at root, normalized account, and global fallback scope. Oversized media does not bypass the cap through a raw URL or stale runtime. Valid media retains its original bytes and caption, inbound failures are recorded as unavailable attachments, and later valid messages remain usable.
Thanks to Ayaan Gazali (@ayaangazali) for the original schema work; contributor credit is preserved in the maintainer rewrite.
Evidence
Final publication head:
9ef6fa11f222827028571ea49a9e1d4ae486a0a7. Exact-head hosted CI completed successfully, including the required aggregate gate; no checks remain pending. The source/build/live evidence below is tied toa51d7e0; the only later change is the two-file test-allocation repair described at the end. Historical pending-CI wording below is superseded by this final status.Pre-fix failures were captured for native byte enforcement, account lookup, inbound staging, unchecked fallback URLs, non-final media false acknowledgements, identical caption follow-through, global-limit hot reload, and manual-stop preservation. The repairs use the existing persistence, reload, and durable-delivery owners rather than weaker assertions or larger timeouts.
The initial integrated candidate passed independent whole-effect Codex review across two complete chunks and the full changed-file gate. The changed-test run passed 560 tests in 11 files before a Tlon timeout cascade. Inspection of installed Vitest 4.1.11 showed that expired async test bodies could resume after teardown, install one-shot mocks, and start monitors in later cases. The fixture now checks the native test-context cancellation signal immediately after the same timed import, binds monitor cancellation to it, and resets the affected mock queues. It does not move the import, increase its deadline, or weaken assertions. The corrected three-file Tlon group passes all 35 tests; all remaining plugin tests pass too. Final combined coverage is 712 tests across 23 files. The final test-delta check passed, and a fresh whole-effect Codex review is clean across both complete chunks.
The final canonical SDK comparison from main
9a38b5ec8f6025dd52f89ab040d8a3413a473dd7toa51d7e05ecb76540a5f48cc8ff0c3d186af8edb4reports exactly one addition: the existingresolveChannelMediaMaxBytesfunction on existingaccount-helpers, with no removed or changed exports and no new entrypoint (acknowledgement digest35246b79). The final fullOPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpassed, including SDK exports and Control UI budgets. On the earlier byte-owner candidate, all six affected channel entrypoint imports completed under default profiler deadlines: QA Channel128.8MB, ClickClack539.8MB, Mattermost134.2MB, SMS150.9MB, Tlon128.7MB, Zalo Personal138.5MB peak RSS; this is not a before/after memory improvement claim.Source-blind compiled-Gateway validation of the initial candidate found a real streamed-caption failure at 512/1024 bytes: a detached partial edited a deleted preview and poisoned final delivery. That failed run is retained. Two deferred-deletion tests reproduced both identical and changed-partial races before repair. The queue correction passes 38 focused tests and independent review. The test compiler rejected direct
Promise.withResolvers; tests use the existing SDK deferred helper without changing runtime behavior, assertions or compiler settings. A second frozen run at8533dd4c38257b07f72ae6a21fecb4a991dde110passed 16/18 product cases and 18/18 recovery barriers but still failed both strict caption cases: exact media arrived with an empty caption. That failure was not relabeled; it led to the shared producer repair above. Three additional real resolver → subscriber → delivery tests failed before that repair; all 22 directive cases now pass, including enabled/disabled modes, per-turn precedence, partial previews and captionless media.At
a51d7e05ecb76540a5f48cc8ff0c3d186af8edb4, production LOC is +363/-219 (net +144); tests and test support +1540/-141; documentation +58/-3; generated +22/-22; tooling +4/-2; assertion baseline -1. Production growth implements six real byte consumers, the native profile/account boundary, and the missing reload dependency. Existing canonical resolvers and durable-delivery paths absorb nearby fixes; generated changes come only from canonical regeneration and preserve current main's other fields.The live contract exercises the actual isolated compiled Gateway and HTTP QA bus with a controlled model provider. It requests exact bytes, cap boundaries, mixed local versus remote batches, normalized named accounts, inbound notices, recovery, CLI-driven global fallback changes, manual stop/start, restart, and streamed caption/tool traces. It is not authenticated external-channel or real-model proof. Final source-blind validation at
a51d7e05ecb76540a5f48cc8ff0c3d186af8edb4passed all 18 assigned product probes and 18 recovery barriers. Both formerly failing streamed 512/1024-byte cases now publish the exact attachment and caption in the same durable message; the later repeated caption carries an actual new read-tool trace and correctly stays visible. Ordinary and captionless media controls also pass. Removing the channel cap activates the 4096-byte fallback; tightening it through the real CLI to 1024 rejects remote 2881-byte and inbound 3072-byte attachments without an explicit Gateway restart. A manually stopped account remains stopped; after an explicit start, its separate 2048-byte override accepts remote 1536-byte media and rejects 2111 bytes. After an explicit Gateway restart, oversized rejection and valid 512-byte outbound/inbound controls still pass. All six remote preflights returned HTTP 200 with exact fixture bytes. Recorded diagnostics distinguish size rejection from network failure.The final fixture terminated successfully: Gateway PID absent, all three listeners closed, cleanup errors empty, and the frozen 12,481-file/271,029,144-byte runtime graph unchanged (SHA-256
21916eeac9f36b6289dba30e77e38f93d847b5a3984d8f871ebdce70a2a1a629). Same-trace caption repetition and an exact 3072-byte remote fixture remain unexercised live; remote 2881-byte evidence is not claimed as 3072. The distinct-trace caption case and limit-specific local diagnostic are directly observed. The preserved previous failures remain failures, not overwritten by this passing run.The final refresh integrates main
9a38b5ec8f6025dd52f89ab040d8a3413a473dd7, including the auth-owner repair in #131519. Two actual conflicts were generated config baselines only; all production/test patches replayed identically. Canonical regeneration and an AST-based semantic audit preserve every other channel metadata field from main and add only the 12 intended positive-number root/account media-limit entries. Generated counts are core 2359 / channel 3674 / plugin 4034. The final changed gate passes, normal whole-branch independent review is clean across two complete chunks, and 540 tests across 7 files pass (458 Gateway, 22 directive, 60 QA). Earlier integration 553/14 and byte-owner 712/23 runs remain separate evidence, not summed as unique coverage. Exact-head hosted CI is pending; this is not yet a completed landing.Latest ClawSweeper review read: its QA loader enforcement finding is addressed at the native loader before bus publication, with root/account/fallback rejection and recovery proof; its request for a successful complete build is also addressed. The broader byte-owner and caption repairs merit a fresh re-review after publication. Caption provenance:
35ae782c84c23ae81686baf03e557c5f6c79036b(Peter Steinberger,2026-05-30) introduced the structured-media message-end suppression involved in the reproduced loss; no associated PR is guessed.Named follow-up: concurrent test/check processes can race the same Vitest filesystem cache lifetime. The full final gate and tests run serially; the original failed parallel attempt is retained. The separately fixed full-iMessage registry retention issue landed in #130518 and is included in this baseline.
The first hosted run at
a51d7e0caught a genuine test-allocation limit:plugins-platformhad 721 roots against its unchanged 720-root ceiling. The follow-up moves the entire 39-root media group into the existing messaging shard (682 and 526 roots respectively). The actual guard failed before and passed after; both affected type-check shards, eight existing partition tests, the changed gate, and a fresh normal independent review pass. No tests were removed, no limit was raised, and exact-once canonical coverage is preserved. This follow-up changes only two test configuration files: the live-tested production source and dependencies remain identical toa51d7e0. A fresh hosted run is required on the resulting head before landing.