Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

fix(node): preserve filtered tool JSON when early deltas disabled - #43

Merged
CJackHwang merged 2 commits into
codex/fix-sieve-tool-call-filtering-issuesfrom
codex/fix-codex-review-issues-from-pr-#42
Feb 22, 2026
Merged

CJackHwang merged 2 commits into
codex/fix-sieve-tool-call-filtering-issuesfrom
codex/fix-codex-review-issues-from-pr-#42

Conversation

@CJackHwang

Copy link
Copy Markdown
Owner

Motivation

  • Prevent silent data loss when toolNames is non-empty and an encountered tool_calls JSON block contains only unknown/filtered tools and emitEarlyToolDeltas=false, because the sieve previously could consume the raw JSON and not emit it as text.

Description

  • Change consumeToolCapture in internal/js/helpers/stream-tool-sieve/sieve.js to always forward the captured JSON block as plain text when parseStandaloneToolCalls(...) returns an empty array, removing the conditional branch that could drop the captured content when incremental name probing had occurred.
  • Add a regression test sieve preserves filtered tool json as text after incremental probe in tests/node/stream-tool-sieve.test.js that simulates split chunks with an unknown tool under a non-empty allowed tool list and asserts the JSON and trailing prose are preserved as text and no tool_calls event is emitted.
  • Change scope is limited to JS sieve parsing/flush logic and unit tests; no public runtime API changes.

Testing

  • Ran syntax check script with ./tests/scripts/check-node-split-syntax.sh which returned checked=18 missing=0 invalid=0 and passed.
  • Ran unit tests with node --test tests/node/stream-tool-sieve.test.js and with the combined suite node --test tests/node/stream-tool-sieve.test.js tests/node/chat-stream.test.js tests/node/js_compat_test.js, and all tests passed (# pass 30 / fail 0).
  • The new regression test passes and confirms the captured filtered tool JSON is emitted as text in the flush path.

Codex Task

@vercel

vercel Bot commented Feb 22, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Feb 22, 2026 3:28pm

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review


P1 Badge Keep suffix for re-scan after filtered first tool block

When parseStandaloneToolCalls(...) returns empty, this branch now always returns suffix: '', which means any trailing content after the filtered JSON object is no longer fed back into state.pending for another parse pass. In streams where a filtered/unknown tool_calls object is followed in the same capture by a valid tool call (for example with non-empty toolNames and incremental probing already active), the later valid call is downgraded to plain text and never emitted as tool_calls/deltas.

ℹ️ 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 b1f6217 into codex/fix-sieve-tool-call-filtering-issues Feb 22, 2026
3 checks passed
@CJackHwang
CJackHwang deleted the codex/fix-codex-review-issues-from-pr-#42 branch February 22, 2026 15:31

This branch was successfully deployed

1 active deployment
Preview — b2c87f26 Deployed Feb 22, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant