Skip to content

fix(copilot): declare item schemas on table tool array params - #7458

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/failed-table-tool-calls
Sep 3, 2026
Merged

fix(copilot): declare item schemas on table tool array params#7458
icecrasher321 merged 1 commit into
stagingfrom
fix/failed-table-tool-calls

Conversation

@j15z

@j15z j15z commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • updates, rows, order, columnNames, and disabledTagIds were declared in the tool catalog as arrays with no item schema. The provider-path sanitizer fills a missing items with {type: "string"}, so the model was told batch_update_rows takes a list of strings and sent [] or ["rowId", "data"], which the executor then crashed on (Object.entries(undefined)) and masked as a generic table failure
  • sync the mothership catalog with item schemas on every array param, so the router's Ajv input validation now rejects a malformed call with an error the model can act on. Generated files change by items additions only; the description text Sim already carries is preserved
  • validate updates / rows element shape in the table tool as a last line, with messages naming the bad index and the expected shape
  • match table operation verbs as tokens in tool-call titles, so batch_update_rows renders as "Updating rows" instead of the generic "Editing rows"

Companion: simstudioai/mothership#473

Type of Change

  • Bug fix

Testing

  • vitest across the copilot tool suites (71 files, 1027 tests), including new tests that pin the malformed payloads at both the router and tool layers
  • bun run type-check, bun run lint, bun run check:audits, bun run docs-manifest:check

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The catalog declared updates, rows, order, columnNames, and disabledTagIds
as arrays with no items schema. The provider-path sanitizer fills a missing
items with {type: "string"}, so the model was told batch_update_rows takes a
list of strings and sent [] or ["rowId", "data"]; the executor then crashed
on Object.entries(undefined) and masked it as a generic table failure.

Sync the catalog with item schemas so the router's Ajv validation rejects a
malformed call with an actionable error, validate element shape in the table
tool as a last line, and match operation verbs as tokens in tool-call titles.
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 3, 2026 9:42pm UTC

Request Review

@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • simstudioai/mothership#473OPEN, not merged (targets staging) — fix(tools): declare items on every catalog array parameter

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR strengthens Copilot table-tool contracts and executor validation so malformed array elements produce actionable input errors rather than downstream crashes.

  • Adds item schemas for table, query-order, column-name, and knowledge-tag arrays in both generated schema representations.
  • Validates batch insert and update elements before invoking table services.
  • Classifies compound table operation IDs into more accurate tool-call titles.
  • Adds router-, executor-, and display-level regression tests.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security defects identified.

The added schemas agree with the documented executor contracts, defensive validation prevents malformed elements from reaching table services, and every current catalog operation is classified correctly by the title logic.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/generated/tool-catalog-v1.ts Adds catalog item definitions matching the documented array element contracts.
apps/sim/lib/copilot/generated/tool-schemas-v1.ts Mirrors the item constraints into runtime Ajv schemas so malformed elements are rejected at routing.
apps/sim/lib/copilot/tools/server/table/user-table.ts Adds defensive shape checks for batch row inserts and updates before table-service calls.
apps/sim/lib/copilot/tools/tool-display.ts Matches operation verbs as underscore-delimited tokens, correctly covering existing compound operation IDs.
apps/sim/lib/copilot/tools/server/generated-schema.test.ts Covers runtime schema rejection of malformed update, row, and sort-order array elements.
apps/sim/lib/copilot/tools/server/table/user-table.test.ts Covers executor-level malformed batch payload handling and both supported update formats.
apps/sim/lib/copilot/tools/tool-display.test.ts Covers title classification for representative compound table operations.

Reviews (1): Last reviewed commit: "fix(copilot): declare item schemas on ta..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@icecrasher321
icecrasher321 merged commit c60a128 into staging Sep 3, 2026
32 checks passed
@icecrasher321
icecrasher321 deleted the fix/failed-table-tool-calls branch September 3, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants