Skip to content

fix: admit Codex fco_ function_call_output IDs (#547) - #554

Closed
justrightnow wants to merge 1 commit into
vllm-project:mainfrom
justrightnow:fix/547-codex-fco-output-id
Closed

justrightnow wants to merge 1 commit into
vllm-project:mainfrom
justrightnow:fix/547-codex-fco-output-id

Conversation

@justrightnow

Copy link
Copy Markdown
Contributor

Summary

Fixes #547.

Codex stamps the function_call_output items it builds for locally executed tools with an fco_ ID. InOutItem::admit (types/io/item/item_id.rs) admitted only fc_ for that item type, so the follow-up turn of any tool-using Codex session was refused with 400 invalid_value, and the client replays the same history on every retry, so the thread never recovers. Both POST /v1/responses (input) and POST /v1/conversations/{id}/items (items) go through InOutItem::admit_all.

This admits fc_ and fco_ for function_call_output:

  • One IdPrefixes { canonical, alternative } value owns the admitted spellings per item type; InOutItem::admit validates against it and the InvalidId message lists every admitted spelling ('fc' or 'fco').
  • id_prefix() remains the canonical accessor, so storage/types/item.rs still mints only fc_ public IDs and recorded cassettes are unchanged.
  • function_call still accepts only fc_; an fco_ ID that mislabels a call is still refused. The ID namespace stays type-distinct.
  • Correlation still rides on call_id, validated separately — the ID is only a reference handle.

Scope is limited to the admission rule; no storage schema, generated-ID, or cassette changes.

Test Plan

  • cargo fmt -- --check → clean.
  • cargo clippy --workspace --all-targets -- -D warnings → clean (no warnings).
  • cargo build --workspace → clean.
  • cargo test --workspace --no-fail-fast (isolated target dir, full rebuild): 3154 passed / 25 ignored / 2 failed. The 2 failures are messages_test::..._unreachable_upstream asserting 502 but receiving 504; they reproduce identically on pristine main (a bound-but-unlistened loopback socket times out on macOS) and do not touch the item/admission/conversations path — pre-existing, unrelated to this change.
  • New unit tests in item_id.rs: fco_ output admitted, function_call with fco_ still refused with only 'fc' listed, invalid output ID lists both spellings, and a replayed fco_...UUID output admitted through admit_all.
  • New HTTP regression codex_function_call_output_ids_are_admitted_over_http (crates/agentic-server/tests/conversations/regressions.rs): real gateway + in-memory SQLite, fco_ output admitted (200) and persisted with its ID intact via GET .../items; wrong-prefix and mistyped-ID cases return 400 with the correct wording.
  • End-to-end against the real agentic-server binary (SQLite, --skip-llm-ready-check, no model call needed for conversation routes): issue Codex tool results are refused: function_call_output does not admit the fco_ ID prefix #547's exact curl now returns 200; wrong prefix returns 400 listing 'fc' or 'fco'; function_call with fco_ returns 400 listing only 'fc'; canonical fc_ output still 200.
  • Existing admission/replay/error-wording tests (conversations_api_cassette_test, responses_api_test, conversation_storage_regressions, conversations_test) all pass — no recorded OpenAI error bodies changed.

All under the pinned Rust 1.98.1 toolchain.

Codex stamps the function_call_output items it builds for locally executed tools with an fco_ ID, but InOutItem::admit only accepted the fc_ prefix for that item type, so the second turn of any tool-using Codex session was refused with 400 invalid_value.

Admit both fc_ and fco_ for function_call_output while keeping fc_ canonical for generated IDs and the only accepted spelling for function_call. The admitted spellings are described by one IdPrefixes value and listed in the InvalidId error message; id_prefix() stays the canonical accessor so storage still mints fc_ and recorded cassettes are unchanged. Correlation still rides on call_id, validated separately.

Signed-off-by: Jack Wei <weike@chinamobile.com>
@maralbahari

Copy link
Copy Markdown
Collaborator

@justrightnow i am working on this in #553 with correction on recording openai behavior.

@justrightnow
justrightnow deleted the fix/547-codex-fco-output-id branch November 16, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex tool results are refused: function_call_output does not admit the fco_ ID prefix

2 participants