Skip to content

fix(console): reject oversized composed chat requests before send - #1313

Merged
Gajesh2007 merged 4 commits into
masterfrom
fix/issue-343-20261002
Oct 5, 2026
Merged

Gajesh2007 merged 4 commits into
masterfrom
fix/issue-343-20261002

Conversation

@jonathan308

@jonathan308 jonathan308 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reject oversized composed chat requests locally before sending them. The existing four-image/10 MiB-per-image allowance can exceed the coordinator’s 16 MiB body cap after JSON composition or sender encryption; the guard checks UTF-8 plaintext bytes, a safe sealed-size lower bound, and the actual encrypted envelope. Send and retry keep the user’s message and images and return an actionable size error.

Linked issue

Addresses Layr-Labs/d-inference#343. The original qualification base was 27a165e831e23dd9276f0b279068abe948982902; current integration evidence is recorded below.

Before

flowchart LR
  A["Images + history"]:::input --> B["streamChat / prepareBody"]:::code
  B --> C["Serialize or seal"]:::code --> D["Next POST proxy"]:::network
  D --> E["Coordinator body cap"]:::network --> F["Oversized request rejected remotely"]:::error
  classDef input fill:#e0f2fe,stroke:#0369a1,color:#0c4a6e
  classDef code fill:#ede9fe,stroke:#6d28d9,color:#3b0764
  classDef network fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef error fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d
Loading

After

flowchart LR
  A["Send or retry: images + history"]:::input --> B["prepareBody: UTF-8 budget"]:::code
  B -->|"Over cap / sealed lower bound"| E["Local error; retain message/images"]:::error
  B -->|"Fits"| C["Optional seal + actual envelope check"]:::code
  C -->|"Over cap"| E
  C -->|"Fits"| D["Next POST; existing server guards"]:::network
  classDef input fill:#e0f2fe,stroke:#0369a1,color:#0c4a6e
  classDef code fill:#ede9fe,stroke:#6d28d9,color:#3b0764
  classDef network fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef error fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d
Loading

Current target and integration status

Integrated current master c5552d3af7 (after #1324, #1338 and #1340) with signed merge commits 5999ad7e and 4c44fd00; the resolved source tree is ee530f47. The consumed SDK is 1ee8675a035d0d842d5df663938d66cfedf88a8e, from master.

What the reorganization changed for this pull request:

Before Now
coordinator/api/sender_encryption_budget_test.go (package api, private server state) coordinator/tests/api/inference/sender_encryption_budget_test.go (package inference_test), built on inference.Owner.SealedTransport. TestSealedRequest_BodyBudget, both subtests and the exact-cap arithmetic are unchanged
Inside the handler the test read the private sealed-request context marker An external test cannot reach that marker. The sealed path is now observed through the X-Eigen-Sealed response header, which only that path sets. The marker itself is no longer asserted by this test
Documentation tables cited coordinator/api/sender_encryption.go Master's rows with the new paths are kept, plus the two rows this pull request adds

The console code is exactly as before; master changed none of those files.

Refactor pass. A dedicated refactor subagent reviewed the ported change against the structure and clean-code rules in AGENTS.md. Outcome: no change needed. Two things it recorded and left: no test now pins the sealed-request marker itself (master had none either; closing that needs a new end-to-end test with a remote image URL, which is new coverage), and docs/architecture/components/console-ui.md does not yet describe the preflight.

Validation on the merged head (Go 1.25.0):

  • gofmt clean, go build ./coordinator/..., go vet ./coordinator/..., layout guard TestCoordinatorTestsAreIsolated.
  • TestSealedRequest_BodyBudget: exact_cap and one_byte_over pass; the whole coordinator/tests/api/inference package passes, also under -race.
  • Complete coordinator suite at the pushed head, python3 scripts/run-coordinator-tests.py --jobs 1 ./coordinator/...: 8,131 passed, 0 failed, 5 skipped. The same five tests skip on master (environment-gated performance and fixture suites).
  • make docs-check (330 files) and make docs-impact-check BASE=origin/master.
  • Not run on the merged head: console lint, vitest and production build. The console files are unchanged from the previous head, where they passed; CI runs them again.

Previous integration (2026-10-02)

Integrated current master c56b98e8638f1895b80e22c00122880bed9b11b9 with a signed merge commit d59b2f823894cb5e0f3c15bf405e48f7765f5ec4; the resolved source tree is 85511539a7c08db8c4985e2da70645e99a209268. The merge preserves the focused fix and incoming master behavior. The consumed SDK is 1ee8675a035d0d842d5df663938d66cfedf88a8e.

Fresh local validation: 834 UI invocations passed; the overlapping focused selection passed 70. Restoring current-master transport code produced four expected assertion failures and two passing controls. Typecheck, ESLint (zero errors), default production build, docs lint and docs impact passed. All nine executable coordinator boundary cases passed under pinned Go 1.25.0; the initial compile-only disk-limit stop is retained.

Ready for maintainer review of the documented scoped fix and test evidence. Main CI and Integration Tests passed on this head; benchmark approval and the qualification limits below remain open. Local component results do not establish production deployment or full native qualification.

Earlier qualification

The original candidate e8e164c7c499883eabc46774d7d364eb8913b952 was qualified against base 27a165e831e23dd9276f0b279068abe948982902. Those results remain historical; the current-base results and outstanding gates are stated above.

Components touched

  • console-ui
  • coordinator (boundary regression tests only)
  • docs

Protocol / interface changes

  • No wire-format, server-limit or upload-policy changes. Later coordinator rewrites retain their authoritative checks. The console adds an earlier, actionable refusal.

Documentation impact

  • Canonical consumer quickstart, encryption architecture, API contracts and changelog updated with the behavior and remaining server boundaries.

Notes for reviewers

Node 24.15.0 was available locally; the repository’s Node 22 environment remains a hosted-CI gate. The browser fixture evidence from the original composition is historical. Live Privy, deployed Next/coordinator/provider behavior and real model inference remain unverified. The unchanged Before/After figures were visually checked in their actual GitHub rendering. Original failing controls, resource stops, passing reruns and independent reviews remain preserved; none imply an absolute no-regression guarantee.


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 Oct 2, 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 Oct 4, 2026 10:02pm UTC
d-inference-console-ui-dev Ready Ready Preview Oct 4, 2026 10:02pm UTC
d-inference-landing Ready Ready Preview Oct 4, 2026 10:02pm UTC
eigen-homepages-darkbloom Ready Ready Preview Oct 4, 2026 10:02pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 4c44fd008bdf against base c5552d3af7ae.

Review not completed for this head. Previous findings are superseded, not confirmed resolved.
Ten-PR pilot complete; maintainer evaluation required

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

jonathan308 and others added 2 commits October 4, 2026 12:35
…r/tests

Upstream reorganized the coordinator (#1324): sender encryption is now owned
by coordinator/api/inference and every Go test lives under coordinator/tests.

- Move TestSealedRequest_BodyBudget to
  coordinator/tests/api/inference/sender_encryption_budget_test.go and build
  it on inference.Owner.SealedTransport. Both subtests and the exact-cap
  arithmetic are unchanged.
- The test used to read the private sealed-request context marker inside the
  downstream handler. An external test cannot reach that marker, so the
  sealed path is now observed through the X-Eigen-Sealed response header,
  which only that path sets. The marker itself is no longer asserted here.
- Keep both sides of the documentation tables and both changelog entries;
  cited coordinator paths follow the new layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Gajesh2007 Gajesh2007 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed head 4c44fd0, including UTF-8 accounting, NaCl/base64 overhead, actual envelope validation, and send/retry state preservation. No blocking correctness or security findings. Expanded UI selection passed 71 tests, including all 23 new tests; TestSealedRequest_BodyBudget passed locally under -race. Current applicable CI and integration checks pass; E2E benchmarks remain awaiting environment approval. Local tests do not establish deployed image inference acceptance.

@Gajesh2007
Gajesh2007 merged commit 38f81ef into master Oct 5, 2026
32 of 33 checks passed

This branch was successfully deployed

4 active deployments
Preview – d-inference-console-ui-dev — 4c44fd00 Deployed Oct 4, 2026 by vercel[bot]
Preview – d-inference — 4c44fd00 Deployed Oct 4, 2026 by vercel[bot]
Preview – d-inference-landing — 4c44fd00 Deployed Oct 4, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 4c44fd00 Deployed Oct 4, 2026 by vercel[bot]
benchmarks — 4c44fd00 Deployed Oct 4, 2026 by jonathan308 via E2E Benchmarks #2205
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