Skip to content

fix(table): apply filter and sort builder rules pinned on agent tool rows - #10083

Merged
waleedlatif1 merged 4 commits into
stagingfrom
sweep3/table-builder
Nov 16, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
sweep3/table-builder

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Agent tool rows store Table filterBuilder / bulkFilterBuilder / sortBuilder values as JSON text (StoredTool.params is a string map), but tools/param-shape.ts decoded filter-builder and sort-builder as plain strings. On a tool call:

  • Table v2 bulk update/delete and query: resolveFilter parsed the string into builder rules and handed them to validatePredicateShape, which threw. prepareToolExecution then ran the tool on the raw merged params, so the model's own filter replaced the user's pinned filter.
  • Table v2 sort: the parsed sort rules went out unconverted as order ([{id, column, direction}]).
  • Table v1: filterRulesToFilter received a string, built nothing, and pinned builder rules were ignored.
  • Tool-row UI: the builders only render an array, so a saved tool row showed no rules after a remount, and the next edit overwrote them.

Changes

  • tools/param-shape.ts: filter-builder and sort-builder decode as JSON, matching what the builders store.
  • providers/utils.ts buildBlockToolParamsTransform: the active canonical member is now chosen from decoded values, as the canvas sees them. An emptied builder is stored as '[]', which used to read as filled and hid the model's filter for the advanced member. The value that is taken and the decode after the collapse are unchanged.
  • New ToolCallParamsError (providers/tool-params-error.ts) plus failToolCallOnError (blocks/utils.ts). On a tool call, a Table mapper failure becomes this error. prepareToolExecution and Pi local tools rethrow it rather than falling back to raw params, so the model gets a failed tool call instead of a bulk operation running on its own filter. The canvas has no context and rethrows the original error unchanged.
  • search-replace/json-value-fields.ts: tool-row builder params stay raw text for search/replace, because the replacer has no path into a stringified rule array. This keeps today's behavior.

Canvas behavior is unchanged for every Table v1 and v2 operation: canvas builder values already arrive as arrays, and none of the changed code runs without a tool-call context.

Known limitations (unchanged, out of scope)

  • On a v2 tool row that the user explicitly toggled back to the builder, an emptied builder still drops the model's filter. This matches the canvas's strict canonical mode. Bulk ops then fail closed with "Filter is required".
  • Human-in-the-loop v2 notification tools still fall back to raw params on a mapper failure. No model arguments are involved there.

Test plan

  • providers/utils.test.ts ("Table builder rules pinned on an agent tool row"): real transformBlockTool → prepareToolExecution with the real Table blocks and tools.
    • Pinned v2 filter on update/delete beats the model filter.
    • An emptied builder lets the model filter through.
    • An unparseable pinned builder fails the call.
    • A v2 sort builder becomes a sort spec.
    • The v1 bulk and query builders apply.
    • Reverting each guard turns its test red.
  • search-replace/replacements.test.ts: replacing a value inside a tool row's serialized filter builder still works (red without the guard).
  • Ran the touched suites: providers/utils, param-shape, table, table_v2, search-replace, pi/local, conversation-continuation.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 16, 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 Nov 16, 2026 6:12am UTC

Request Review

@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 10 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge.

Summary

The PR makes saved Table builder rules apply to agent tool calls and stops failed Table mappings from falling back to raw arguments.

  • Table agent tools apply the filter and sort rules pinned on their rows.
  • Table tool calls stop when their parameters cannot be mapped safely.
  • Search and replace edits values inside serialized Table builder rules.

Reviews (5) · Last reviewed commit: "fix(agent): keep rejected argument value..." · Reviewed by Greptile

Comment thread apps/sim/blocks/blocks/table.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 10 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 14 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

…rows

Agent tool rows store filter-builder and sort-builder values as JSON text, but
the tool param decoder treated both as plain strings. Table v2 then threw on the
parsed rules and the tool ran on the raw params with the model's own filter in
place of the pinned one (bulk update/delete included); sort rules went out
unconverted, and Table v1 ignored pinned builder rules entirely.

- decode filter-builder and sort-builder values as JSON
- pick the active canonical member from decoded values, so an emptied builder
  ('[]') no longer hides the model's filter
- ToolCallParamsError: Table mapper failures on a tool call fail the call
  instead of falling back to raw params (agent and Pi local tools)
- keep tool-row builder rules as raw text for search/replace
A pinned v1 builder value that does not decode to an array iterated as a string,
built nothing, and fell back to the model's filter. On a tool call it now fails
the call; an empty rule list keeps its model fallback. Also types the new test
helper params.
… params

A pending-call retry now records a ToolCallParamsError as a failed tool call
instead of aborting the continuation (other preparation refusals still abort),
and a Human-in-the-loop v2 notification whose mapper rejects its params is
skipped rather than sent with raw params.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 14 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/providers/utils.ts Resolved
ToolCallParamsError reaches the model before tool-result secret redaction, and a
mapper's message can quote the value it rejected after a {{SECRET}} placeholder
was resolved. The model now gets a static message; the original error stays on
cause for server logs.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 14 files

Confidence score: 5/5

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit cef1b65 into staging Nov 16, 2026
81 checks passed
@waleedlatif1
waleedlatif1 deleted the sweep3/table-builder branch November 16, 2026 06:23

This branch was previously deployed

1 inactive deployment
Preview — 0359367a Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant