Repository navigation
fix(table): apply filter and sort builder rules pinned on agent tool rows - #10083
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[High impact] The PR appears safe to merge. SummaryThe PR makes saved Table builder rules apply to agent tool calls and stops failed Table mappings from falling back to raw arguments.
Reviews (5) · Last reviewed commit: "fix(agent): keep rejected argument value..." · Reviewed by Greptile |
|
@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 review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…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.
659044a to
bb14912
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
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.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
Agent tool rows store Table
filterBuilder/bulkFilterBuilder/sortBuildervalues as JSON text (StoredTool.paramsis a string map), buttools/param-shape.tsdecodedfilter-builderandsort-builderas plain strings. On a tool call:resolveFilterparsed the string into builder rules and handed them tovalidatePredicateShape, which threw.prepareToolExecutionthen ran the tool on the raw merged params, so the model's ownfilterreplaced the user's pinned filter.order([{id, column, direction}]).filterRulesToFilterreceived a string, built nothing, and pinned builder rules were ignored.Changes
tools/param-shape.ts:filter-builderandsort-builderdecode as JSON, matching what the builders store.providers/utils.tsbuildBlockToolParamsTransform: 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.ToolCallParamsError(providers/tool-params-error.ts) plusfailToolCallOnError(blocks/utils.ts). On a tool call, a Table mapper failure becomes this error.prepareToolExecutionand 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)
Test plan
providers/utils.test.ts("Table builder rules pinned on an agent tool row"): realtransformBlockTool→prepareToolExecutionwith the real Table blocks and tools.search-replace/replacements.test.ts: replacing a value inside a tool row's serialized filter builder still works (red without the guard).🤖 Generated with Claude Code