Skip to content

fix(js): avoid false tool-call capture on plain tool_calls prose#168

Merged
CJackHwang merged 5 commits intodevfrom
codex/fix-vercel-deployment-issue-with-api-calls
Mar 30, 2026
Merged

fix(js): avoid false tool-call capture on plain tool_calls prose#168
CJackHwang merged 5 commits intodevfrom
codex/fix-vercel-deployment-issue-with-api-calls

Conversation

@CJackHwang
Copy link
Copy Markdown
Owner

Motivation

  • JS stream sieve could enter JSON capture mode when a tool keyword (e.g. tool_calls) appeared in normal prose, causing the client stream to appear truncated after the keyword.
  • The goal is to prevent plain explanatory text that mentions tool_calls from being misdetected as the start of a tool-call JSON payload.

Description

  • Tighten detection in internal/js/helpers/stream-tool-sieve/sieve.js so capture only starts when there is an actual { before a matched tool keyword (change in findToolSegmentStart).
  • Add a regression test tests/node/stream-tool-sieve.test.js (new case: "sieve does not start capture on plain "tool_calls" prose without opening json brace") to ensure plain mentions are preserved as text.
  • Commit message: fix(js): avoid false tool-call capture on plain tool_calls prose and included the updated files internal/js/helpers/stream-tool-sieve/sieve.js and tests/node/stream-tool-sieve.test.js.

Testing

  • Ran Node unit tests with bash tests/scripts/run-unit-node.sh, all JS tests passed (48/48).
  • Ran Go unit tests with bash tests/scripts/run-unit-go.sh, all Go unit tests passed (cached/ok results shown).
  • Performed a live end-to-end run with real account via go run ./cmd/ds2api-tests --config /tmp/ds2api-live-config.json --admin-key admin --no-preflight --timeout 90 --retries 1 --keep 1; tool-related streaming cases passed and overall live run produced 28 passed / 2 failures that are unrelated to this fix (embeddings_contract and error_contract_invalid_model).

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Mar 30, 2026 7:59am

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6efba7b2e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@CJackHwang CJackHwang merged commit 0139383 into dev Mar 30, 2026
3 checks passed
@CJackHwang CJackHwang deleted the codex/fix-vercel-deployment-issue-with-api-calls branch March 30, 2026 08:02
CJackHwang added a commit that referenced this pull request Mar 30, 2026
Merge pull request #168 from CJackHwang/codex/fix-vercel-deployment-issue-with-api-calls

fix(js): avoid false tool-call capture on plain tool_calls prose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant