Skip to content

fix(proxy): lift Codex additional_tools input carriers into chat tools - #476

Open
525300887039 wants to merge 1 commit into
SaladDay:mainfrom
525300887039:fix/codex-additional-tools-466-c08fb5
Open

525300887039 wants to merge 1 commit into
SaladDay:mainfrom
525300887039:fix/codex-additional-tools-466-c08fb5

Conversation

@525300887039

Copy link
Copy Markdown

Summary

Related to #466.

Codex requests reported with Desktop 26.901 / codex.exe 0.153.4 carry tools in
additional_tools input items. Those tools were not collected before proxy
conversion, leaving the upstream Chat model without the carried tools.

  • Collect supported tools from direct additional_tools input items (array
    elements or the already-supported single input object) using the existing
    registry. Keep top-level priority, input order and first-definition dedup.
  • Ignore the carrier's role/content in both converters: it must not become
    Chat messages or Anthropic system/messages. Preserve real messages and
    pending tool calls, media and reasoning.
  • Do not interpret markers inside schemas, message content or tool outputs as
    declarations. Preserve the existing recursive tool_search_output behavior.

Adapted from farion1231/cc-switch#7454
(a35e5000b4ef809ed76eb36bd164bf6a35c36afc) with a direct-input boundary
guard and consistent carrier handling in both converters. Changes are limited to
src-tauri/src/proxy/providers/transform_codex_chat.rs and
src-tauri/src/proxy/providers/transform_codex_anthropic.rs.

Testing

Run from src-tauri/ with Rust 1.91.1 and isolated configuration directories:

  • cargo test --lib --no-default-features additional_tools: 8 passed. The
    original omission, nested-marker regression and Anthropic content leak were
    demonstrated failing before their respective fixes. The new table-driven
    test checks four carrier roles with string/array content against both actual
    request converters, preserving the real instructions, user message and tools.
  • Codex Chat / Anthropic conversion modules: 68 / 71 passed; streaming modules:
    19 / 20 passed. Tests cover registration order, dedup, history names,
    response restoration and unchanged pending state.
  • cargo test --no-fail-fast: 4923 passed, 5 failed, 2 ignored across 44
    targets on the final patch (excluding a duplicated subprocess result).
    Only prompt_commands (2 editor-configuration tests) and provider_commands
    (3 official usage-template tests) failed; identical failures were reproduced
    on the unmodified baseline. This is not a passing full-suite result.
  • cargo test --lib --no-default-features: 2077 passed, 0 failed, 2 ignored.
    CI unit commands: library 4363 passed, 2 ignored; binary 10 passed. The
    CI-selected proxy integration cases passed (forwarder, daemon, proxy_database).
  • RUSTFLAGS="-D warnings" library-only check and compile-test, the CI direct
    dependency guard, both changed-file rustfmt --check runs and
    git diff --check passed. cargo clippy --lib --no-default-features passed
    with existing warnings.

Notes

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.

1 participant