forked from lidge-jun/opencodex
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(openai-chat): bound Moonshot schema inlining bytes #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+167
−7
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ab7f684
fix(openai-chat): bound Moonshot schema inlining bytes
luvs01 060cc36
ci: retrigger checks (empty commit; dev merge conflicts)
luvs01 9e2ca52
Merge branch 'dev' into codex/propose-fix-for-moonshot-request-amplif…
devin-ai-integration[bot] 2f6ab89
Merge branch 'dev' into codex/propose-fix-for-moonshot-request-amplif…
luvs01 7c8e39b
ci: retrigger macos 1/2 (wedged-spawn silent-stall in client-connect.…
devin-ai-integration[bot] 3b8cb5e
docs(structure): record Moonshot inline-byte budget in a new ADR
devin-ai-integration[bot] 292e7e1
fix(openai-chat): share the Moonshot inline-byte budget across reques…
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
structure/decisions/ADR-0355-chat-structured-output-compatibility.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # ADR-0355 — decision recorded under "Chat structured-output compatibility" | ||
|
|
||
| - Contract owner: [providers/chat-compat.md](../providers/chat-compat.md#chat-structured-output-compatibility) | ||
|
|
||
| ## Decision record | ||
|
|
||
| - 목적과 의도: Bound the request amplification a Moonshot `$ref` inlining can produce without | ||
| weakening the tool schema beyond what the wire forces. | ||
| - 기존 구현 및 제약 조건: The normalizer walks depth-, node-, and expansion-bounded, but a small | ||
| input can name a large boolean `properties` map from many nodes, so each bound can pass while | ||
| the serialized output still repeats the map hundreds of times. The adapter sits on the request | ||
| path, so amplification is user-facing latency and payload size. | ||
| - 검토한 주요 대안: (1) Keep only the three existing budgets. (2) Measure the final serialized | ||
| request and reject it over a size cap. (3) Charge each inlined target its serialized JSON bytes | ||
| against a shared byte budget before copying it. | ||
| - 선택한 방식: (3). Each expansion measures the referenced schema's serialized size once per | ||
| target object, charges it against one 1 MiB allowance shared by every tool in the request, | ||
| and a reference that would exceed the remaining allowance stays a bare `$ref`. | ||
| - 다른 대안 대신 이 방식을 선택한 이유: (1) leaves the demonstrated amplification reachable — | ||
| node and expansion counts stay small while output grows without bound. (2) detects the blow-up | ||
| only after the bytes were already produced, and a whole-request rejection discards a schema | ||
| Moonshot would have accepted in partially inlined form. | ||
| - 장점, 단점 및 영향: Output size is bounded independently of how the reference graph is shaped, | ||
| and over-budget nodes degrade to the same bare-`$ref` fallback the other budgets already use. | ||
| Measuring is iterative and capped at the remaining allowance, so the guard itself cannot | ||
| reintroduce the deep-schema stack exhaustion the depth budget prevents. Moonshot 계열 | ||
| `openai-chat` baseUrl에만 적용되고 다른 provider는 손대지 않는다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.