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

Support text-kv function.name/function.arguments fallback and looser name matching - #89

Merged
CJackHwang merged 2 commits into
devfrom
codex/review-changes-in-pull-request-#88
Mar 9, 2026
Merged

CJackHwang merged 2 commits into
devfrom
codex/review-changes-in-pull-request-#88

Conversation

@CJackHwang

Copy link
Copy Markdown
Owner

Motivation

  • Improve robustness when models emit non-JSON tool call fragments by detecting text key-value tool call blocks like function.name: ... and function.arguments: {...}.
  • Increase tolerance for tool name variations (case, namespace, punctuation) to avoid rejecting valid tool calls produced by different models.

Description

  • Add a text-KV fallback parser that recognizes function.name: and function.arguments: blocks and extracts tool calls, implemented as parseTextKVToolCalls in the JS helper and parseTextKVToolCalls / toolcalls_textkv.go in Go.
  • Integrate the text-KV parser into the parsing candidate pipeline and standalone parsing as a fallback in both JS (internal/js/helpers/stream-tool-sieve/parse.js / parse_payload.js) and Go (internal/util/toolcalls_parse.go).
  • Introduce a shared loose-name resolution util in Go (toolcalls_name_match.go) and route existing resolveAllowedToolName to use the new loose matching logic to support namespace tail and alphanumeric-only comparisons.
  • Update documentation (docs/toolcall-semantics.md) to list the new Text KV fallback parser and rename the markup entry to XML/Markup parser.
  • Add unit tests for the new behavior: internal/util/toolcalls_textkv_test.go for Go and additional JS tests in tests/node/stream-tool-sieve.test.js to cover parsing of text-kv payloads.

Testing

  • Added and ran Go unit tests including internal/util/toolcalls_textkv_test.go via go test ./..., which passed.
  • Added and ran Node unit tests (tests/node/stream-tool-sieve.test.js) via the project's JS test runner (npm test or equivalent), which passed.
  • Existing parsing tests were exercised and remain passing after integration of the fallback parser and loose-name matching.

Codex Task

@vercel

vercel Bot commented Mar 9, 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 Mar 9, 2026 11:20am

@CJackHwang
CJackHwang marked this pull request as ready for review March 9, 2026 11:17
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@CJackHwang
CJackHwang merged commit 71cdcb4 into dev Mar 9, 2026
3 checks passed
@CJackHwang
CJackHwang deleted the codex/review-changes-in-pull-request-#88 branch March 9, 2026 11:21
CJackHwang added a commit that referenced this pull request Mar 9, 2026
Merge pull request #89 from CJackHwang/codex/review-changes-in-pull-request-#88

Support text-kv `function.name`/`function.arguments` fallback and looser name matching

This branch was successfully deployed

1 active deployment
Preview — 9c46c3a8 Deployed Mar 9, 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