Repository navigation
fix(cli): emit string enums as Type.String({ enum }) in Pi adapter (#2787) - #2807
divakantpandey wants to merge 2 commits into
Conversation
…eusData#2787) Signed-off-by: Divakant Pandey <divakant01@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
…#2787 test The DeusData#2787 change added client_adapter_pi_emits_string_enum_issue2787 directly below client_adapter_pi_wraps_result_and_honors_abort and, in the same hunk, removed that test's check that the generated abort handler kills the cli child (if (!child.killed) child.kill();). The generator still emits the line; restore the assertion byte-for-byte so the abort path keeps its coverage. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Hi @divakantpandey, welcome, and thank you for your first contribution here! This is a really clean fix. You found the exact spot where the Pi generator turned string enums into a Type.Union of Type.Literal, switched it to Type.String({ enum: [...] }) so the serialized schema becomes a plain { type: 'string', enum: [...] } that Gemini and Antigravity accept, and pinned it with a regression test against the real index_repository mode values. As a bonus, the restructure also fixes a latent edge case: an enum with no string members used to produce malformed TypeScript, and now it falls back to a plain Type.String. We pushed one small commit on top of your branch so this can land right away:
Since the branch has moved, please pull before pushing again. Thanks again, this unblocks every Pi user on a Gemini model! |
Fixes #2787
Problem
When
codebase-memory-mcp installgenerates the Pi client extension (cbmem.ts),convert_json_schema_to_typebox()translates JSON Schema string enums into:TypeBox serializes this pattern as
anyOf: [{ const: 'opt1' }, { const: 'opt2' }]. Gemini / Antigravity function declaration validation rejectsconstandanyOfwith:Solution
Emit string enums as standard TypeBox string enums:
which TypeBox serializes directly as
{ type: 'string', enum: ['opt1', 'opt2'], description: '...' }. This is standard JSON Schema supported by all major function-calling providers (Gemini, Antigravity, Anthropic, OpenAI, Bedrock).Verification
client_adapter_pi_emits_string_enum_issue2787and updatedclient_adapter_pi_emits_parameters_and_executeintests/test_agent_clients.c.scripts/test.sh --suites agent_clients(ASan + UBSan): 40/40 tests passed.scripts/test.sh --contracts-only: All static contracts passed.scripts/check-dco.sh: Commit carries valid Signed-off-by.scripts/build.sh: Production binary builds cleanly.Note: This contribution was prepared with the assistance of Antigravity.