mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 06:49:37 +00:00
Fixes #74665.
Normalize replayed OpenAI Responses tool call identifiers before same-model pi-ai replay sends them back to the provider. This keeps canonical `call_*|fc_*` pairs intact when valid, rewrites overlong or malformed `function_call.call_id`, `function_call.id`, and matching `function_call_output.call_id` values into OpenAI's accepted 64-character shape, and preserves the reasoning replay path.
Verification:
- Live OpenAI E2E with maintainer key: raw replay payload failed with HTTP 400 for overlong `input[1].id`; normalized replay succeeded with HTTP 200 and `LIVE_OK`.
- `pnpm exec oxfmt --check --threads=1 src/agents/pi-embedded-helpers/openai.ts`
- `CI=1 OPENCLAW_VITEST_FS_MODULE_CACHE_PATH="$(mktemp -d /tmp/openclaw-vitest-cache.XXXXXX)" fnm exec --using 24.15.0 -- pnpm test src/agents/pi-embedded-runner/run/attempt.tool-call-normalization.test.ts -- --run --reporter=verbose --maxWorkers=1`
- `CI=1 OPENCLAW_VITEST_FS_MODULE_CACHE_PATH="$(mktemp -d /tmp/openclaw-vitest-cache.XXXXXX)" fnm exec --using 24.15.0 -- pnpm test src/agents/pi-embedded-runner.openai-tool-id-preservation.test.ts src/agents/openai-responses.reasoning-replay.test.ts -- --run --reporter=verbose --maxWorkers=2`
- `autoreview --mode branch --base origin/main`: clean, no accepted/actionable findings.
- GitHub CI green on c675b35ade.
Co-authored-by: Yuval Dinodia <yetvald@gmail.com>