Skip to content

fix(server): merged tool schemas say which fields each tag requires - #32595

Open
MiaAI-Lab wants to merge 6 commits into
pingdotgg:mainfrom
MiaAI-Lab:fix/merged-tool-schema-required-fields
Open

MiaAI-Lab wants to merge 6 commits into
pingdotgg:mainfrom
MiaAI-Lab:fix/merged-tool-schema-required-fields

Conversation

@MiaAI-Lab

@MiaAI-Lab MiaAI-Lab commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

advertisedJsonSchema merges a tagged union into one object schema for providers that cannot take oneOf. The merged schema's required keeps only fields that every branch requires, and nothing tells the model which fields a particular tag needs. For t3_thread_launch that means baseRef, which the worktree branch requires, is invisible as a requirement: models launch worktree threads without it and T3 rejects the call.

This is a small, focused fix for that defect (contributing guide's "obvious bug" exception): it changes only the generated description of the merged schema, not tool behavior.

Fix

When merging, the tag property gets a description naming each branch's own required fields, for example "worktree requires baseRef." Fields every branch requires stay in required as before, and the schema is otherwise unchanged.

The advertised tool list grows by 465 bytes, so agentContextBudget.json is updated and this PR needs the agent-context-increase label.

Evidence

  • apps/server/src/mcp/advertisedJsonSchema.test.ts: the extended assertion fails on current main (25bf84a) and passes with the fix.
  • AgentContextBudget.test.ts passes with the updated budget; vp run check:changed passes.
  • Measured with evals/mcp-tool-use on GLM-5.3-Flash (local server), the five worktree-launch cases, 3 samples each: through Pi 3/15 -> 9/15 passing (launches missing baseRef 2 -> 0); through Codex 8/15 -> 10/15 (5 -> 3).
  • Not checked: Claude or GPT models on these cases.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 7, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 2a443bd

Macroscope's review found this PR approvable — Merged MCP tool schemas now describe which fields each tag requires, with the tool-list size fixture updated accordingly. Existing validation and tool behavior remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Tagged-object schemas now describe fields required by each tag value when those fields differ across branches. The expected schema, documentation, and configured MCP tool-list byte count are updated.

Changes: Tagged-union schema descriptions

Layer / File(s) Summary
Generate and validate branch-specific descriptions
apps/server/src/mcp/advertisedJsonSchema.ts, apps/server/src/mcp/advertisedJsonSchema.test.ts, apps/server/src/provider/agentContextBudget.json
The generator keeps fields required by every branch in the merged required list. The tag property's description lists each branch's other required fields. The test expectation and documentation reflect this behavior. mcpToolListJsonBytes changes from 57321 to 57786.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: t3dotgg, yash-singh1, shivamhwp

Merge Risk: Minimal · up to 2beb4

This change makes the generated tool schema describe which fields each tag requires, which should help models supply fields such as baseRef. The advertised tool list grows by about 465 bytes. The context budget check stays red until a maintainer applies the agent-context-increase label. No functional merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: merged tool schemas now state which fields each tag requires. It follows the conventional commit form and matches the raw summary and objectives, which describe the pe…
Description check Passed The description follows the template. It has Problem, Fix (Change), Scope (obvious-bug exception, no issue link), and Verification sections with focused test results and eval measurements. It also sta…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: merged tool schemas now state which fields each tag requires. It follows the conventional commit form and matches the raw summary and objectives, which describe the per-tag required-field description in mergeTaggedObjects.

Full details: Description check

Explanation

The description follows the template. It has Problem, Fix (Change), Scope (obvious-bug exception, no issue link), and Verification sections with focused test results and eval measurements. It also states what was not checked (Claude and GPT models). The Scope section does not link an issue, but it gives a reason for omitting one, as the template asks. The template's agent-model note is absent, but the author may not have used an agent, so this is minor.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bf92134 and 2beb493.

Files selected for processing: 3

  • apps/server/src/mcp/advertisedJsonSchema.test.ts
  • apps/server/src/mcp/advertisedJsonSchema.ts
  • apps/server/src/provider/agentContextBudget.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Merging a tagged union into one object kept only the fields every branch
requires, so models launched worktree threads without baseRef and T3
rejected the call. The tag now names each branch's own required fields.
@MiaAI-Lab
MiaAI-Lab force-pushed the fix/merged-tool-schema-required-fields branch from 2a443bd to 351024d Compare November 7, 2026 20:11
@maria-rcks

maria-rcks commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Written by claude-opus-5-5 on behalf of Maria

Merged current main again (merge commit, no rebase) to clear a new conflict in agentContextBudget.json: kept main's values and set mcpToolListJsonBytes to the measured 48682. No other changes. vp run check:changed passes (format, lint, knip, typecheck, tests).

Agent context budget stays red by design: the per-tag description adds 465 bytes to the MCP tool list. Cutting it would drop the fix, so it needs the agent-context-increase label from a maintainer.

…a-required-fields

# Conflicts:
#	apps/server/src/provider/agentContextBudget.json
@github-actions

Copy link
Copy Markdown
Contributor

This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

See the conflict window.

@github-actions github-actions Bot added the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Nov 17, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 19, 2026
juliusmarminge and others added 2 commits November 19, 2026 18:58
Records the measured tool-list budget on top of main's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Computing each branch's required fields before the tag property removes the
index offset and the cast, and puts the description where other tag text
would join it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Nov 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

these checks fail on 2beb493, also when run again: Agent context budget, and the rework changed nothing:

No code change was needed this pass, so nothing was pushed and the head is unchanged. (1) Agent context budget failure: reproduced locally with the workflow's jq comparison against main's agentContextBudget.json: mcpToolListJsonBytes 57321 -> 57786 (+465). The growth is the fix itself: five merged tagged-union schemas now carry a tag description (preview_navigate target.kind, schedule_task schedule.type, t3_thread_transfer sourcePoint.type, t3_thread_launch workspaceStrategy.type, t3_project_update projectIcon.kind). The workflow is a deliberate gate that a maintainer clears with the agent-context-increase label. Cutting the text would remove the fix. The committed fixture matches the measured bytes (AgentContextBudget.test.ts passes). The branch is 9 commits behind main, none touching apps/server/src/mcp or packages/contracts, so the fixture is not stale and no merge was needed (git merge-tree reports a clean merge despite the needs-rebase label). (2) Evals: ran the 10 mcp-tool-use cases that exercise the touched schemas (5 schedule_task cases and 5 t3_thread_launch worktree/baseRef cases) on gpt-6.1-sol, with gpt-6.1-terra as the shell model through the Codex proxy, 2 samples each. One run used main's advertisedJsonSchema.ts and one used the branch's. Scores were identical: 9/10 cases at 100% on both. tt-another-thread-worktree fails on both in every completed sample because Sol passes baseRef 'origin/main' (with startFromOrigin) while the case's grader requires exactly 'main'. That is a problem in the case and predates this change. One branch sample errored at the proxy. Claude models were not run (no Anthropic key). No new eval case was added. (3) #28147 is still open, so the coordination note stays.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. size:M 30-99 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants