mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
PR #2068 dropped every reasoning item from input[] on the OAuth/codex path (store=false). That silently discards encrypted_content -- the out-of-band channel that carries reasoning context across turns under store=false -- degrading multi-turn agent reasoning with no visible error. Reported by @neteroster on PR #2068. The 404 that #2068 worked around ("Item with id 'rs_...' not found") is triggered by the rs_* id lookup under store=false, not by the reasoning item itself -- so the correct fix is to strip the id, not delete the item. Verified end-to-end against the live chatgpt.com codex backend (gpt-5.5) and a real OpenClaw container (api: openai-responses): - bare rs_ id, no encrypted_content -> 404 - id stripped -> 200 - encrypted_content + id stripped -> 200, reasoning context preserved - reasoning items require a summary field (missing -> 400) - real OpenClaw multi-turn agent loop -> all /v1/responses 200, zero 404 Fix: keep the reasoning item, strip only the rs_* id (always, independent of PreserveReferences), preserve encrypted_content/content/summary verbatim, and backfill an empty summary when absent. Tool-call call_id pairing is untouched. Also verified compaction_summary items (cmp_*, the other encrypted_content carrier): they require encrypted_content (missing -> 400) and their id does not 404 when present (kept or stripped), so the existing generic path already handles them safely -- no special-casing needed. Adds regression tests for each verified reasoning contract. Refs #1957, #2068