Skip to content

fix: first image turn spikes gateway memory and adds seconds of latency when the active model already declares image input - #159232

Closed
alexeysophia wants to merge 1 commit into
openclaw:mainfrom
alexeysophia:fix/native-vision-catalog-skip
Closed

alexeysophia wants to merge 1 commit into
openclaw:mainfrom
alexeysophia:fix/native-vision-catalog-skip

Conversation

@alexeysophia

@alexeysophia alexeysophia commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #159231

What Problem This Solves

Fixes: the first turn carrying an image pays a full model-catalog load (a dedicated worker thread),
with the extra resident memory and latency that brings, even when the active model's own
configuration already declares that it accepts images. On a local Docker rig this was the first
photo turn for an agent in a fresh gateway process: +283.7 MiB peak RSS and 6603 ms elapsedMs
unpatched vs. +70.9 MiB and 1616 ms with this change (medians of 5, no in-process instrumentation;
rig numbers, not a real deployment — see Evidence for the staging-deployment numbers).

User Impact

Any deployment whose active model config already declares image support (the common case for a
native multimodal model) stops paying that first-image-turn memory/latency spike. Deployments that
rely on catalog-derived vision detection (no explicit input declared) see no change — that fallback
path is untouched.

Why This Change Was Made

explicitImageModelVisionStatus (same file, used for explicit image-model overrides) already
answers this from the configured model before ever loading the catalog.
activeModelSupportsNativeVision — the function actually consulted for the common case, a plain
active-model turn — never took that shortcut. This change gives it one, reading the configured row
the way runtime model resolution selects it:

  1. the provider config by its exact key first, then the normalized (case-insensitive) fallback —
    the same order as resolveConfiguredProviderConfig
    (src/agents/embedded-agent-runner/model.configured-overrides.ts:201-208);
  2. the active model's row through findConfiguredProviderModel, the helper runtime uses for the same
    selection (src/config/model-provider-config.ts:14), accepted only when it is the literal row
    for the active model id (runtime gives the literal row precedence, :79).

If that row declares input: ["image"] and is not marked metadataSource: "models-add", return
true immediately; otherwise fall through to the existing catalog-based path unchanged. The diff
touches only activeModelSupportsNativeVision (plus one import); no shared helper changes.

The shortcut answers the same question the attach check will. A true here makes
runCapability skip image understanding and hand the image to the primary model, so it must only
be true when the image will actually be attached.

Why the shortcut can never cause the image to be dropped (attach-check trace, MiniMax and tools.media.models interactions)

The attach check is detectAndLoadPromptImages, which returns no images unless the runtime model's
params.model.input?.includes("image") (src/agents/embedded-agent-runner/run/images.ts:252). That
runtime input normally comes from the same configured row the shortcut reads. For a model defined
only in models.providers, buildInlineProviderModels and completeInlineProviderModel set it from
the row's input (src/agents/embedded-agent-runner/model.inline-provider.ts:164-169 and
:196-201, through resolveProviderModelInput, which takes a configured array over any fallback,
:105). For a model that also has discovered or catalog metadata,
applyConfiguredProviderOverrides passes the configured row's input first and the discovered
input only as the fallback (src/agents/embedded-agent-runner/model.configured-overrides.ts:503-508).
So a row that declares "image" yields a runtime model that declares "image", and the attach check
keeps the image.

The exception is a row marked metadataSource: "models-add" (the schema's "models added by
CLI/catalog tooling" marker, src/config/zod-schema.core.ts:301-302; openclaw doctor also stamps
it on legacy openai-codex rows so official OpenAI Codex metadata can override it,
src/commands/doctor/shared/legacy-config-core-normalizers.ts:338-346). When the resolver asks to
prefer discovered metadata (preferDiscoveredModelMetadata, set at
src/agents/embedded-agent-runner/model.ts:271 and model.registry-resolution.ts:284),
applyConfiguredProviderOverrides drops such a row as the metadata source
(model.configured-overrides.ts:452-455), so the discovered input wins and may lack
"image". A shortcut true there could skip image understanding while the attach check then drops
the image, losing it silently. The shortcut therefore never fires for a models-add row; those rows
take the unchanged catalog path. The sibling explicitImageModelVisionStatus is left as it is.

More shapes worth being explicit about:

  • Differently cased provider keys. With both CUSTOM and custom configured and the active
    provider custom, runtime resolves the exact custom key, so the shortcut reads that same row:
    if only CUSTOM declares "image", the shortcut misses and the catalog answers (regression case
    "an exact provider key wins over a differently cased key"); if only custom declares it, the
    shortcut fires. A normalized-only lookup would have answered from CUSTOM here and skipped image
    understanding for an image the attach check then drops.
  • Model-id normalization. The shortcut accepts only the literal row for the active model id; a
    row reached only through alias/canonical matching makes the shortcut miss (falling through to the
    unchanged catalog path) — never a false positive, because a miss always defers to the exact same
    catalog lookup that ran before this change.
  • MiniMax. The shortcut is inserted after the existing MiniMax early-return
    (isMinimaxVlmProvider(activeProvider) && !/^MiniMax-M3(\b|[-.])/i.test(model) => return false),
    not before it: a MiniMax provider whose active model isn't MiniMax-M3(.x) still returns false
    immediately, with no catalog load and without ever reaching the configured-row lookup — even if
    that model's own config row declares input: ["image"] (true for MiniMax M2.x rows).
  • Explicit image-understanding config (tools.media.models). When that array is set,
    runCapability's own skip branch is gated by !hasExplicitImageUnderstandingConfig(...), so this
    fix's shortcut can never cause the native-vision skip-and-hand-natively path to fire in that case —
    that guard is untouched by this diff.

Bound: one extra synchronous config lookup (provider key, then model row) per call — no new I/O,
no new catalog read, no change to any other branch's control flow.

This is additive, but not return-value-neutral in one case, deliberately: when the active model's
own config row (not marked models-add) declares input: ["image"] but the model catalog is silent
about it or actively disagrees (an unlisted model, a stale/failed catalog fetch, or a catalog entry
that itself lists the same model as text-only), the function today answers false even though the
runtime model will declare "image" and the attach check will keep the image (see the collapsed
section above). This fix answers true instead, matching the in-file precedent:
explicitImageModelVisionStatus (same file, immediately above this function) already gives the
configured input array priority over the catalog for the equivalent explicit-image-model decision.
Every other outcome is unchanged.

Evidence

Rig: a local Docker container rig (not upstream CI), cgroup v1, memory capped at -m 1g — the
rig numbers below are sandbox numbers, not measurements from a real deployment by themselves; a staging-deployment
measurement follows separately.

Call-path proof — a scratch copy of the built dist/runner-*.js with one additive console.error at
the top of activeModelSupportsNativeVision, bind-mounted into a fresh container for one proof turn
(docker logs -t prefix removed):

2026-09-25T19:37:03.502+00:00 [VISION-PROBE] activeModelSupportsNativeVision called provider=usage-proxy model=gpt-5.4 agentId=user
[trace-workers] CREATE t=2026-09-25T19:37:03.520Z filename=file:///usr/local/lib/node_modules/openclaw/dist/agents/prepared-model-catalog.worker.js argv=undefined resourceLimits=undefined

The worker is created 18 ms after the function is entered; the text-only warm-up turn on the same
container logged neither line. A stack captured at Worker construction stops at
WorkerTaskPool.start (async chain), so the caller attribution rests on this pair of lines.

Clean A/B, 5 fresh containers unpatched vs. 5 fresh containers with this fix's shortcut applied as a
dist patch, each used once for a text warm-up and then one photo turn, no in-process instrumentation
(median of 5; gateway RSS sampled every 0.1 s for 150 s; +Peak is the highest sample over each
run's own pre-photo baseline RSS during the first image turn — after the turn, RSS stays at about
that level; elapsedMs is the photo turn's own HTTP round-trip). The dist patch did not include the
models-add guard or the exact-provider-key selection; the rig's config has a single provider key
and its row carries no metadataSource, so neither would have changed any of these runs:

Variant Worker created? (from gateway thread count) +Peak RSS elapsedMs decoded_bytes (unchanged)
unpatched (median of 5) yes, 5/5 (11→12) +283.7 MiB [+278.0…+289.6] 6603 [6424…7103] 263108
patched (median of 5) no, 0/5 (11→11) +70.9 MiB [+67.8…+73.4] 1616 [1526…1668] 263108
Smaller (3+3) call-path/frequency capture under a worker-tracing preload, and the control run with the shortcut deliberately missing

Separate, smaller (3+3) capture with the trace-workers.cjs preload loaded (needed to observe
Worker construction directly), used only for call-path/frequency evidence, not for sizing — that
preload alone inflates the photo-turn peak by about 115 MiB (isolated separately against this same
patched state: +70.9 MiB clean vs. +186.1 MiB with only the preload added), so its own elapsedMs and
RSS readings run higher than the clean table above. Raw lines behind that capture (verbatim;
docker logs -t prefix removed). Photo-turn HTTP results, unpatched containers rig-vpA1..rig-vpA3
then patched containers rig-vpB1..rig-vpB3:

turn.sh: rig-vpA1 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":6131,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}
turn.sh: rig-vpA2 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":5574,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}
turn.sh: rig-vpA3 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":5545,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}
turn.sh: rig-vpB1 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":1858,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}
turn.sh: rig-vpB2 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":2054,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}
turn.sh: rig-vpB3 agentId=user sessionKey=local-rig-smoke -> {"httpStatus":200,"body":{"elapsedMs":1929,"sessionKey":"agent:user:local-rig-smoke","status":"delivered"}}

RestartCount=0 and the original gateway pid alive at the end of every run in this capture. OpenClaw's
own memory watchdog on the two unpatched runs that crossed its critical threshold (no patched run
logged level=critical):

2026-09-25T19:50:02.998+00:00 [diagnostics/memory] memory pressure: level=critical reason=rss_threshold rss=771.4 MiB heap=338.6 MiB threshold=768 MiB thresholdRatio=100.4% rssBytes=808845312 heapUsedBytes=355067952 thresholdBytes=805306368 memoryPressureSnapshot=disabled nextStep=inspect latest stability bundle or run openclaw gateway diagnostics export; restart gateway if process is unstable
2026-09-25T19:53:00.222+00:00 [diagnostics/memory] memory pressure: level=critical reason=rss_threshold rss=824.7 MiB heap=258.1 MiB threshold=768 MiB thresholdRatio=107.4% rssBytes=864743424 heapUsedBytes=270604560 thresholdBytes=805306368 memoryPressureSnapshot=disabled nextStep=inspect latest stability bundle or run openclaw gateway diagnostics export; restart gateway if process is unstable

decoded_bytes identical across every run confirms the image still reaches the model natively either
way — this change affects only how the native-vision decision is made, not what the model
receives.

Control run with the patch applied and the active model's input hot-reloaded to ["text"] only,
so the shortcut must miss. Observed lines, in order: the reload, the worker's creation (the catalog
path ran), no primary-model native skip, a call to openai/gpt-5.6-sol — an image model OpenClaw
resolved automatically; the rig config names no such model — answered 401 (the rig had no OpenAI
credentials), and the worker's exit:

2026-09-25T20:04:43.937+00:00 [reload] config hot reload applied (models.providers.usage-proxy.models, agents.entries.user)
[trace-workers] CREATE t=2026-09-25T20:04:58.180Z filename=file:///usr/local/lib/node_modules/openclaw/dist/agents/prepared-model-catalog.worker.js argv=undefined resourceLimits=undefined
2026-09-25T20:05:01.745+00:00 [provider-transport-fetch] [model-fetch] start provider=openai api=openai-responses model=gpt-5.6-sol method=POST url=https://api.openai.com/v1/responses timeoutMs=undefined proxy=none policy=custom
[trace-workers] EXIT t=2026-09-25T20:05:01.747Z threadId=-1 filename=file:///usr/local/lib/node_modules/openclaw/dist/agents/prepared-model-catalog.worker.js code=1
2026-09-25T20:05:02.844+00:00 [provider-transport-fetch] [model-fetch] response provider=openai api=openai-responses model=gpt-5.6-sol status=401 elapsedMs=1099 dispatcher=new contentType=application/json
2026-09-25T20:05:02.874+00:00 [media-understanding] image: failed (0/1) reason=Image model failed (openai/gpt-5.6-sol)

code=1 with threadId=-1 is the exit code Node's worker.terminate() produces, which is how
WorkerTaskPool retires a worker; it is not by itself a sign of an error. The fallback model call
started 2 ms before that exit, so the probe had already returned. This run shows only that the
shortcut misses when input lacks "image" and the catalog path still runs; it does not exercise the
case where config declares "image" and the catalog disagrees.

Same fix, measured on a real staging deployment (a test environment running the same image, not the rig) (real Telegram photo delivered through the
deployment's own channel-inbound turn path, not the rig above; Azure VM host, cgroup v2, container
memory limit 1200 MiB; OpenClaw 2026.9.2 with this fix and a companion lazy-provider-registry fix (#159234, since merged to main)
both applied as build-time patches; uninstrumented — VmRSS and /proc/<pid>/task of the real
openclaw-gateway process sampled at 1 Hz): first photo (960×1280 JPEG, 143,737 bytes) on a fresh
gateway process — baseline 436.5 MiB, peak +58.2 MiB, settled at 120 s +54.3 MiB, gateway thread
count 11 → 11 (no catalog worker started); a second assistant on the same host sent two photos on one
gateway process, thread count stayed 11 throughout. The same host's own pre-fix measurement (earlier
deployment, OpenClaw 2026.9.2 with neither this fix nor the companion fix, same photo shape
~960×1280, ~145 KB): gateway RSS went 425.7 → 718.3 MiB (+292.6 MiB) on one photo; on a heavier
assistant the same photo pushed the gateway over that deployment's 1200 MiB container memory limit
and the kernel OOM-killed it (oom-kill: constraint=CONSTRAINT_MEMCG ... task=openclaw-gatewa ... Killed process ... (openclaw-gatewa) anon-rss:1187204kB). These staging-deployment numbers are the
combined effect of both fixes together, stated plainly as such; the per-fix split (this fix alone
vs. both together) comes from the rig A/B above, where this fix alone already accounts for almost all
of the saving.

Repository regression test, run in upstream CI on the current head 8ce6fd85 (repo toolchain,
Node 24.19.0, vitest 5.0.1): runner.native-vision-catalog-skip.test.ts passed 10/10 in
checks-node-changed-3.
Verbatim, with the shard prefix removed:

 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a model with a declared image input never touches the catalog 10ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a configured text-only model still falls back to the catalog, unchanged 27ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a model with no models.providers entry at all still loads the catalog, unchanged 1ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a models-add row with declared image input takes the catalog path 0ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a declared image input overrides a catalog with no matching entry, changing the answer to true 0ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a declared image input overrides a catalog that explicitly disagrees (lists the same model as text-only), changing the answer to true 0ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a MiniMax M2.x entry with declared image input still returns false, no catalog load 1ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > a second declared image model under the same provider also skips the catalog 0ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > an exact provider key wins over a differently cased key, as in runtime resolution 1ms
 ✓  media-understanding  src/media-understanding/runner.native-vision-catalog-skip.test.ts > activeModelSupportsNativeVision - declared image input skips the catalog load > an exact provider key with declared image input skips the catalog despite an earlier cased key 0ms
 Test Files  1 passed (1)
      Tests  10 passed (10)

Provider-key precedence (the ClawSweeper P1 raised on aeffe782/32918d0f/d9be501b) is fixed
in this head.
The two "exact provider key" cases above are the requested CUSTOM-before-custom
regression and its mirror. Against the previous shortcut, those two cases and the "second declared
image model" case fail and the other seven pass (Tests 3 failed | 7 passed (10), local run).
Locally on this head, runner.native-vision-catalog-skip.test.ts plus the sibling
runner.vision-skip.test.ts pass 22/22, pnpm tsgo:core reports no errors, and the mock-export
ratchet, oxfmt --check, oxlint, and git diff --check are clean.

Rebase onto current main. The branch was rebased from main@32dcd029 onto
main@a81b9cd7. This picked up two main changes that this PR adapts to:

CI status of the current head: all checks pass, including openclaw/ci-gate (60 passed, the
rest skipped as not applicable).

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 6:48 AM ET / 10:48 UTC (Revision 10).

ClawSweeper review

What this changes

The media-understanding runner uses the active model’s explicitly configured image support to avoid loading the full model catalog, with regression coverage for precedence and fallback behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still incurs the catalog load, and the merged companion optimization addresses a different cost. The prior provider-precedence finding is resolved; no blocking patch defect remains.

Priority: P1
Reviewed head: 8ce6fd85abaff0467dbb1aeadfb5f185c9cccb06

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with strong runtime evidence and resolved prior findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The runner’s catalog-avoidance behavior is exercised through real inbound photo turns on staging, supported by isolated production-path A/B traces showing no catalog worker and unchanged image delivery. Staging measurements combine both optimizations; the rig isolates this shortcut. Later precedence and metadata guards are covered by source and current-head regression evidence. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The runner’s catalog-avoidance behavior is exercised through real inbound photo turns on staging, supported by isolated production-path A/B traces showing no catalog worker and unchanged image delivery. Staging measurements combine both optimizations; the rig isolates this shortcut. Later precedence and metadata guards are covered by source and current-head regression evidence. No stored-data contract changes.
Evidence reviewed 10 items Introduced production change: The pinned merge-base-to-head diff adds the configured-row shortcut after the existing MiniMax exclusion. Exact provider keys precede normalized lookup; literal model identity and the models-add exclusion constrain affirmative answers.
Current main still needs the fix: At fetched main, activeModelSupportsNativeVision proceeds from the MiniMax check directly to readPreparedModelCatalog; the configured-image shortcut is absent.
Runtime input contract: Runtime resolution uses exact provider-key precedence and the same configured-model resolver. Authored input overrides discovered input unless models-add metadata is deliberately deferred to discovery; the shortcut excludes that exception.
Findings None None.
Security None None.

How this fits together

Media understanding processes incoming attachments before the agent replies. It decides whether to describe an image separately or pass it directly to the active model.

flowchart TD
  A[Incoming image] --> B[Media understanding]
  C[Active model configuration] --> B
  B --> D{Explicit native image support}
  D -->|Yes| E[Native image delivery]
  D -->|Unknown| F[Model catalog lookup]
  F --> E
  F --> G[Separate image description]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +20, Tests +255. Total +275 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 20 0 +20
Tests 1 255 0 +255
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 275 0 +275

Review metrics

Metric Value Why it matters
First-photo performance 5 runs per variant: peak RSS increase 283.7 → 70.9 MiB; latency 6603 → 1616 ms The contributor’s isolated Docker measurements quantify the shortcut’s benefit separately from the companion registry optimization.

Technical review

Best possible solution:

Use authored image capability when runtime resolution will honor it, retaining catalog fallback and existing explicit image-processing controls.

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

Yes: current-main source still unconditionally reads the catalog when this native-vision check runs, and the contributor supplies fresh-process photo-turn traces. This review verified the path from source without executing it.

Is this the best way to solve the issue?

Yes: the shortcut reuses configured-model selection and aligns its affirmative answer with runtime image input, while preserving existing fallback and override paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8dc04b001e10.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The first-image overhead affects real agent turns, with staging evidence of memory-limit failure before the combined fixes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The runner’s catalog-avoidance behavior is exercised through real inbound photo turns on staging, supported by isolated production-path A/B traces showing no catalog worker and unchanged image delivery. Staging measurements combine both optimizations; the rig isolates this shortcut. Later precedence and metadata guards are covered by source and current-head regression evidence. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The runner’s catalog-avoidance behavior is exercised through real inbound photo turns on staging, supported by isolated production-path A/B traces showing no catalog worker and unchanged image delivery. Staging measurements combine both optimizations; the rig isolates this shortcut. Later precedence and metadata guards are covered by source and current-head regression evidence. No stored-data contract changes.

Evidence

What I checked:

  • Introduced production change: The pinned merge-base-to-head diff adds the configured-row shortcut after the existing MiniMax exclusion. Exact provider keys precede normalized lookup; literal model identity and the models-add exclusion constrain affirmative answers. (src/media-understanding/runner.ts:406, 8ce6fd85abaf)
  • Current main still needs the fix: At fetched main, activeModelSupportsNativeVision proceeds from the MiniMax check directly to readPreparedModelCatalog; the configured-image shortcut is absent. (src/media-understanding/runner.ts:387, 8dc04b001e10)
  • Runtime input contract: Runtime resolution uses exact provider-key precedence and the same configured-model resolver. Authored input overrides discovered input unless models-add metadata is deliberately deferred to discovery; the shortcut excludes that exception. (src/agents/embedded-agent-runner/model.configured-overrides.ts:201, 8ce6fd85abaf)
  • Native attachment boundary: The complete image-loading module confirms that native hydration requires runtime model input containing image. The reviewed shortcut agrees with that input construction and leaves filesystem, sandbox, and media-loading safeguards intact. (src/agents/embedded-agent-runner/run/images.ts:252, 8ce6fd85abaf)
  • Regression coverage and review continuity: Read the complete new suite and sibling vision-routing suite. The new cases protect catalog avoidance, catalog disagreement, models-add fallback, MiniMax behavior, multiple configured models, and both exact-versus-cased provider-key directions. These resolve the retained earlier precedence finding. The matching PR body reports 10/10 passing on the current head and 22/22 with the sibling suite; tests were not executed during this read-only review. (src/media-understanding/runner.native-vision-catalog-skip.test.ts:215, 8ce6fd85abaf)
  • Captured runtime proof: Retrieved body SHA-256 7878cc9f5c476add87d3778a8558f74bc2420235e9a56982739939255eb8a0c6 matches the supplied snapshot, including its omitted evidence section. Fresh-container A/B runs exercised the channel inbound production path: catalog worker presence changed from 5/5 to 0/5, with identical received image bytes. Real Telegram staging turns with both optimizations applied retained 11 threads and showed a first-photo peak increase of 58.2 MiB. The body distinguishes combined staging effects from this shortcut’s isolated rig measurements and explains why later guard refinements do not alter the measured configuration.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • alexeysophia: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-27T12:24:35.645Z sha 7485ccdee4447ff12a9180f465bc2d57baa38290 :: blocked before merge. :: none
  • reviewed 2026-09-27T13:19:33.959Z sha 7485ccdee4447ff12a9180f465bc2d57baa38290 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T20:53:54.541Z sha aeffe782890fae597022c6f1abc0db79a4095817 :: blocked before merge. :: [P1] Preserve exact provider-key precedence in the vision shortcut
  • reviewed 2026-10-05T21:13:57.968Z sha 32918d0f27dcb88ec5eec343388e62e57438838c :: blocked before merge. :: [P1] Preserve exact provider-key precedence in the vision shortcut
  • reviewed 2026-10-05T21:34:12.665Z sha d9be501bc9b602d350b89268606d9acf1ce7d75e :: blocked before merge. :: [P1] Preserve exact provider-key precedence in the vision shortcut
  • reviewed 2026-10-05T22:06:59.872Z sha 45c0e0aa5d9be6714e66cd893534e208966edc8a :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T22:27:02.420Z sha 78ce51b89596b20b3be02a6401a5546be9472ae6 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-06T10:32:42.122Z sha 8ce6fd8 :: needs maintainer review before merge. :: none

@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch from 51b30fe to 7485ccd Compare September 27, 2026 12:13
@alexeysophia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the P1/P2 items ("run the new regression test in the repository toolchain and report its cost"). On the new head 7485ccde, runner.native-vision-catalog-skip.test.ts passed 8/8 in upstream CI (job) using 3 ms of test time, inside a 28.42 s sub-shard. Verbatim output is in the Evidence section. Otherwise the head differs from 51b30fec only by an oxfmt reformat of the test file (which was our check-lint failure) and a rebase onto main@32dcd029; no production line changed. The one red node shard (session-history-worker.integration.test.ts) is in gateway code this PR does not touch. There is no [CI] issue for it; details are in Evidence.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch from 7485ccd to aeffe78 Compare October 5, 2026 20:45
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch 2 times, most recently from 32918d0 to d9be501 Compare October 5, 2026 21:18
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label Oct 5, 2026
@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch from d9be501 to 45c0e0a Compare October 5, 2026 21:50
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 5, 2026
@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch from 45c0e0a to 78ce51b Compare October 5, 2026 22:11
…cy when the active model already declares image input

activeModelSupportsNativeVision always loaded the full model catalog to
decide native-vision support, even when the active model's own configured
input already says "image". Answer from the configured row first, selected
the way runtime model resolution selects it (exact provider key before the
normalized fallback, then the literal model row), so the shortcut never
disagrees with the attach check. metadataSource: "models-add" rows are
excluded because runtime may prefer discovered input over them.

Adds runner.native-vision-catalog-skip.test.ts covering the declared-image
fast path, the unchanged catalog fallback (text-only config, no
models.providers, models-add rows), disagreeing-catalog / MiniMax /
two-image-model cases, and exact-vs-cased provider key precedence.
@alexeysophia
alexeysophia force-pushed the fix/native-vision-catalog-skip branch from 78ce51b to 8ce6fd8 Compare October 6, 2026 10:25
@alexeysophia

Copy link
Copy Markdown
Contributor Author

Closing. Re-measured on current main from source (BASE a81b9cd7 = this PR's parent vs. this PR at 8ce6fd85, n=5 per tree, interleaved, plus a photo-first variant with no published catalog owner yet): on today's main the read-only catalog read no longer starts prepared-model-catalog.worker.js on the first image turn. A Worker-constructor trace recorded zero catalog-worker creations in 12 runs on either tree, and thread counts, peak RSS and elapsedMs match within run-to-run spread. The only remaining effect is skipping the async read, about 6–12 ms on the dispatch→skip span, which is within noise. The first-image-turn cost this PR targeted was real on 2026.9.2 but no longer reproduces on main, so there is nothing left here worth a maintainer's review time. Full numbers are in the reply on #159231.

Thanks to ClawSweeper for the provider-key precedence catch along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: first image turn in a fresh gateway process loads the full model catalog even when the active model declares image input

1 participant