Commit Graph

8 Commits

Author SHA1 Message Date
Luis Pater
db143aebac fix(codex): make input ID sanitization collision-resistant and deterministic
- Track normalized ID state (`occupied`/`preserved`) during preprocessing to avoid remapping valid existing IDs.
- Resolve collisions by appending deterministic hash-based suffixes until a free ID is found.
- Share occupancy tracking across shortening and remapping so sanitized IDs remain stable and idempotent.

Closes: #4891
2026-08-12 01:04:22 +08:00
Luis Pater
673bac5fc6 fix(codex): normalize custom_tool_call_output IDs with ctco_ prefix during Codex input sanitization 2026-08-09 21:34:01 +08:00
Luis Pater
197f520426 fix(codex): normalize custom_tool_call IDs with ctc_ prefix during Codex input sanitization 2026-08-08 23:25:11 +08:00
jizhenggang
c30e60a11b Reduce Codex request amplification for large payloads
Reuse immutable request bytes during input inspection and avoid a redundant websocket clone while preserving the required outbound envelope.

Constraint: Preserve request immutability and one final WebSocket request-body allocation
Rejected: In-place JSON mutation | request buffers are shared across translation and execution stages
Confidence: high
Scope-risk: narrow
Directive: Do not retain no-copy gjson results or mutate their backing payload while results are in use
Tested: GOTOOLCHAIN=local go test ./...; targeted 8 MiB allocation benchmarks
Not-tested: Live Codex upstream network traffic
2026-08-07 19:16:06 +08:00
Luis Pater
5e25566c24 fix(codex): normalize reasoning and function_call item IDs during input sanitization 2026-08-07 05:52:20 +08:00
Luis Pater
8d675e690d feature(codex): Normalize invalid sub2api message item IDs during Codex input sanitization
- Prefix non-compliant message input IDs with `msg_` while leaving valid/prefixed IDs unchanged.
- Apply normalization before length checks and shortening to keep ID handling deterministic and consistent across Codex request paths.
2026-08-03 02:45:49 +08:00
Luis Pater
fde40c5a0a feat(executor): sanitize and drop overlong encrypted reasoning IDs in Codex input processing
- Updated `SanitizeCodexInputItemIDs` to remove encrypted reasoning items with IDs exceeding the Codex length limit.
- Refactored logic to deterministically shorten other overlong input item IDs, ensuring compliance with the Codex format.
- Added new tests to verify dropping behavior for encrypted reasoning and shortening of lengthy IDs without encrypted content.
2026-07-20 02:02:17 +08:00
Luis Pater
1cfe529f32 feat(executor): add ID shortening for overlong Codex input items
- Implemented deterministic shortening of overlong Codex input item IDs to meet 64-character limit.
- Added `SanitizeCodexInputItemIDs` helper for efficient ID shortening in request bodies.
- Updated Codex executor and websocket implementations to utilize the new helper.
- Introduced unit tests to validate ID length restrictions, avoidance of collisions, and deterministic behavior.

Closes: #4401
2026-07-17 23:52:58 +08:00