Skip to content

fix(cursor): reject structured output before transport - #15

Merged
yansigit merged 1 commit into
mainfrom
feat/structured-output-followups
Aug 24, 2026
Merged

yansigit merged 1 commit into
mainfrom
feat/structured-output-followups

Conversation

@yansigit

Copy link
Copy Markdown
Owner

Summary

  • Lock Google CCA Flash JSON+thinking and Vertex JSON compile paths so mime type, schema, and thinking stay on one generationConfig.
  • Document the real structured-output matrix: openai-chat forwards, Google lowers to Gemini JSON mode, Kiro rejects, Cursor has no wire field.
  • Add ProviderAdapter.validateRequest? and fail closed on Cursor before transport. Combo failover does not retry that 400 onto another model.
  • Live Job Liberator canary against google-antigravity/gemini-3.7-flash returned unfenced schema-valid JSON; no consumer prompt/schema change.

Test plan

  • bun run typecheck
  • Focused: bun test --isolate --max-concurrency=1 --max-workers=1 tests/cursor-adapter.test.ts tests/cursor-request-builder.test.ts tests/server-combo-failover-e2e.test.ts tests/chat-completions-endpoint.test.ts tests/google-adapter.test.ts tests/google-antigravity-wire.test.ts tests/google-wire-compiler.test.ts (336 pass / 0 fail)
  • Earlier unsandboxed serial ./tests/ gate: 14607 pass / 10 skip / 0 fail
  • Live match-judge + structured-propose canary on loopback OpenCodex 10100

Do not file this against lidge-jun/opencodex.

Made with Cursor

Lock Google CCA Flash JSON+thinking and Vertex JSON compile paths, and
document the real adapter matrix. Cursor has no output-schema wire field,
so validateRequest fails closed after adapter assignment and before
attempt allocation. Combo failover does not retry that 400 onto another
model.

Co-authored-by: Cursor <[email protected]>
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 24, 2026
@yansigit
yansigit merged commit 2f126b1 into main Aug 24, 2026
23 checks passed
@yansigit
yansigit deleted the feat/structured-output-followups branch August 24, 2026 03:55
cursor Bot pushed a commit that referenced this pull request Oct 12, 2026
…flag tool errors, system prompt in #2 (carry lidge-jun#6092) (lidge-jun#6178)

* fix(devin): system prompt in #2, tool-error flag, Gemini schemas, history overflow

- Send the leading system text as GetChatMessage #2 instead of folding it into
  the first user prompt. Live on swe-1-6 with a ~6.7k-token system prompt the
  turn-2 cache ratio is unchanged (6688/6715 vs 7072/7097) and the prompt is
  smaller; swe-1-6, swe-2-medium, gemini and claude all obey #2.
- Mark failed tool results with ChatMessagePrompt #9 tool_result_is_error
  instead of an in-band "ERROR:" prefix.
- Rewrite JSON-Schema type arrays to anyOf in tool parameters for Gemini uids,
  which Cognition refuses with invalid_argument on every turn.
- Surface a pre-output invalid_argument on a history near or past the model's
  input window as context_length_exceeded so Codex compacts; small requests
  with the same code stay a plain 400.
- Correct the #15 (CortexTrajectoryReference), #17 prompt_id and #22
  execution_id comments.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 29688bf)

* fix(devin): measured overflow boundary, per-type Gemini branches, tool-error marker

- Overflow: binary-searched live on swe-1-6 (200k window) the refusal sits at
  ~200-203k real tokens for prose and JSON alike, and a 32000 output cap does
  not move it. Characters per token ran 1.33-5.53 across samples, so the
  chars/4 estimate is replaced by a word-piece count (1.00-1.54x real) at 95%
  of the window: every sample at the window is caught, none at 60% is.
- Gemini schemas: `{type:[T,"null"], ...}` becomes anyOf branches that carry
  the type-specific keywords (items, properties, ...); an existing anyOf is
  folded in rather than nested under allOf. Draft-7 `dependencies` is walked as
  a schema map with name lists left as data.
- Tool errors keep the in-band ERROR: marker beside #9: with a neutral result
  flagged as an error only gemini reported a failure; swe-1-6, gpt-6-sol-low
  and gpt-5-6-luna-low read it as success.
- A request with only system text keeps it as a user prompt instead of
  sending no prompts.
- Docs: describe the context_length_exceeded reclassification beside the
  allowDevinInvalidArgument recovery option.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit d84edae)

* fix(devin): keep outer constraints when folding a Gemini anyOf

Folding each existing anyOf branch into the outer keywords let a branch
override a contradicting outer keyword, so `{maxLength: 5, anyOf:
[{maxLength: 50}]}` loosened to 50. On any such disagreement, keep both
constraints under allOf instead; live, gemini-3-8-flash-medium accepts
allOf.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit db28e2d)

* docs(devin): match the collapseSystemIntoUser example to the #2 system prompt

The example still showed the leading system messages folded into the
first user turn, which now travel in request #2. Show a mid-conversation
system run instead, with the real blank-line join, and note that a
system-only request passes through whole.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit b2d9ded)

* docs(devin): show the blank-line join in the collapse example

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 3232330)

* fix(devin): keep both constraints when a Gemini type union and anyOf are disjoint

When no existing anyOf branch shared a type with the type array, the
fallback kept the anyOf and dropped the type union, so the branches
admitted types the node never allowed. Keep both under allOf, the same
form the conflict path uses; live, gemini-3-8-flash-medium accepts it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit b87b332)

* fix(devin): classify overflow from the selected catalog window

Co-authored-by: Sayo <[email protected]>

* fix(devin): preserve null constraints in Gemini schema rewrite

Co-authored-by: Sayo <[email protected]>

* docs(devin): record malformed-schema overflow ambiguity

Co-authored-by: Sayo <[email protected]>

* fix(devin): preserve outer schema constraints on nullable types

Co-authored-by: Sayo <[email protected]>

* fix(devin): estimate overflow from transmitted tool descriptions

Co-authored-by: Sayo <[email protected]>

* docs(structure): keep the effective Devin family default in the adapter row

Co-authored-by: Sayo <[email protected]>

---------

Co-authored-by: Sayo <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
cursor Bot pushed a commit that referenced this pull request Oct 12, 2026
Named Devin conversations retain an upstream trajectory across sequential turns and request-scoped adapters. Scope retained IDs by resolved credential, tenant host, and conversation; use fresh IDs for overlaps and when every retained slot is active. A 256-entry store evicts only inactive entries, and idempotent release in `finally` covers success, failure, and cancellation. The optional wire field preserves per-request allocation for unnamed calls.

Refines lidge-jun#6488 at `a0b199fc6b96367fb174f6488a7a45eb58eccd54`. Carries the optional #15.1 field, named continuity across adapters, unnamed fallback, overlap isolation, and failure release regressions. Replaces the source's map-plus-live-set with one bounded store, hashes a structured identity tuple, and prefers own-thread identity over a shared parent. Adds credential/host/alias/parent/cancellation/eviction/overflow/idempotence/retry coverage and documents the contract. The original author's live cache measurements are original source evidence; this replacement does not claim new measured savings. Independent of lidge-jun#6554; neither PR's runtime commits are required by the other. Coordinator owns source disposition.

Co-authored-by: Hanqing Zhao <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

Verified current head f09d987 with CI 37174376575 and scoped independent technical/security review.

Co-authored-by: Hanqing Zhao <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant