Skip to content

fix(coordinator): account for native MiMo media prompt work - #1286

Merged
Gajesh2007 merged 2 commits into
masterfrom
codex/mimo-media-accounting
Sep 30, 2026
Merged

Gajesh2007 merged 2 commits into
masterfrom
codex/mimo-media-accounting

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Replace legacy flat media costs for concrete native MiMo requests with bounded metadata estimates from the exact verified processor configuration. This is the coordinator accounting half of the deadline investigation; provider/SDK rate calibration is separate in #1285 and Layr-Labs/mlx-swift-lm#208.

  • Provision the optional immutable MiMo processor profile from SHA-256-verified config.json in the existing background artifact cache. Recheck the active model artifact before and after accounting.
  • Inspect JPEG/PNG/GIF headers, ordinary MP4/MOV sample tables, and PCM WAV metadata. Mirror native spatial/temporal rounding, video sampling, audio patch counts and wrappers. Skip compressed frame payloads with bounded base64 random-access reads.
  • Limit optional accounting to eight non-queuing operations, 100 ms per request, 64 media parts, bounded metadata bytes/atoms, and a 64 MiB encoded-media ceiling. Unavailable/unsupported cases retain the existing heuristic.
  • Keep remote fetching behind existing quota/balance/catalog gates. Recount after inlining, charge any additional input-token quota, and use the existing balance top-up. Correct the deadline token term from the original receive instant; retries do not restart it. A temporary accounting failure preserves prior evidence.
  • Keep alias/fallback traffic on its existing estimate until candidate-specific accounting is implemented. These are heuristic prompt counts, not exact tokenizer/cache certificates.

Evidence

Recent production traces had 309 estimated versus 1,095 prepared tokens and 1,511 versus 3,604 prepared tokens. Under the separately authorized temporary SLA, 11/11 requests completed HTTP 200, including four media requests. One 256 GiB provider predicted 26.07 seconds of target prefill but measured 4.85 seconds; that rate issue is not claimed fixed by this PR.

The local operator-owned OpenRouter fixtures now estimate 1,082 and 282 image tokens, and 3,590 and 4,032 video tokens. These include media wrappers/timestamp/audio estimates and exclude surrounding text/template tokens. Fixture bytes are not committed.

Before

flowchart LR
  A["Image / video request"] --> B["request_introspection: flat 300 / 1500 tokens"]
  B --> C["Quota, reservation and short deadline"]
  C --> D["Provider expands real media"]
  D --> E["More prompt work than coordinator estimated"]
  E --> F["Possible deadline refusal and HTTP 429"]
  classDef input fill:#dbeafe,stroke:#2563eb,color:#111827
  classDef code fill:#ede9fe,stroke:#7c3aed,color:#111827
  classDef outcome fill:#fee2e2,stroke:#dc2626,color:#111827
  class A input
  class B,C,D code
  class E,F outcome
Loading

After

flowchart LR
  A["Provisioner: verified processor config"] --> B["mediaPromptTokens / mediawork"]
  C["Inline media metadata"] --> B
  R["Remote URL"] --> G["Existing quota and balance gates"] --> H["Fetch and inline"] --> B
  B --> D["Processor-aware heuristic count"]
  D --> E["Reconcile input quota and original-arrival deadline"]
  E --> F["Provider retains actual memory / deadline enforcement"]
  B --> U["Unknown or busy: retain fallback / prior evidence"]
  classDef input fill:#dbeafe,stroke:#2563eb,color:#111827
  classDef code fill:#ede9fe,stroke:#7c3aed,color:#111827
  classDef outcome fill:#dcfce7,stroke:#16a34a,color:#111827
  class A,C,R input
  class B,D,E,G,H code
  class F,U outcome
Loading

Validation

  • go build ./coordinator/... — passed.
  • go test ./coordinator/mediawork — passed.
  • go test -race ./coordinator/mediawork ./coordinator/promptcontract -run 'Test(NativeMedia|Encoded|Provisioner)' -count=1 — passed.
  • go test -race ./coordinator/api -run 'Test(NativeMedia|ResolveRemoteMedia|MediaFetch|BillingEstimate|DetectMediaRequirement|FirstContentSLA)' -count=1 — passed.
  • go test ./coordinator/mediawork -run '^$' -fuzz FuzzNativeMediaMetadata -fuzztime=10s -parallel=2 — passed, 567,711 executions.
  • Operator-owned fixture run TestNativeMediaCapturedFixtures — all four passed; optional DARKBLOOM_TEST_MEDIA_FIXTURES points to local files. Repeated against the actual published config.json (SHA-256 35b6e3d4543b65e6fa9d6174e2260d9ac1d3ea1e5acb9955d9fe9f2b815d13d4, matched to the live manifest); all four counts agree.
  • make docs-impact-check BASE=origin/master — passed.
  • make docs-check — passed, 324 files.
  • git diff --check — passed.

Limits / rollout

No production changes, provider release, version bump, database schema or new environment setting in this PR. Ordinary nonfragmented MP4/MOV and the listed image/WAV formats are covered; unknown formats retain fallback. Metadata accounting does not certify decoder acceptance or replace native memory checks. Timestamp text uses a byte upper estimate, and ordinary text/template counts remain heuristic. No media bytes, dimensions, URLs or prompt content are added to telemetry. The next deployment remains held pending review and the related fixes.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 30, 2026 9:09pm UTC
d-inference-console-ui-dev Ready Ready Preview Sep 30, 2026 9:09pm UTC
d-inference-landing Ready Ready Preview Sep 30, 2026 9:09pm UTC
eigen-homepages-darkbloom Ready Ready Preview Sep 30, 2026 9:09pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T21:14:37.465548Z 8473884 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 847388423ae6 against base 08653fc2c4d2.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Scan incomplete: one or more configured reviewers did not finish; completed reviewers' findings are shown below

Reviewers: anthropic/claude-opus-5.5: incomplete (review unavailable); openai/gpt-6-astra: incomplete (review unavailable)

Models: anthropic/claude-opus-5.5, openai/gpt-6-astra. Findings require human validation; this review never requests changes or blocks merging.

@Gajesh2007
Gajesh2007 merged commit 1e4b2d8 into master Sep 30, 2026
26 checks passed
@Gajesh2007
Gajesh2007 deleted the codex/mimo-media-accounting branch September 30, 2026 21:54

This branch was successfully deployed

4 active deployments
Preview – d-inference-console-ui-dev — 84738842 Deployed Sep 30, 2026 by vercel[bot]
Preview – d-inference — 84738842 Deployed Sep 30, 2026 by vercel[bot]
Preview – d-inference-landing — 84738842 Deployed Sep 30, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 84738842 Deployed Sep 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants