Skip to content

feat(media-understanding): shared structured extraction for image-capable providers - #119773

Closed
rodrigo-fonseca-oliveira wants to merge 1 commit into
openclaw:mainfrom
rodrigo-fonseca-oliveira:rodrfons/lab-94-default-extract-structured-to-model-runtime
Closed

rodrigo-fonseca-oliveira wants to merge 1 commit into
openclaw:mainfrom
rodrigo-fonseca-oliveira:rodrfons/lab-94-default-extract-structured-to-model-runtime

Conversation

@rodrigo-fonseca-oliveira

@rodrigo-fonseca-oliveira rodrigo-fonseca-oliveira commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #119772

AI-assisted PR. Written with Claude Code; I have reviewed the change and understand what it does. See Evidence for validation.

Rescoped on 6 September. The previous head of this branch bundled two fixes. The provider-resolution half landed on main as #139231 (18733285112b), rewritten by @steipete at the shared catalog owner — I am not carrying a second version of it here. What remains is the other half, now filed as the feature it is rather than a bug fix, at +220/−11 production lines instead of +336/−27.

What Problem This Solves

Logbook's visionModel is effectively single-provider. On current main:

  • extensions/codex/media-understanding-provider.ts is the only extractStructured implementation in the repository.
  • Registry hydration binds describeImage and describeImages from the shared image runtime for every image-capable provider (src/media-understanding/provider-registry.ts:44-45) but never extractStructured.
  • So extractStructuredWithModel throws Provider does not support structured extraction: <id> (src/media-understanding/runtime.ts:372) for any non-Codex provider — after fix(media): keep deferred audio and extraction providers discoverable #139231 made that provider resolvable, it resolves and then throws.

The extractStructured contract shipped in May with Codex as its only implementer; the docs already say other providers "do not currently expose" it. This PR gives them one.

Why This Change Was Made

Owner: the registry hydration and the shared image runtime that already own the describeImage/describeImages defaults.

Canonical fix. Hydration binds extractStructured: provider.extractStructured ?? extractStructuredWithImageModel next to those defaults; providers with their own hook (Codex) keep it. src/media-understanding/structured-extraction.ts runs one completion through completeImagesWithModel with the extraction instructions — including a no-secrets rule — as the prompt, supplemental text inputs as userText in the user message, and the reply parsed and schema-validated the same way the Codex extractor does it. It never routes through a provider's bespoke describeImages. Replies are parsed strictly first; a fenced or prose-wrapped reply falls back to the first balanced JSON object or array via normalization-core's extractBalancedJsonPrefix, so a model that ignores "no Markdown fences" does not fail the whole batch — Codex's own extractor does a raw JSON.parse, so the shared path is now the more tolerant of the two. A reply with no JSON in it is still a controlled error.

The delivery gate, and what it deliberately is not. The output is persisted, so the instructions must reach the model as an instruction, not as user text beside a screenshot. promptDelivery: "system-required" makes the runtime refuse — before any stream is registered or request sent — exactly the routes on which the runtime itself decides to demote the prompt into user content: shouldPlaceImagePromptInUserContent (the GitHub Copilot, OpenRouter, and Alibaba Model Studio endpoint classes) and both MiniMax VLM branches. Those get a named batch error.

The previous head instead carried an allowlist of transport names. That was wrong in both directions — it refused Ollama on its api string even though Ollama's plugin stream sends Context.systemPrompt as a role: "system" message (extensions/ollama/src/stream.runtime.ts:740), and it admitted plugin streams on a declared name it could not verify. The gate now records only the one decision the runtime owns. The trust boundary for a plugin stream that demoted systemPrompt is the plugin install — such a plugin would break every agent turn on that provider — and I have left that as a question for maintainers rather than a promise in code.

agentDir default. The shared extractor defaults an empty agentDir to the configured default agent dir (structured-extraction.ts). The dispatcher is unchanged and still passes "" through, so a bespoke extractor such as Codex — which uses a non-empty agentDir as its thread cwd and loads project-local configuration from it (extensions/codex/src/app-server/bounded-turn.ts:125) — sees no change at all. On the shared path that value is the key for prepared-model owners, and "" matches none of them on a long-lived gateway; Logbook never passes one. An earlier revision of this head put the default in the dispatcher, which would have changed Codex's working directory for existing installs — the review caught it, and it is fixed here.

Removed versus the previous head, so reviewers who saw it know what went where: the by-id resolver (superseded by #139231); the transport allowlist and KnownApi inspection (above); imagePayloadTransform and the opencode rewrite (opencode-only and separable — opencode is now hydrated with the shared hook without its reasoning-strip transform, which I am naming as a follow-up rather than carrying an SDK-adjacent field for one plugin). runtime.ts, runtime.test.ts, and all three opencode files are byte-identical to main.

Maintainer decision requested

Hydration now supplies extractStructured to every image-capable provider that lacks one — including providers whose describeImage/describeImages are bespoke. That is a change to the provider-plugin capability contract, and I would rather state it than have it found.

What it does and does not do: the shared extractor never calls a provider's describe hooks — it runs its own completion through completeImagesWithModel, the same stream path describeImage takes when a provider does not override it. So a provider with bespoke description hooks that previously returned a visible Provider does not support structured extraction error now either extracts, or returns a visible provider error recorded on the batch. The delivery gate applies either way. On current main, the only bundled provider with bespoke hooks and no extractor of its own is opencode (its reasoning-strip transform is the named follow-up); Codex keeps its own.

I looked for a narrower rule and there isn't a correct one expressible from hook shape: deepinfra assigns the shared functions by reference, openai wraps the shared function in a lazy-import closure, and anthropic/google/ollama leave the hooks undefined — presence or identity checks each exclude a provider that is plainly on the shared path. The alternatives are therefore (a) this behavior, documented as above, or (b) an explicit opt-in on the provider contract, which is SDK surface and a maintainer call. I am asking for (a) and will implement (b) if that is the decision.

User Impact

  • Logbook works with any image-capable provider for which the shared runtime delivers the prompt as a system instruction. visionModel becomes a real choice.
  • The Copilot, OpenRouter, and Model Studio endpoint classes and the MiniMax VLM endpoint are refused with an error naming the route, recorded on the batch, instead of running with a weaker boundary. docs/plugins/logbook.md and the visionModel help text state this rule and nothing broader.
  • No behavior change for providers with their own extractStructured, for audio/video-only providers, or for plain describeImage/describeImages — only promptDelivery: "system-required" consults the gate.

Evidence

Regression tests fail on pre-fix code, captured by removing the relevant line and re-running:

  • Hydration line removed → provider-registry.test.ts: expected undefined to be [AsyncFunction invoke] on "hydrates structured extraction from the shared runtime".
  • promptInUserContent refusal removed → image.test.ts: the Copilot case reaches complete() (Cannot read properties of undefined (reading 'stopReason')), the MiniMax case resolves "portal ok" instead of rejecting — i.e. the request went out.
  • agentDir default removed → structured-extraction.test.ts: '' received where the configured default agent dir was expected.
  • Fence fallback removed → structured-extraction.test.ts: a ```json -wrapped reply fails with Structured extraction returned invalid JSON: anthropic.

Boundary tests. image.test.ts asserts the exact Context handed to complete — system prompt equals the instruction, user message holds the caller text and image only — and that refused routes make no stream registration, no complete, and no fetch. structured-extraction.test.ts covers prompt assembly, text-input placement, JSON parsing, and schema validation. provider-registry.test.ts covers hydration identity and bespoke-hook preservation.

Ran locally on this head: node scripts/run-vitest.mjs over image, provider-registry, runtime, structured-extraction, image-tool.provider-loading, and both opencode suites — all green; oxfmt, oxlint on changed files; git diff --check; pnpm plugin-sdk:surface:check (no new SDK exports); check:assertion-safety; check:coercion-helpers; config:docs:check after regenerating docs/.generated/config-baseline.sha256 for the help-text change, as that check's own message instructs; an independent $autoreview pass at P2, which produced one finding — the fenced-JSON hard failure above — fixed in this head.

Left to CI on purpose: pnpm build, the tsgo typecheck lanes, and the full suite. My development machine cannot run those lanes, so this PR's CI on the exact head is the authority for them.

Real-behavior proof (this head)

Isolated dev gateway on an x86-64 Linux box (Node v24.19.0), own OPENCLAW_STATE_DIR, own port, never the operator's gateway. Logbook capture is macOS-only, so two synthetic JPEGs (a mock editor window; no real screen content) were seeded as frames — extraction, provider resolution, and the batch pipeline are all real; only the screenshot source is not.

Head ce8458199cf95c85703fa1c884943e3541a552e1; base dd3faf5f. Built dist self-reports OpenClaw 2026.9.2 (ce84581). Vision model: qwen2.5vl:7b on local Ollama — a plugin stream with no bespoke extractStructured, which the previous head's allowlist would have refused on its api string.

1. Accepted route completes (Ollama)

visionModel: ollama/qwen2.5vl:7b

$ openclaw gateway call logbook.analyze.now
{ "started": true }
$ openclaw gateway call logbook.status
lastBatch: { "id": 1, "day": "2026-09-06", "status": "done", "endMs": 1788750180139 }
todayCards: 2

logbook.timeline returns two cards built from the seeded frames:

{ "title": "Drafting release notes",
  "detail": "Added a short paragraph about how the extraction prompt travels in the system channel",
  "category": "coding", "keyframeId": 1 }
{ "title": "Re-read runtime dispatcher", "category": "coding", "keyframeId": 2 }

batches row: {id:1, status:"done", error:null, frame_count:2, model:"ollama/qwen2.5vl:7b"}. Gateway log: [plugins] loading ollama from <dist>/extensions/ollama/index.js.

The prompt reaches the model in the system channel. A logging pass-through proxy in front of Ollama recorded the extraction request:

POST /api/chat  bytes=87752
  model='qwen2.5vl:7b' stream=True
  messages[0].role='system' text="You are OpenClaw's bounded structured-extraction worker.
    Return only the requested extraction. Do not include secrets such as passwords, API keys,
    tokens, or credentials, even when they are visible in the input. ..."
  messages[1].role='user' images=2 text=''
  -> upstream 200

That is STRUCTURED_EXTRACTION_INSTRUCTIONS verbatim as role: "system", images in the user message — the property promptDelivery: "system-required" exists to protect.

2. Refusal happens before extraction I/O

visionModel: minimax/MiniMax-VL-01, with that provider's baseUrl pointed at a local listener that logs every TCP connection.

$ openclaw gateway call logbook.analyze.now      # 23:20:56
$ openclaw gateway call logbook.status
lastBatch: { "id": 1, "status": "error",
  "error": "Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)" }

Listener log, complete file:

23:20:39 LISTENER-START port=19001
23:20:41 CONNECT from ('127.0.0.1', …)   first-bytes b'GET /listener-self-test HTTP/1.1…'

The single entry is a curl self-test proving the listener records. Zero connections after the trigger — the route was refused before any request was built.

Same refusal on the OpenRouter class against the real https://openrouter.ai/api/v1 with a dummy key, terminal in 5s (a key that reached OpenRouter would return 401 instead):

lastBatch: { "id": 3, "status": "error",
  "error": "Provider does not accept system instructions for image requests: openrouter/qwen/qwen2.5-vl-7b-instruct (the prompt is delivered as user content)" }

3. Existing route (Codex) is untouched

$ git diff HEAD~1 -- src/media-understanding/runtime.ts extensions/codex/media-understanding-provider.ts
$ echo $?
0

Empty. Neither file is in the commit's changed set, and the dispatcher still passes agentDir: params.agentDir ?? "" unchanged (src/media-understanding/runtime.ts:387), so the bespoke Codex extractor keeps receiving "" as its thread cwd. No OpenAI/Codex credentials were available for a live Codex run; the diff is the proof offered.

4. Before/after on the same batch

Base dd3faf5f built separately in its own checkout, same state dir and frames:

BEFORE (dd3faf5f)  lastBatch: { "id": 4, "status": "error",
                     "error": "Provider does not support structured extraction: ollama" }
AFTER  (ce845819)  lastBatch: { "id": 4, "status": "done", "endMs": 1788751260139 }

Identical frames, identical batch id, only the checkout differs.

Complete diagnostics — the full proxy and listener logs, every gateway batch/refusal/plugin-load line, RPC captures, and redacted configs — are in this comment.

Limits of this proof, stated

  • The github-copilot class could not be exercised. That provider validates its token against GitHub before any inference (extensions/github-copilot/runtime-auth.ts:83-96) and derives its API base URL from that response, so without valid Copilot credentials the batch fails at Copilot authentication failed: HTTP 401 before the gate runs. With valid credentials the classification is the same as OpenRouter's and the gate applies; I have no Copilot account to show it live. The OpenRouter and Model Studio branches are classified from baseUrl (resolveProviderRequestCapabilities), so they cannot be aimed at a local listener — hence OpenRouter was proven against its real host and MiniMax carried the zero-I/O proof.
  • Pre-existing Logbook behavior found on the way, not this PR's: card synthesis (reviseCards) runs on the agent default model, not visionModel. With no agents.defaults.model configured, extraction succeeds and the observations are written, but the batch is then marked error by the synthesis step. Worth its own issue; I can file it.

Production LOC: +220/−11 across four files (image.ts +55/−8, provider-registry.ts +9/−2, image-runtime.ts +8/−1, structured-extraction.ts +148). Tests +347/−3. Docs and manifest +36/−19. The growth is the capability; about 35 lines of structured-extraction.ts mirror Codex's parse/validate and could be shared through the SDK later, which would need a surface-budget decision I am not making here.

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added plugin: logbook Logbook automatic work journal plugin size: M labels Aug 5, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 6, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 6, 2026
@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Adds shared, schema-validated image extraction for providers without their own extraction hook and documents incompatible instruction routes.

Example: Logbook analyzes two screenshots with visionModel set to ollama/qwen2.5vl:7b.

  • Before: The batch fails with “Provider does not support structured extraction: ollama”.
  • After: The supplied gateway trace shows the batch completing and timeline cards being returned.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong production-path evidence supports a coherent feature patch, but unapproved provider-contract expansion caps readiness; reported conflicts remain a landing blocker.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): At ce84581, an isolated Linux gateway processed two synthetic frames through Logbook and the real Ollama plugin stream, emitted the extraction instruction as a system message, and returned completed timeline cards; MiniMax listener logs and OpenRouter batch diagnostics demonstrate route refusal, with Copilot’s authentication limitation disclosed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Logbook users cannot select non-Codex vision providers for structured screenshot extraction.
Reason: Independent reports and working gateway evidence establish value, but automatically deriving extraction support from image capability requires an owner decision.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: current main still lacks shared extraction, this PR contains meaningful proven work, and its same-author issue remains open; provider-contract approval and reported conflicts still block landing.

Priority: P2
Reviewed head: ce8458199cf95c85703fa1c884943e3541a552e1
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should image-capable providers without extractStructured automatically receive shared extraction, relying on installed streams to preserve system instructions, or require explicit provider opt-in?
  • Recommendation: Approve the shared fallback: Allow explicitly selected image providers to use shared extraction through the current dispatch owner, retaining bespoke hooks and known route refusals.
  • Why: The existing hook is optional and unsupported routes currently fail before extraction; the PR explicitly requests this contract expansion, but no recorded owner approval settles it.

Before merge

  • Complete next step - Resolve the reported conflicts while preserving main’s native-hook dispatch and request-resource ownership, then validate and review the resulting candidate.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Low-value test src/media-understanding/structured-extraction.test.ts: Remove or consolidate one of the two no-JSON rejection cases: “reports invalid JSON as a controlled error” and “still reports a reply with no JSON in it as a controlled error” exercise the same delimiter-free failure.
Agent review details

How this fits together

Plugins submit images, supplemental text, instructions, and an optional schema through the media-understanding SDK; provider dispatch returns extracted text and validated JSON for the caller to consume.

flowchart LR
  A[Plugin images and instructions] --> B[Media extraction dispatch]
  B --> C[Provider extraction hook]
  B --> D[Shared image completion]
  D --> E[Instruction route gate]
  E --> F[Configured provider stream]
  F --> G[JSON parsing and validation]
  G --> H[Plugin result]
Loading

Technical review

Best possible solution:

Approve a bounded shared-extraction contract and integrate it at current main’s dispatch boundary while preserving native hooks and lifecycle-owned resources.

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

Current-main source deterministically rejects providers without extractStructured, and the contributor supplies a matching base-versus-head Ollama gateway trace; no target code was executed during this review.

Is this the best way to solve the issue?

Reusing the shared completion runtime is coherent, but the proposed registry hydration must be adapted to main’s intentional dispatch-owned fallback design.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Image prompt placement keeps the original intent (178a314: Restore OpenRouter vision prompts by placing prompt text with the images; the PR preserves ordinary descriptions and refuses only the newly instruction-required extraction route.)
  • Lazy image-runtime boundary keeps the original intent (80441ba: Reduce startup imports by deferring model/provider loading until execution; extraction receives its own lazy binding.)
  • Registry-provided generic hooks changes intended behavior with a stated reason (d154a42: Centralize shared image hooks while preserving merge and explicit-reset behavior; this PR explicitly broadens hydration to extraction rather than silently changing its intent.)
  • Logbook provider guidance changes intended behavior with a stated reason (b6a7898: Document the working Codex-backed setup and privacy boundary; the new guidance explains explicit alternative providers while retaining Codex-only borrowed defaults.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 80441ba adds src/media-understanding/providers/image-runtime.ts:6 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 80441baa1558; files: src/media-understanding/providers/image-runtime.ts)

PR surface

Source +209, Tests +344, Docs +17, Generated 0. Total +570 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 221 12 +209
Tests 4 347 3 +344
Docs 1 35 18 +17
Config 0 0 0 0
Generated 1 2 2 0
Other 0 0 0 0
Total 11 605 35 +570

Review metrics

Metric Value Why it matters
Production versus tests Production +220/-11; tests +347/-3 The growth implements a new extraction capability, instruction-route checks, parsing, and validation while reusing the existing completion runtime.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This expands provider support for an optional plugin and SDK capability without establishing an urgent core-runtime regression.
  • merge-risk: 🚨 compatibility: An existing explicit non-Codex extraction request can begin provider I/O instead of returning the unsupported-capability error, changing the provider-plugin behavior contract.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-17T13:10:55.016Z sha 14897120d0720fecbce412a2816c889b4a980732 :: found issues before merge. :: [P1] Gate fallbacks without authoritative instruction delivery
  • reviewed 2026-09-03T04:33:23.379Z sha f599d32fcba896f54038d4d9f595cb68eee638d0 :: needs real behavior proof before merge. :: [P1] Fail closed for unverified instruction routes
  • reviewed 2026-09-03T12:01:20.077Z sha 734cca44bb9bbba0eb25134f4a61f7dc039c424e :: needs real behavior proof before merge. :: [P1] Verify instruction delivery after selecting the plugin stream
  • reviewed 2026-09-07T01:38:18.974Z sha 66174e369a9f9eedf4bdee34878aeb844f9072a4 :: needs real behavior proof before merge. :: [P2] Keep the directory default inside the shared extractor
  • reviewed 2026-09-07T02:01:01.967Z sha ce84581 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-07T03:49:47.981Z sha ce84581 :: blocked before merge. :: none
  • reviewed 2026-09-07T04:43:34.162Z sha ce84581 :: blocked before merge. :: none
  • reviewed 2026-10-03T05:35:39.260Z sha ce84581 :: blocked before merge. :: none

Reviewed October 17, 2026, 3:58 PM ET / 19:58 UTC (Revision 14).

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 6, 2026
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

After-fix Logbook multi-frame trace

Acceptance criterion 3 asked for a redacted after-fix provider or Logbook
multi-frame trace in isolated proof infrastructure. This is the Logbook one, end
to end, on a real gateway.

Running it is what found the remaining bug, so there is a third commit on
this branch now — details under "Why there is a new commit" below.

Where

A single-purpose OpenClaw gateway, isolated from any production install: its own
volume, its own config, no channels enabled. It runs an image built from
v2026.7.2-beta.7 plus this PR's commits and nothing else — deliberately not
current main, so any behaviour here is attributable to this change rather than
to unrelated upstream drift.

image  ghcr.io/…/openclaw:beta7-extractstructured-0f15c3d
digest sha256:bc23975e720ebbcb7c1474e7c5ed08f9839410290a9840a959bdb8cb7215c320
$ openclaw --version
OpenClaw 2026.7.2-beta.7

Vision model is anthropic/claude-sonnet-5. The Anthropic plugin ships no
bespoke extractStructured — in the built image its media-understanding provider
is a bare re-export:

// dist/extensions/anthropic/media-understanding-provider.js
import { t as anthropicMediaUnderstandingProvider } from "../../media-understanding-provider-D0g85uKl.js";
export { anthropicMediaUnderstandingProvider };

so everything below runs through the generic fallback this PR adds, not through a
provider-owned extractor.

Input

Six real screenshots, 1600×1000 JPEG, 1,060,792 bytes total, 30s apart, one
batch. They were seeded onto the volume rather than screen-captured — no
paired node on this gateway exposes screen.snapshot/logbook.snapshot, so the
frames were written to the frame store directly and the rows the capture path
would have written were inserted. Everything downstream of that — batching,
sampling, prompt build, provider dispatch, transport, parse, validate, card
revision — is untouched shipped code. The capture path is not what this PR
changes; calling that out so the distinction is yours to weigh rather than mine
to gloss.

Before

{
  "pendingFrames": 0,
  "visionModel": "anthropic/claude-sonnet-5",
  "visionModelSource": "config",
  "lastBatch": {
    "id": 1, "day": "2026-08-06", "status": "error",
    "error": "prepared model runtime owner was not committed after replacement for /app"
  }
}

That error is the pre-third-commit state of this same batch, on an image built
from this PR's first two commits. See below.

The run

$ openclaw gateway call logbook.analyze.now --json
{ "started": true }

[10s] {"id":1,"status":"running","error":null,"frame_count":6,"model":"anthropic/claude-sonnet-5"}
[20s] {"id":1,"status":"done",   "error":null,"frame_count":6,"model":"anthropic/claude-sonnet-5"}

Gateway log for that window — two real calls, one for structured extraction of
the six frames, one for card revision:

00:20:51.677 [ws] ⇄ res ✓ logbook.analyze.now 7810ms conn=…
00:20:51.823 [provider-transport-fetch] [model-fetch] start    provider=anthropic api=anthropic-messages model=claude-sonnet-5 method=POST url=https://api.anthropic.com/v1/messages
00:20:54.198 [provider-transport-fetch] [model-fetch] response provider=anthropic api=anthropic-messages model=claude-sonnet-5 status=200 elapsedMs=2373 contentType=text/event-stream
00:21:02.165 [provider-transport-fetch] [model-fetch] start    provider=anthropic api=anthropic-messages model=claude-sonnet-5 method=POST url=https://api.anthropic.com/v1/messages
00:21:03.137 [provider-transport-fetch] [model-fetch] response provider=anthropic api=anthropic-messages model=claude-sonnet-5 status=200 elapsedMs=969  contentType=text/event-stream

One POST for the whole six-image batch. Relevant to the P1 below: on this
route describeImages is atomic — it does not split per image and join, so the
combined result reaches the JSON parser as one document.

Output

Five observations were written. runStructuredExtraction throws rather than
returns if JSON.parse or validateJsonSchemaValue fails against
logbook.observations, so their existence is the assertion. Verbatim:

[obs 1] 09:22:24-09:22:54
GitHub: viewing openclaw/openclaw PR #119773 'fix: Logbook vision analysis fails when the
media provider has no structured-extraction hook' by rodrigo-fonseca-oliveira, on
Conversation tab reading the PR description ('What Problem This Solves', 'Why This Change
Was Made') describing the extractStructured fallback fix.

[obs 2] 09:22:54-09:23:24
GitHub PR #119773: switched to 'Files changed' tab (7 files), reviewing diff of
docs/plugins/logbook.md showing updated documentation about the bundled Codex plugin and
image-capable media provider default routing (lines 33-39 changed).

[obs 3] 09:23:24-09:23:54
GitHub PR #119773: switched to 'Checks' tab (121 checks), inspecting blacksmith.sh
[code]smith check which shows 'skipped 11 hours ago in 0s' and message '[code]smith is not
active on this PR', viewing list of other checks (PR context and evidence, Security
Sensitive Guard, Auto response, Labeler, ClawSweeper Dispatch, Dependency Guard).

[obs 4] 09:23:54-09:24:24
Navigated to OpenClaw Docs site, viewing Capabilities > Plugin guides > Logbook plugin
page, reading sections on 'Before you begin' requirements including
screen.snapshot/logbook.snapshot node, Codex plugin authentication via 'openclaw models
auth login --provider openai', and working default agent model.

[obs 5] 09:24:24-09:24:54
Switched to GitHub repo main page for openclaw/openclaw, viewing root file listing (3416
branches, 344 tags, 76,831 commits) with latest commit by steipete 'fix(channels):
preserve bundled delivery contracts 913b53a · 8 minutes ago', then navigated back to
OpenClaw Docs Reference > CLI commands > Gateway page detailing 'openclaw gateway' command
usage and options.

The second call then revised those into a timeline card, which is what the
Logbook tab renders — logbook.timeline:

{
  "day": "2026-08-06",
  "cards": [{
    "title": "Reviewing PR fix for Logbook vision analysis fallback",
    "summary": "Reviewed openclaw/openclaw PR #119773 fixing Logbook vision analysis when media provider lacks structured-extraction hook, then cross-checked related docs.",
    "category": "review",
    "appPrimary": "github.com",
    "appSecondary": "openclaw.dev",
    "distractions": [],
    "keyframeId": 3
  }],
  "stats": { "trackedMs": 150000, "categories": [{"category":"review","ms":150000}] }
}

The frames happen to be screenshots of this PR, so the extraction is
self-checking: PR number, title, author, tab names, check names, and file counts
are all things you can verify against this page.

Why there is a new commit

The first end-to-end run failed, and not on anything the first two commits
changed:

batch 1  status=error  model=anthropic/claude-sonnet-5  frame_count=6
error: prepared model runtime owner was not committed after replacement for /app

extractStructuredWithModel passes agentDir: params.agentDir ?? ""
(src/media-understanding/runtime.ts). normalizePreparedModelRuntimeInput runs
path.resolve(""), which is process.cwd() — /app here. A long-lived gateway
registers prepared-model-runtime owners only for its configured agent
directories (listConfiguredOwnerInputs → resolveAgentDir(config, agentId)),
so cwd matches none of them, rebindInputToCommittedConfiguredOwner finds zero
candidates, and the call throws before reaching the provider. Logbook never
passes agentDir.

This was invisible until now because structured extraction was Codex-only and
Codex ships its own extractStructured. Routing it onto the shared model runtime
is precisely what made the dispatch depend on a resolvable agent dir, so
supplying one belongs with this change rather than in a follow-up. The sibling
describePreparedImageWithModel already defaults the same way; the new commit
makes structured extraction consistent with it. The trace above is the same batch
re-run on an image carrying it — error → done.

This is the part mocked tests could not have surfaced.

Acceptance criteria

$ node scripts/run-vitest.mjs src/media-understanding/provider-registry.test.ts \
                              src/media-understanding/structured-extraction.test.ts
Test Files  2 passed (2)
     Tests  18 passed (18)

$ node scripts/run-vitest.mjs extensions/logbook/src/service.test.ts
Test Files  1 passed (1)
     Tests  8 passed (8)

Plus src/media-understanding/runtime.test.ts (26 passed), which carries the new
regression for the agent-dir default. Checked both ways: it fails on the previous
line and passes on the new one.

What this does not cover

The P1 on provider-registry.ts:51 is not addressed here. MiniMax splits
multi-image requests and joins them as Image N: text, and nothing above
exercises that route — the trace is an Anthropic route, which is atomic. If the
preferred resolution is gating the fallback on providers whose image executor
returns one structured response for the whole request and leaving MiniMax
explicitly unsupported, say so and I will do that rather than guess between it
and the other two options offered.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 7, 2026
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

P1 addressed — split-response routes excluded from the shared fallback

Three commits since the trace above. The P1 on provider-registry.ts:51 is the
substantive one.

What the guard does

describeImagesWithMinimax (src/media-understanding/image.ts) issues one
request per image and joins the replies as Image N:\n…. That can never be a
single JSON document, so the shared fallback's JSON.parse was always going to
fail on it. Structured extraction now refuses that route before spending a
provider call
, reusing the exact message the dispatcher raised before this
fallback existed:

Provider does not support structured extraction: minimax

So MiniMax is unchanged rather than newly broken — it fails the same way it did
on main, just earlier and with a message that names the real cause instead of
blaming the model's JSON.

One deliberate deviation from the suggested remedy

The review asked to keep MiniMax explicitly unsupported. I scoped the guard to
multi-image requests only instead, because the prefix and the
"describe image N of M" prompt suffix are both gated on images.length > 1 —
a single-image request gets the model's bare text back and parses like any other
provider. Disabling the provider outright would have removed a route that works.

Logbook samples up to 16 frames per analysis call, so Logbook's MiniMax route —
the supported route the finding is actually about — is still refused. If you'd
rather have the blanket version, it's a one-line change; say so.

Where the check lives, and why not in the registry

At call time in runStructuredExtraction, not in hydrateModelBackedMediaProvider.
The predicate needs the model id, and the registry hydrates per provider
before any model is known — a registry-level gate could only block all of
minimax/minimax-portal, which over-blocks for the same reason as above.

Third commit: keeping the lazy chunk lazy

agents/minimax-vlm.ts pulls in the provider HTTP transport, SSRF policy, and
secret normalization. Importing it into structured-extraction.ts — a module
loaded through a facade that exists specifically to keep model/provider code out
until extraction runs — defeats that. The two pure predicates now live in
agents/minimax-vlm.ids.ts, a module with no imports at all, re-exported from
minimax-vlm.ts so all ten existing callers are unchanged. One source of truth,
no duplicated provider-id list.

Verification

Targeted tests, 61 passing across structured-extraction.test.ts,
runtime.test.ts, provider-registry.test.ts, and image.test.ts — the last
included deliberately because it covers the MiniMax VLM routing paths that
exercise the re-export. Three cases are new:

  • multi-image MiniMax refused without the provider being called
  • single-image MiniMax still served
  • multi-image atomic routes untouched

And on the built image, real provider, same six frames as the trace above:

provider/model      : anthropic/claude-sonnet-5
frames              : 6
[model-fetch] start    POST https://api.anthropic.com/v1/messages
[model-fetch] response status=200 elapsedMs=4925
contentType         : json
segments            : 5

One POST for the whole batch, schema-validated against logbook.observations.
That is the atomic contract the finding says the fallback requires, and it
confirms the guard leaves it alone.

Scope note

This round's real-provider verification is at the extraction entry point on the
built image, not through the Logbook plugin end to end. The end-to-end Logbook
trace in my previous comment stands for the extraction path itself; re-running it
on a freshly built image is currently blocked by an unrelated condition in my own
environment — a cold gateway does not have the provider plugins in its
media-understanding registry yet — which reproduces on images with and without
these commits and is being tracked separately on my side. Flagging it rather than
leaving you to infer the difference in evidence between the two comments.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L and removed size: M labels Aug 7, 2026
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from cab30aa to e1de773 Compare August 7, 2026 10:28
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

Security boundary addressed, and rebased onto current main

Three of the review's asks in one pass.

The no-secrets instruction

Correct finding, and the reasoning holds beyond Logbook: a generic path standing
in for a bespoke one should not offer a weaker boundary than the one it replaces.

The instruction now lives in the shared prompt builder, so every provider routed
through the fallback carries it rather than each having to remember:

const NO_SECRETS_INSTRUCTION =
  "Return only the requested extraction. Do not include secrets such as passwords, " +
  "API keys, tokens, or credentials, even when they are visible in the input.";

Wording deliberately mirrors the bundled Codex extractor's own developer
instruction rather than inventing a second phrasing for the same rule.

Two regressions, both asserting on the prompt actually handed to the model
rather than on the constant:

  • instructs the model to withhold secrets, in the request it actually sends
  • keeps the no-secrets instruction in text-mode extraction

The second exists because jsonMode: false takes a different tail through the
prompt builder. A boundary that depends on which branch runs is not a boundary.

Rebased

The branch was 511 commits behind main — it is now current, and the rebase was
clean. Required checks should report against the exact head.

Current state

commit
6f5b4dc5943 default structured extraction to the shared model runtime
de2dd14fc95 run hydrated structured extraction on the provider's own describeImages
776f32c1128 default structured extraction to the configured agent dir
dccbeefaa5d keep split-response image routes out of structured extraction
e5eefd1e305 identify MiniMax routes without importing its transport
e1de7739161 instruct the shared extractor to withhold secrets

49 targeted tests passing across structured-extraction.test.ts,
runtime.test.ts, and provider-registry.test.ts.

On the earlier evidence

The end-to-end Logbook trace stands as posted. The structured-extraction path is
independently re-verified on each rebuilt image by invoking it directly in the
pod against the real provider — most recently six frames, one POST to
api.anthropic.com, HTTP 200, five schema-validated segments.

I have not re-run the full Logbook plugin path since, because my isolated
gateway has a cold-start condition unrelated to this PR: a freshly booted gateway
has not yet loaded provider plugins into its media-understanding registry, so the
dispatcher reports the provider missing before any of this code runs. It
reproduces on images built both before and after these commits, so it is mine to
fix, not this patch's — flagging it so the difference in evidence between my
comments is visible rather than something you have to infer.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Aug 7, 2026
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from e1de773 to 7538674 Compare August 7, 2026 20:40
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

P1 addressed — the requested provider is now resolved by id before hydration

New commits since the reviewed head e1de7739161:

commit
ac661edfef5 fix(media-understanding): resolve the requested provider by id before hydration
75386743621 refactor(media-understanding): drop the unused eager structured-extraction path

Branch rebased onto current main. The PR description has been updated to cover the full series, the production-LOC accounting, and this correction.

The fix

buildMediaUnderstandingRegistry gains an optional requestedProviderId. When the id is absent after the plural capability resolve, it resolves through the existing resolvePluginCapabilityProvider — the same singular by-id path used by the tts, media-generation, talk, image-tool, and embedding registries; media-understanding was the only capability family not calling it — and merges the result through normal hydration, before config-derived synthetic entries so a plugin's own hooks win. The dispatcher forwards the raw caller id; alias normalization stays inside the registry. Regressions: mixed-active-provider (one provider active, the requested one inactive — the exact topology from your finding), alias short-circuit (no resolver call when gemini is satisfied by an active google), plugin hooks beating a models.providers synthetic for the same id, and an unresolvable id still producing the unchanged error.

A correction on my part

My earlier comments called the cold-gateway failure ("Provider does not support structured extraction: anthropic on a fresh boot, same call succeeding hours later") an environment issue on my side and "not this patch's problem". Your finding shows it was this P1 exactly: my gateway sets visionModel = anthropic/claude-sonnet-5 with no tools.media.models entry, so anthropic only reached the registry when its plugin happened to be active. That standing repro is now the after-fix proof:

Deployed an image carrying these commits to the same isolated gateway, restarted it, and invoked analysis 2.5 minutes after boot — squarely inside the window that previously always failed. Boot log confirms the mixed-active topology from your finding (13 plugins up; opencode active as a media provider; anthropic not loaded):

[gateway] http server listening (13 plugins: browser, canvas, device-pair, file-transfer,
  linux-canvas, linux-node, logbook, memory-core, ollama, opencode, talk-voice,
  teams-meetings, zoom-meetings; 0.9s)

Before-state, the standing failure from the previous image:

"lastBatch": { "id": 2, "day": "2026-08-06", "status": "error",
  "error": "Provider does not support structured extraction: anthropic" }

logbook.analyze.now → {"started": true}, then two provider calls where the cold gateway previously threw before any network I/O:

[model-fetch] start provider=anthropic api=anthropic-messages model=claude-sonnet-5 method=POST url=https://api.anthropic.com/v1/messages
[model-fetch] response provider=anthropic ... status=200 elapsedMs=2466
[model-fetch] start provider=anthropic api=anthropic-messages model=claude-sonnet-5 method=POST url=https://api.anthropic.com/v1/messages
[model-fetch] response provider=anthropic ... status=200 elapsedMs=1763

After: batch 2 status: "done", and logbook.timeline returns the synthesized card with schema-validated content — read back from the store, not inferred from status. Same seeded-frame disclosure as the original trace: the six frames were written to the frame store, not screen-captured.

CI

The four red checks on the previous head were mine, both causes now fixed: a 101-char line added by this PR failed oxfmt --check (which also took down check-docs at its format gate before the docs checks ever ran), and the dead-code gate correctly flagged an unused re-export — removed along with the eager wrapper only tests used, making the two new commits net-negative production LOC. Neither failure was pre-existing on main; I verified recent main runs before touching anything.

On running the contributor gates myself: I stood up CI on my own infrastructure for pnpm build && pnpm check && pnpm test because those lanes exceed my hardware. It proved pnpm build, all three typecheck lanes, all pnpm check preflight guards, and formatting green on this head. The sharded type-aware lint lane and the full test suite exceed a 4-core/16GB hosted runner outright, so for those two lanes this repo's PR CI on this head is the proof — stated plainly rather than implied otherwise. Targeted suites for every touched file: 53/53 locally.

The remaining open item is yours to call

The secret-handling boundary ("Decision needed"). Source facts, since the review noted the Codex contract source was unavailable for an equivalence verdict: the Codex route delivers its no-secrets wording as developerInstructions to runBoundedCodexAppServerTurn (extensions/codex/media-understanding-provider.ts:133-134), a dedicated instruction channel; the generic route prepends NO_SECRETS_INSTRUCTION in the shared prompt builder (src/media-understanding/structured-extraction.ts) and delivers it through each provider's describeImages transport, where prompt-role handling is provider-specific. The two are not equivalent, and I have deliberately not invented a portable higher-priority boundary — that is an owner decision. If the call is to gate the fallback or narrow the supported-provider claim until such a boundary exists, I'll scope the docs and help text accordingly in this PR.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from 7538674 to 1489712 Compare August 17, 2026 12:38
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from 1489712 to 93981dc Compare September 3, 2026 04:17
@openclaw-barnacle openclaw-barnacle Bot added extensions: opencode and removed agents Agent runtime and tooling labels Sep 3, 2026
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

P1 addressed — the route gate now fails closed on unverified transports

Head 734cca44bb9, rebased onto 3a5fc8f663d. CI green on the exact head.

The finding was right

system-required refused only routes that shouldPlaceImagePromptInUserContent classifies, and admitted everything else on the assumption that Context.systemPrompt reaches the model as an instruction. Api is an open union (KnownApi | (string & {})), and a plugin can register a provider stream whose egress this repo cannot read, so that default-accept was exactly the hole described: persisted screenshot extraction could run without the boundary the path promises. The review's point that the tests inspected the internal completion context rather than egress also stands.

What changed

The gate is now an allowlist of transports whose adapters in this repo turn systemPrompt into a dedicated instruction field. I read each one before adding it:

Transport Adapter Delivery
openai-completions packages/ai/src/openai-completions-messages.ts:86-92 system/developer role message
openai-responses, azure-openai-responses packages/ai/src/transports/openai-completions-params.ts:299 instructions
openai-chatgpt-responses packages/ai/src/providers/openai-chatgpt-responses.ts:303 instructions
anthropic-messages packages/ai/src/providers/anthropic.ts:1066 system blocks
bedrock-converse-stream packages/ai/src/transports/anthropic-transport-stream.ts:988 system blocks
google-generative-ai, google-vertex packages/ai/src/providers/google-shared.ts:502 systemInstruction
mistral-conversations packages/ai/src/providers/mistral.ts:363 system role message

Anything else — an unknown api, a missing api, or a plugin-supplied transport — is refused before any provider request, with the reason named in the error:

Provider does not accept system instructions for image requests: acme/vision-1 (transport "acme-custom-stream" has no verified system-instruction channel)
Provider does not accept system instructions for image requests: openrouter/… (the prompt is delivered as user content)

That set covers every bundled provider, so the capability is gated rather than re-narrowed toward the Codex-only status quo. Plain describeImage/describeImages are unaffected on every route — only promptDelivery: "system-required" consults the gate. Docs and the visionModel help text now describe the fail-closed rule and list what is refused; image.test.ts adds an unclassified-transport case asserting refusal with no complete and no fetch call.

Rebase note, and a CI finding worth recording

The previous head passed CI, then failed on the next push with requireFirstMockCall is not defined. Cause: main had removed that local helper from image.test.ts in favor of the shared expectDefined fixture, while this branch still called it. The merge was textually clean — GitHub reported no conflict — but the merged result did not compile. Rebased onto current main and adopted the shared helper rather than restoring the deleted one.

Still open, and I am not claiming otherwise

  • Exact-head real-behavior proof is absent. The earlier isolated-gateway Logbook trace predates this completion path and I have not re-run it against this head. My development machine cannot host that run; it needs the isolated gateway the original trace used. This remains the honest gap, and I would rather leave it named than dress up unit-level proof as gateway proof.
  • Two maintainer decisions, per the Decision needed table: whether imagePayloadTransform should be a supported member of the provider-plugin interface (it is an optional additive field on MediaUnderstandingProvider, reached through the deprecated plugin-sdk/media-understanding facade; the alternative is two new callable SDK exports, which is a larger surface change), and whether this fix may carry its production delta.
  • Production LOC is now +335/−26 (net +309) across 10 production files; tests +507/−31; docs +48/−18. The growth is the capability (shared structured extraction), the fail-closed gate, and the declared transform. I can name the tradeoffs but not authorize the growth.
  • Data-model compatibility proof was on the checklist: this PR changes no schema, stored representation, migration, or persisted shape, so I believe there is nothing to prove there. Correct me if that item means something narrower.

@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

Status: the resolution half of this PR is superseded, and I need to correct something I wrote.

#139231 now carries the provider-resolution fix, rewritten by @steipete at the shared catalog owner (capability-provider-runtime.ts) instead of as a consumer-side fallback. That's a better fix than mine — net-negative production lines, and it repairs discovery for the whole media family including audio rather than just the extraction path. I'm not going to re-litigate that half here, whatever happens to that PR.

What remains unfixed either way: deferred providers being discoverable doesn't give them extractStructured. Codex is still the only implementation on main, so a non-Codex visionModel will resolve and then throw Provider does not support structured extraction. Logbook stays effectively single-provider.

Plan. Once #139231 resolves one way or the other, I'll rescope this branch to the structured-extraction capability alone — dropping the resolver, the agentDir default, and most of the surface behind the compatibility and security-boundary labels. It should end up a fraction of the current 17 files. I'm not asking for review meanwhile; it's 1,273 commits behind and conflicting.

The correction. The body and my earlier comment claim the system-instruction allowlist "covers every bundled provider." That's false, and I should have caught it before posting. Ollama declares "api": "ollama", which isn't in KnownApi or the allowlist, so it gets refused. And Google, Bedrock, and Mantle route through plugin createStreamFn rather than the packages/ai adapters I cited as evidence — so that evidence describes a path the gate never confirms was taken.

That points at the defect the P1 was circling. The gate reads a declared transport name at image.ts:579, nine lines before registerProviderStreamForModel resolves the actual stream — and plugin streams take precedence over the transport fallback. So a plugin declaring an allowlisted api passes the gate and can then deliver the instruction however it likes. Fail-open, on exactly the case the gate exists to catch.

The rescoped PR will verify bytes rather than names: compose a core onPayload last, confirm the system instruction is actually present in the outgoing request, fail closed otherwise. That reaches the plugin path the current check can't see, and stops refusing Ollama for having an unfamiliar name.

steipete added a commit that referenced this pull request Sep 6, 2026
…#139231)

Keep enabled audio and structured-extraction providers discoverable after another media plugin loads, and when shared models select only images. Merge eligible manifest owners at the shared catalog; leave execution selection with the runner and preserve active instances, policy filtering, and selected image loading.

Resolve capability metadata only for normalized, deduplicated untagged provider entries. Pair synthetic audio fixtures with their matching runtime/metadata generation to avoid unrelated cold plugin imports.

Verified the final integration with 69 focused tests, formatting/lint/core typecheck, a fresh independent review, a sealed build, 12 audio/extraction Gateway cases, and three paired full-inventory discovery cases. Exact-head CI 34060063771 succeeded (141 successful jobs, 16 skipped). Production delta: -20 lines. Related #119772 remains open; generic extraction fallback #119773 is outside scope.

Thanks to @rodrigo-fonseca-oliveira for the original diagnosis and fix.

Co-authored-by: Rodrigo Oliveira <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from 734cca4 to 66174e3 Compare September 7, 2026 01:31
@rodrigo-fonseca-oliveira rodrigo-fonseca-oliveira changed the title fix: Logbook vision analysis fails when the media provider has no structured-extraction hook feat(media-understanding): shared structured extraction for image-capable providers Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 7, 2026
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from 66174e3 to f3aeaf8 Compare September 7, 2026 01:50
…able providers

Root cause: only the bundled Codex plugin implements `extractStructured`, and
registry hydration never bound one for any other image-capable provider, so
`extractStructuredWithModel` failed with "Provider does not support structured
extraction" for every non-Codex `visionModel` even though those providers
already describe images through the shared model runtime.

Owner: media-understanding registry hydration (`provider-registry.ts`) plus the
shared image runtime (`image.ts`, `image-runtime.ts`), which already own the
describeImage/describeImages defaults.

Canonical fix: hydrate `extractStructured` next to those defaults from a new
lazy `extractStructuredWithImageModel` export. `structured-extraction.ts` runs
one completion through `completeImagesWithModel` with the extraction
instructions (including a no-secrets rule) as the prompt, supplemental text as
`userText` in the user message, and `promptDelivery: "system-required"`. That
flag makes the shared runtime refuse, before any request, exactly the routes on
which it would itself demote the prompt into user content (the GitHub Copilot,
OpenRouter, and Alibaba Model Studio endpoint classes and both MiniMax VLM
branches), because the output is persisted. A plugin stream that demoted
`Context.systemPrompt` would break every agent turn on that provider, so that
boundary stays with the plugin install, not this gate.

The shared extractor defaults an empty `agentDir` to the configured default
agent dir. The dispatcher still passes "" through unchanged, so a bespoke
extractor such as Codex - which uses a non-empty agentDir as its thread cwd
(bounded-turn.ts:125) - sees no change. On the shared path that key selects
prepared-model owners and "" matches none on a long-lived gateway; Logbook
never passes one. Regression: structured-extraction.test.ts.

Replies are parsed strictly first; a fenced or prose-wrapped reply falls back
to the first balanced JSON object or array (normalization-core's
extractBalancedJsonPrefix) so model formatting drift does not fail a whole
batch. A reply with no JSON in it is still a controlled error. Regression:
structured-extraction.test.ts (fenced reply; no-JSON reply).

Removed versus the previous head of this branch:
- the by-id provider resolver in `buildMediaUnderstandingRegistry` and its
  runtime call: superseded on main by openclaw#139231
- the `SYSTEM_INSTRUCTION_TRANSPORTS` allowlist and `api` inspection: an
  unverifiable promise about plugin transports; the gate now records only the
  one decision the runtime owns
- `imagePayloadTransform` and the opencode rewrite: opencode-only and separable

Production LOC: +220/-11 (image.ts +55/-8, provider-registry.ts +9/-2,
image-runtime.ts +8/-1, structured-extraction.ts +148); tests +347/-3; docs
and the Logbook manifest help text shortened to the rule above. The config-doc
baseline hash (docs/.generated/config-baseline.sha256) is regenerated for the
help-text change, as its check instructs.

Sibling coverage: describeImage/describeImages hydration is untouched and Codex
keeps its own `extractStructured` hook (provider-registry.test.ts). The boundary
test in image.test.ts asserts the exact `Context` handed to `complete`, and the
refusal cases assert no stream registration, completion, or fetch.

Proof gap: a live gateway run of Logbook against a non-Codex `visionModel` is
still pending. Local proof: focused Vitest suites (media-understanding,
image-tool provider loading, opencode), oxfmt, oxlint,
`plugin-sdk:surface:check`, and the assertion-safety and coercion guards.

Closes openclaw#119772

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@rodrigo-fonseca-oliveira
rodrigo-fonseca-oliveira force-pushed the rodrfons/lab-94-default-extract-structured-to-model-runtime branch from f3aeaf8 to ce84581 Compare September 7, 2026 01:54
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 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. labels Sep 7, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…openclaw#139231)

Keep enabled audio and structured-extraction providers discoverable after another media plugin loads, and when shared models select only images. Merge eligible manifest owners at the shared catalog; leave execution selection with the runner and preserve active instances, policy filtering, and selected image loading.

Resolve capability metadata only for normalized, deduplicated untagged provider entries. Pair synthetic audio fixtures with their matching runtime/metadata generation to avoid unrelated cold plugin imports.

Verified the final integration with 69 focused tests, formatting/lint/core typecheck, a fresh independent review, a sealed build, 12 audio/extraction Gateway cases, and three paired full-inventory discovery cases. Exact-head CI 34060063771 succeeded (141 successful jobs, 16 skipped). Production delta: -20 lines. Related openclaw#119772 remains open; generic extraction fallback openclaw#119773 is outside scope.

Thanks to @rodrigo-fonseca-oliveira for the original diagnosis and fix.

Co-authored-by: Rodrigo Oliveira <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
@rodrigo-fonseca-oliveira

Copy link
Copy Markdown
Contributor Author

Complete diagnostics for the real-behavior proof in the body (head ce8458199cf95c85703fa1c884943e3541a552e1), since the review noted my hand-selected lines omitted them. Redacted only for hostnames, private IPs, home paths, and tokens; nothing else is trimmed from the small logs. Raw, unredacted evidence (43 files) is retained offline and available to a maintainer on request.

1. Ollama proxy log — complete. Logging pass-through at 127.0.0.1:19002 → 11434; the Ollama service itself was never touched. The first POST /api/chat (87,752 bytes) is the extraction request: messages[0].role='system' carries STRUCTURED_EXTRACTION_INSTRUCTIONS, the two seeded images ride in the user message. The two later, smaller calls are Logbook's card synthesis on the agent default model, which sends role='user' — a clean contrast.

2026-09-06T23:26:29.269747-04:00 PROXY-START listen=19002 upstream=11434
2026-09-06T23:26:31.243875-04:00 GET /api/tags bytes=0
2026-09-06T23:26:31.246731-04:00   -> upstream 200, 6724 bytes
2026-09-06T23:26:52.030775-04:00 POST /api/chat bytes=87752
2026-09-06T23:26:52.031000-04:00   model='qwen2.5vl:7b' stream=True
  messages[0].role='system' text[:220]="You are OpenClaw's bounded structured-extraction worker. Return only the requested extraction. Do not include secrets such as passwords, API keys, tokens, or credentials, even when they are visible in the input. These ar"
  messages[1].role='user' images=2 text[:220]=''
2026-09-06T23:27:02.244502-04:00   -> upstream 200, 14946 bytes
2026-09-06T23:27:02.268297-04:00 POST /api/chat bytes=3550
2026-09-06T23:27:02.268415-04:00   model='qwen2.5vl:7b' stream=True
  messages[0].role='user' text[:220]="You are synthesizing a user's screen activity log into timeline cards. Each card is one coherent activity. CORE PRINCIPLE: Each card = one main thing the user did. Time is a constraint (10-60 min per card), not a goal. S"
2026-09-06T23:27:11.034479-04:00   -> upstream 200, 39448 bytes
2026-09-06T23:27:11.058985-04:00 POST /api/chat bytes=5034
2026-09-06T23:27:11.059153-04:00   model='qwen2.5vl:7b' stream=True
  messages[0].role='user' text[:220]="You are synthesizing a user's screen activity log into timeline cards. Each card is one coherent activity. CORE PRINCIPLE: Each card = one main thing the user did. Time is a constraint (10-60 min per card), not a goal. S"
  messages[1].role='assistant' text[:220]='[ { "startTime": "23:00:00", "endTime": "23:01:00", "category": "coding", "title": "Drafting release notes", "summary": "Drafting release notes for media", "detailedSummary": "Added a short paragraph about how the extrac'
  messages[2].role='user' text[:220]='The previous JSON output failed validation: Time 23:07-23:09 from the previous timeline is not covered; do not drop existing cards or observed time. Return the FULL corrected JSON array (not a diff). Same coverage, no ga'
2026-09-06T23:27:22.215576-04:00   -> upstream 200, 51959 bytes

2. MiniMax refusal — listener log, complete. Provider baseUrl pointed at 127.0.0.1:19001. The trigger fired at 23:20:56; the only connection ever recorded is the pre-trigger curl self-test proving the listener works. Zero connections after the trigger.

2026-09-06T23:20:39.345867-04:00 LISTENER-START port=19001
2026-09-06T23:20:41.370831-04:00 CONNECT from ('<ip>', 52706)
2026-09-06T23:20:41.370957-04:00   first-bytes b'GET /listener-self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'

3. OpenRouter aimed at the local listener — complete, included for honesty. This is the attempt that showed the OpenRouter class is classified from baseUrl (resolveProviderRequestCapabilities), so a 127.0.0.1 base URL classifies as neither OpenRouter nor Model Studio and the gate does not fire: the request went out, with the dummy key. The OpenRouter refusal was then proven against the real host — batch 3 in the gateway lines below, terminal in 5s, where a key that reached OpenRouter would have produced a 401 instead of the refusal text.

2026-09-06T23:18:14.096538-04:00 LISTENER-START port=19001
2026-09-06T23:18:16.102120-04:00 CONNECT from ('<ip>', 38004)
2026-09-06T23:18:16.102328-04:00   first-bytes b'GET /listener-self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'
2026-09-06T23:18:44.836372-04:00 CONNECT from ('<ip>', 49378)
2026-09-06T23:18:44.838359-04:00   first-bytes b'POST /chat/completions HTTP/1.1\r\nhost: <ip>:19001\r\nconnection: keep-alive\r\naccept: application/json\r\nauthorization: Bearer <redacted>\r\ncontent-type: application/json\r\nuser-agent: OpenAI/JS 7.8.0\r\nx-stainless-arch: x64\r\nx-stainless-lang: js\r\nx-stainless-os: Linux\r\nx-stainless-package-version: 7.8.0\r\nx-stainless-retry-count: 0\r\nx-stainless-runtime: node\r\nx-stainless-runtime-version: v24.19.0\r\nx-stainless-timeout: 180\r\naccept-language: *\r\nsec-fetch-mode: cors\r\naccept-encoding: gzip, deflate\r\ncon'
4. Gateway log — every batch transition, refusal, and plugin load, all cases in order
##### gateway-caseA2.log
2026-09-07T03:26:48 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:26:49 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:26:51 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:26:51 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:26:52 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-caseA-attempt1.log
2026-09-07T03:21:28 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:21:28 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:21:28 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:21:37 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:21:37 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:21:37 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:23:01 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:23:01 logbook: batch 1 failed: Copilot authentication failed: HTTP 401
##### gateway-caseA.log
2026-09-07T03:24:28 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:24:28 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:24:37 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:24:37 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:24:37 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-caseB.log
2026-09-07T03:35:12 [plugins] loading ollama from ~/proof-119773/base/dist/extensions/ollama/index.js
2026-09-07T03:35:12 [plugins] loading ollama from ~/proof-119773/base/dist/extensions/ollama/index.js
2026-09-07T03:35:16 [plugins] loading minimax from ~/proof-119773/base/dist/extensions/minimax/index.js
2026-09-07T03:35:16 [plugins] loading openrouter from ~/proof-119773/base/dist/extensions/openrouter/index.js
2026-09-07T03:35:16 logbook: batch 3 failed: Provider does not support structured extraction: ollama
2026-09-07T03:35:16 logbook: batch 4 failed: Provider does not support structured extraction: ollama
2026-09-07T03:35:41 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:35:41 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:35:47 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:35:47 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:35:47 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-caseR2.log
2026-09-07T03:31:03 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:31:03 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:31:03 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:31:07 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:31:07 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:31:07 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:31:07 logbook: batch 3 failed: Provider does not accept system instructions for image requests: openrouter/qwen/qwen2.5-vl-7b-instruct (the prompt is delivered as user content)
##### gateway-caseR-copilot.log
2026-09-07T03:07:49 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:07:49 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:07:49 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:10:35 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:10:35 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:10:35 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:11:35 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:11:35 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:11:35 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:11:36 logbook: batch 1 failed: Copilot authentication failed: HTTP 401
##### gateway-caseR.log
2026-09-07T03:20:48 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:20:48 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:20:48 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:21:01 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:21:01 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:21:01 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:21:01 logbook: batch 1 failed: Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)
##### gateway-caseR-openrouter-local.log
2026-09-07T03:18:29 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:18:29 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-07T03:18:29 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-07T03:18:44 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-07T03:18:44 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:18:44 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-07T03:18:44 logbook: batch 1 failed: Image model failed (openrouter/qwen/qwen2.5-vl-7b-instruct): "listener"
##### gateway-stdout-caseA-ollama2.log
2026-09-06T23:24:28.138-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:24:28.227-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:24:37.586-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:24:37.596-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:24:37.620-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-stdout-caseA-ollama.log
2026-09-06T23:21:28.292-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:21:28.372-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:21:28.386-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:21:37.667-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:21:37.676-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:21:37.699-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:23:01.618-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:23:01.982-04:00 [plugins] logbook: batch 1 failed: Copilot authentication failed: HTTP 401
##### gateway-stdout-caseA-proxy.log
2026-09-06T23:26:48.917-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:26:49.009-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:26:51.976-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:26:51.989-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:26:52.009-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-stdout-caseB-after-pr.log
2026-09-06T23:35:41.628-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:35:41.715-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:35:47.231-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:35:47.241-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:35:47.260-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-stdout-caseB-base.log
2026-09-06T23:35:12.268-04:00 [plugins] loading ollama from ~/proof-119773/base/dist/extensions/ollama/index.js
2026-09-06T23:35:12.417-04:00 [plugins] loading ollama from ~/proof-119773/base/dist/extensions/ollama/index.js
2026-09-06T23:35:16.511-04:00 [plugins] loading minimax from ~/proof-119773/base/dist/extensions/minimax/index.js
2026-09-06T23:35:16.522-04:00 [plugins] loading openrouter from ~/proof-119773/base/dist/extensions/openrouter/index.js
2026-09-06T23:35:16.532-04:00 [plugins] logbook: batch 3 failed: Provider does not support structured extraction: ollama
2026-09-06T23:35:16.533-04:00 [plugins] logbook: batch 4 failed: Provider does not support structured extraction: ollama
##### gateway-stdout-caseR-copilot.log
2026-09-06T23:10:35.474-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:10:35.587-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:10:35.596-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:11:35.891-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:11:35.901-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:11:35.926-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:11:36.287-04:00 [plugins] logbook: batch 1 failed: Copilot authentication failed: HTTP 401
##### gateway-stdout-caseR-minimax.log
2026-09-06T23:20:48.210-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:20:48.292-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:20:48.300-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:21:01.935-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:21:01.946-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:21:01.971-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:21:01.987-04:00 [plugins] logbook: batch 1 failed: Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)
##### gateway-stdout-caseR-openrouter.log
2026-09-06T23:18:29.048-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:18:29.148-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:18:29.156-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:18:44.768-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:18:44.779-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:18:44.808-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:18:44.854-04:00 [plugins] logbook: batch 1 failed: Image model failed (openrouter/qwen/qwen2.5-vl-7b-instruct): "listener"
##### gateway-stdout-caseR-openrouter-real.log
2026-09-06T23:31:03.423-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:31:03.532-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:31:03.543-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:31:07.474-04:00 [plugins] loading minimax from ~/proof-119773/pr/dist/extensions/minimax/index.js
2026-09-06T23:31:07.486-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:31:07.513-04:00 [plugins] loading openrouter from ~/proof-119773/pr/dist/extensions/openrouter/index.js
2026-09-06T23:31:07.526-04:00 [plugins] logbook: batch 3 failed: Provider does not accept system instructions for image requests: openrouter/qwen/qwen2.5-vl-7b-instruct (the prompt is delivered as use
##### gateway-stdout-schema-init2.log
2026-09-06T23:07:49.096-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
2026-09-06T23:07:49.210-04:00 [plugins] loading github-copilot from ~/proof-119773/pr/dist/extensions/github-copilot/index.js
2026-09-06T23:07:49.220-04:00 [plugins] loading ollama from ~/proof-119773/pr/dist/extensions/ollama/index.js
##### gateway-stdout-schema-init.log
5. RPC captures — logbook.status / logbook.timeline before and after each trigger
##### caseA-ollama-attempt1.txt
===== CASE A : accepted route completes (Ollama plugin stream) =====
host time: 2026-09-06T23:21:32-04:00
visionModel: ollama/qwen2.5vl:7b   baseUrl: http://<ip>:11434

--- $ openclaw gateway call logbook.status   [BEFORE trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)"
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}

--- $ openclaw gateway call logbook.analyze.now ---
# trigger at 2026-09-06T23:21:34-04:00
{
  "started": true
}

--- polling logbook.status until lastBatch.status is terminal ---
[poll 1 2026-09-06T23:21:39-04:00] lastBatch.status=running
[poll 2 2026-09-06T23:21:48-04:00] lastBatch.status=running
[poll 3 2026-09-06T23:21:55-04:00] lastBatch.status=running
[poll 4 2026-09-06T23:22:02-04:00] lastBatch.status=running
[poll 5 2026-09-06T23:22:09-04:00] lastBatch.status=running
[poll 6 2026-09-06T23:22:16-04:00] lastBatch.status=running
[poll 7 2026-09-06T23:22:23-04:00] lastBatch.status=running
[poll 8 2026-09-06T23:22:30-04:00] lastBatch.status=running
[poll 9 2026-09-06T23:22:37-04:00] lastBatch.status=running
[poll 10 2026-09-06T23:22:44-04:00] lastBatch.status=running
[poll 11 2026-09-06T23:22:51-04:00] lastBatch.status=running
[poll 12 2026-09-06T23:22:58-04:00] lastBatch.status=running
[poll 13 2026-09-06T23:23:06-04:00] lastBatch.status=error

--- $ openclaw gateway call logbook.status   [AFTER trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Copilot authentication failed: HTTP 401"
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}
##### caseA-ollama.txt
===== CASE A : accepted route completes (Ollama plugin stream) =====
host time: 2026-09-06T23:24:33-04:00
visionModel: ollama/qwen2.5vl:7b   baseUrl: http://<ip>:11434

--- $ openclaw gateway call logbook.status   [BEFORE trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Copilot authentication failed: HTTP 401"
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}

--- $ openclaw gateway call logbook.analyze.now ---
# trigger at 2026-09-06T23:24:35-04:00
{
  "started": true
}

--- polling logbook.status until lastBatch.status is terminal ---
[poll 1 2026-09-06T23:24:39-04:00] lastBatch.status=running
[poll 2 2026-09-06T23:24:46-04:00] lastBatch.status=running
[poll 3 2026-09-06T23:24:53-04:00] lastBatch.status=done

--- $ openclaw gateway call logbook.status   [AFTER trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "done",
    "endMs": 1788750180139
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 2,
  "timeZone": "America/Toronto"
}

--- $ openclaw gateway call logbook.timeline ---
{
  "day": "2026-09-06",
  "cards": [
    {
      "id": 1,
      "day": "2026-09-06",
      "startMs": 1788750000000,
      "endMs": 1788750060000,
      "title": "Drafting release notes",
      "summary": "Drafting release notes for media",
      "detail": "Added a short paragraph about how the extraction prompt travels in the system channel",
      "category": "coding",
      "appPrimary": "media",
      "appSecondary": "terminal",
      "distractions": [
        {
          "startMs": 1788750000000,
          "endMs": 1788750060000,
          "title": "Re-read runtime dispatcher"
        }
      ],
      "keyframeId": 1
    },
    {
      "id": 2,
      "day": "2026-09-06",
      "startMs": 1788750060000,
      "endMs": 1788750180000,
      "title": "Re-read runtime dispatcher",
      "summary": "Re-read runtime dispatcher",
      "detail": "",
      "category": "coding",
      "appPrimary": "media",
      "appSecondary": "terminal",
      "distractions": [],
      "keyframeId": 2
    }
  ],
  "stats": {
    "trackedMs": 180000,
    "distractionMs": 60000,
    "categories": [
      {
        "category": "coding",
        "ms": 180000
      }
    ],
    "apps": [
      {
        "domain": "media",
        "ms": 180000
      }
    ]
  }
}
##### caseA-proxy.txt
===== CASE A (supplement) : prompt travels in the system channel =====
host time: 2026-09-06T23:26:50-04:00
ollama baseUrl -> http://<ip>:19002 (logging proxy) -> <ip>:11434

--- $ openclaw gateway call logbook.analyze.now  (frames 3+4 -> new batch) ---
# trigger at 2026-09-06T23:26:50-04:00
{
  "started": true
}
[poll 1 2026-09-06T23:26:53-04:00] lastBatch.status=running
[poll 2 2026-09-06T23:27:00-04:00] lastBatch.status=running
[poll 3 2026-09-06T23:27:07-04:00] lastBatch.status=running
[poll 4 2026-09-06T23:27:14-04:00] lastBatch.status=running
[poll 5 2026-09-06T23:27:22-04:00] lastBatch.status=running
[poll 6 2026-09-06T23:27:28-04:00] lastBatch.status=done

--- logbook.status [AFTER] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 2,
    "day": "2026-09-06",
    "status": "done",
    "endMs": 1788750540139
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 3,
  "timeZone": "America/Toronto"
}
##### caseB-base.txt
===== CASE B : BEFORE (base commit dd3faf5f, the PR base) =====
host time: 2026-09-06T23:35:14-04:00
checkout: ~/proof-119773/base @ dd3faf5f4749e124286888135375f7a23a67e7c5  (OpenClaw 2026.9.2 (dd3faf5))
same state dir, same seeded synthetic frames, visionModel: ollama/qwen2.5vl:7b

# trigger at 2026-09-06T23:35:14-04:00
{
  "started": true
}
[poll 1 2026-09-06T23:35:18-04:00] lastBatch.status=error

--- logbook.status [AFTER] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 4,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788751260139,
    "error": "Provider does not support structured extraction: ollama"
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 3,
  "timeZone": "America/Toronto"
}

===== AFTER : same batch id 4, same frames, PR checkout ce845819 =====
checkout: ~/proof-119773/pr @ ce8458199cf95c85703fa1c884943e3541a552e1
host time: 2026-09-06T23:35:44-04:00
# analyze.now resets error batches, so batch 4 is retried on the same frames
# trigger at 2026-09-06T23:35:44-04:00
{
  "started": true
}
[poll 1 2026-09-06T23:35:49-04:00] lastBatch.status=pending
[poll 2 2026-09-06T23:35:56-04:00] lastBatch.status=pending
[poll 3 2026-09-06T23:36:03-04:00] lastBatch.status=pending
[poll 4 2026-09-06T23:36:10-04:00] lastBatch.status=pending
[poll 5 2026-09-06T23:36:17-04:00] lastBatch.status=running
[poll 6 2026-09-06T23:36:24-04:00] lastBatch.status=running
[poll 7 2026-09-06T23:36:31-04:00] lastBatch.status=running
[poll 8 2026-09-06T23:36:38-04:00] lastBatch.status=running
[poll 9 2026-09-06T23:36:46-04:00] lastBatch.status=done

--- logbook.status [AFTER] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 4,
    "day": "2026-09-06",
    "status": "done",
    "endMs": 1788751260139
  },
  "visionModel": "ollama/qwen2.5vl:7b",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 1,
  "timeZone": "America/Toronto"
}
##### caseR-copilot-status.txt
===== CASE R : refusal before extraction I/O (github-copilot route) =====
host time: 2026-09-06T23:15:48-04:00

--- listener log BEFORE trigger ---
2026-09-06T23:10:11.291987-04:00 LISTENER-START port=19001
2026-09-06T23:10:13.322569-04:00 CONNECT from ('<ip>', 50672)
2026-09-06T23:10:13.322694-04:00   first-bytes b'GET /self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'

--- $ openclaw gateway call logbook.status  (BEFORE trigger) ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Copilot authentication failed: HTTP 401"
  },
  "visionModel": "github-copilot/gpt-5.6-luna",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}
##### caseR-minimax.txt
===== CASE R : refusal before extraction I/O (MiniMax VLM route) =====
host time: 2026-09-06T23:20:54-04:00
visionModel: minimax/MiniMax-VL-01   provider baseUrl: http://<ip>:19001 (local connection listener)

--- $ openclaw gateway call logbook.status   [BEFORE trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Image model failed (openrouter/qwen/qwen2.5-vl-7b-instruct): \"listener\""
  },
  "visionModel": "minimax/MiniMax-VL-01",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}

--- listener log [BEFORE trigger] ---
2026-09-06T23:20:39.345867-04:00 LISTENER-START port=19001
2026-09-06T23:20:41.370831-04:00 CONNECT from ('<ip>', 52706)
2026-09-06T23:20:41.370957-04:00   first-bytes b'GET /listener-self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'

--- $ openclaw gateway call logbook.analyze.now ---
# trigger at 2026-09-06T23:20:56-04:00
{
  "started": true
}

--- polling logbook.status until lastBatch.status is terminal ---
[poll 1 2026-09-06T23:21:04-04:00] lastBatch.status=error

--- $ openclaw gateway call logbook.status   [AFTER trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)"
  },
  "visionModel": "minimax/MiniMax-VL-01",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}

--- listener log [AFTER trigger] : any CONNECT after the trigger = extraction I/O ---
2026-09-06T23:20:39.345867-04:00 LISTENER-START port=19001
2026-09-06T23:20:41.370831-04:00 CONNECT from ('<ip>', 52706)
2026-09-06T23:20:41.370957-04:00   first-bytes b'GET /listener-self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'
"message":"logbook: batch 1 failed: Provider does not accept system instructions for image requests: minimax/MiniMax-VL-01 (the prompt is delivered as user content)"
##### caseR-openrouter-real.txt
===== CASE R (second class) : OpenRouter endpoint class, real host =====
host time: 2026-09-06T23:31:04-04:00
visionModel: openrouter/qwen/qwen2.5-vl-7b-instruct   baseUrl: https://openrouter.ai/api/v1   apiKey: dummy

# trigger at 2026-09-06T23:31:04-04:00
{
  "started": true
}
[poll 1 2026-09-06T23:31:09-04:00] lastBatch.status=error

--- logbook.status [AFTER] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 3,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750900139,
    "error": "Provider does not accept system instructions for image requests: openrouter/qwen/qwen2.5-vl-7b-instruct (the prompt is delivered as user content)"
  },
  "visionModel": "openrouter/qwen/qwen2.5-vl-7b-instruct",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 3,
  "timeZone": "America/Toronto"
}
##### caseR-openrouter.txt
===== CASE R : refusal before extraction I/O (OpenRouter route) =====
host time: 2026-09-06T23:18:40-04:00
visionModel: openrouter/qwen/qwen2.5-vl-7b-instruct   baseUrl: http://<ip>:19001 (local connection listener)

--- $ openclaw gateway call logbook.status   [BEFORE trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Copilot authentication failed: HTTP 401"
  },
  "visionModel": "openrouter/qwen/qwen2.5-vl-7b-instruct",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}

--- listener log [BEFORE trigger] ---
2026-09-06T23:18:14.096538-04:00 LISTENER-START port=19001
2026-09-06T23:18:16.102120-04:00 CONNECT from ('<ip>', 38004)
2026-09-06T23:18:16.102328-04:00   first-bytes b'GET /listener-self-test HTTP/1.1\r\nHost: <ip>:19001\r\nUser-Agent: curl/7.81.0\r\nAccept: */*\r\n\r\n'

--- $ openclaw gateway call logbook.analyze.now ---
# trigger at 2026-09-06T23:18:42-04:00
{
  "started": true
}

--- polling logbook.status until lastBatch.status is terminal ---
[poll 1 2026-09-06T23:18:46-04:00] lastBatch.status=error

--- $ openclaw gateway call logbook.status   [AFTER trigger] ---
{
  "captureEnabled": false,
  "capturePaused": false,
  "captureIntervalSeconds": 30,
  "analysisIntervalMinutes": 3,
  "retentionDays": 14,
  "pendingFrames": 0,
  "analysisRunning": false,
  "lastBatch": {
    "id": 1,
    "day": "2026-09-06",
    "status": "error",
    "endMs": 1788750180139,
    "error": "Image model failed (openrouter/qwen/qwen2.5-vl-7b-instruct): \"listener\""
  },
  "visionModel": "openrouter/qwen/qwen2.5-vl-7b-instruct",
  "visionModelSource": "config",
  "today": "2026-09-06",
  "todayCards": 0,
  "timeZone": "America/Toronto"
}
6. Gateway configs used (tokens and keys redacted)
##### config-A.redacted.json
{
  "logging": {
    "level": "debug",
    "file": "~/proof-119773/evidence/gateway-A.log"
  },
  "agents": {
    "defaults": {
      "model": "ollama/qwen2.5vl:7b"
    }
  },
  "gateway": {
    "mode": "local",
    "port": 18999,
    "auth": {
      "mode": "token",
      "token": "<redacted>"
    }
  },
  "models": {
    "providers": {
      "ollama": {
        "baseUrl": "http://<ip>:11434",
        "api": "ollama",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "qwen2.5vl:7b",
            "name": "Proof Ollama Vision (qwen2.5vl:7b)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      }
    }
  },
  "plugins": {
    "entries": {
      "logbook": {
        "enabled": true,
        "config": {
          "captureEnabled": false,
          "analysisIntervalMinutes": 3,
          "visionModel": "ollama/qwen2.5vl:7b"
        }
      }
    }
  }
}
##### config-R-minimax.redacted.json
{
  "logging": {
    "level": "debug",
    "file": "~/proof-119773/evidence/gateway-R-minimax.log"
  },
  "gateway": {
    "mode": "local",
    "port": 18999,
    "auth": {
      "mode": "token",
      "token": "<redacted>"
    }
  },
  "models": {
    "providers": {
      "github-copilot": {
        "baseUrl": "http://<ip>:19001",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "gpt-5.6-luna",
            "name": "Proof Copilot Vision",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 128000,
            "maxTokens": 4000
          }
        ]
      },
      "openrouter": {
        "baseUrl": "http://<ip>:19001",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "qwen/qwen2.5-vl-7b-instruct",
            "name": "Proof OpenRouter Vision",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      },
      "minimax": {
        "baseUrl": "http://<ip>:19001",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "MiniMax-VL-01",
            "name": "Proof MiniMax VLM",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      },
      "ollama": {
        "baseUrl": "http://<ip>:11434",
        "api": "ollama",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "qwen2.5vl:7b",
            "name": "Proof Ollama Vision (qwen2.5vl:7b)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      }
    }
  },
  "plugins": {
    "entries": {
      "logbook": {
        "enabled": true,
        "config": {
          "captureEnabled": false,
          "analysisIntervalMinutes": 3,
          "visionModel": "minimax/MiniMax-VL-01"
        }
      }
    }
  }
}
##### config-R-openrouter-real.redacted.json
{
  "logging": {
    "level": "debug",
    "file": "~/proof-119773/evidence/gateway-R-openrouter-real.log"
  },
  "gateway": {
    "mode": "local",
    "port": 18999,
    "auth": {
      "mode": "token",
      "token": "<redacted>"
    }
  },
  "models": {
    "providers": {
      "github-copilot": {
        "baseUrl": "http://<ip>:19001",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "gpt-5.6-luna",
            "name": "Proof Copilot Vision",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 128000,
            "maxTokens": 4000
          }
        ]
      },
      "openrouter": {
        "baseUrl": "https://openrouter.ai/api/v1",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen/qwen2.5-vl-7b-instruct",
            "name": "Proof OpenRouter Vision",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      },
      "minimax": {
        "baseUrl": "http://<ip>:19001",
        "apiKey": "dummy-not-a-real-key",
        "api": "openai-completions",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "MiniMax-VL-01",
            "name": "Proof MiniMax VLM",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      },
      "ollama": {
        "baseUrl": "http://<ip>:11434",
        "api": "ollama",
        "request": {
          "allowPrivateNetwork": true
        },
        "models": [
          {
            "id": "qwen2.5vl:7b",
            "name": "Proof Ollama Vision (qwen2.5vl:7b)",
            "reasoning": false,
            "input": [
              "text",
              "image"
            ],
            "cost": {
              "input": 0,
              "output": 0
            },
            "contextWindow": 32768,
            "maxTokens": 4000
          }
        ]
      }
    }
  },
  "plugins": {
    "entries": {
      "logbook": {
        "enabled": true,
        "config": {
          "captureEnabled": false,
          "analysisIntervalMinutes": 3,
          "visionModel": "openrouter/qwen/qwen2.5-vl-7b-instruct"
        }
      }
    }
  }
}

@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. 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 17, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing older pull requests that have gone stale against current main.

The provider-resolution half of this work landed in #139231, and the remaining shared-extraction branch has had no commits since early September while waiting on the author. Please open a fresh PR against current main if you still want to pursue it.

@steipete steipete closed this Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: logbook Logbook automatic work journal plugin proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Logbook vision analysis fails on every batch because structured extraction has no fallback to the generic model runtime

2 participants