Repository navigation
fix(blocks): read the mapper operation from the tool-call context and ratchet raw reads - #10070
Conversation
… ratchet raw reads A block's tools.config.params mapper gets the operation only as context.operation on a tool call (Agent tool rows, Pi, Human v2), so branches on params.operation take the no-operation path there. Add mapperOperation(params, context), move the mappers that already fell back to context onto it, and add check:mapper-operation, a per-file ratchet over the remaining raw reads (505 in 173 files) so they can only shrink.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge, with one non-blocking audit issue. Findings
SummaryThe PR adds
Reviews (4) · Last reviewed commit: "fix(audits): follow local copies when de..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
Turn on auto-fix | Re-trigger cubic
…per results, and shadowed names in check:mapper-operation; drop _operation strips
|
@greptile review |
|
@cubic-dev-ai review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…only helper results that carry their input
|
@greptile review |
|
@cubic-dev-ai review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@greptile review |
|
@cubic-dev-ai review |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Summary
When an Agent calls a block-backed tool (and likewise Pi and Human-in-the-loop v2), the block's
tools.config.paramsmapper receives the stored tool row's params plus the model's args. The operation arrives only ascontext.operation, because a stored tool row keeps its operation outside its params. A mapper that branches onparams.operationtherefore runs its no-operation path on every tool call.On staging that causes real failures:
labels: "bug, urgent"as a string, which fails validation.Invalid operation: undefined, so the tool gets unmerged raw params.Injecting the operation centrally would make branches live that have never run on the agent path, and some of them overwrite model args (Jira comment
body, GitLabsearch/orderBy, Slackedit_canvas). So the fix is per block, and this PR adds the guard rail for that work:mapperOperation(params, context)in@/blocks/utilsreads the trusted context first and falls back to the canvas input. Context comes first because six tools declare their ownoperationparam (Slackedit_canvas), which the model fills with a tool value.check:mapper-operationis a per-file ratchet, built on the TypeScript AST, over raw reads of the operation inside mappers. It catches property and element access, aliases, rest bindings, used destructured bindings, and same-file helpers. Strip-only destructuring is exempt. The baseline is 505 reads in 173 files and can only shrink. Follow-up PRs fix those mappers one family at a time, each with a review of the branches that become live.Test plan
scripts/check-mapper-operation.test.tscovers each read form and each exemption.bun run check:mapper-operationpasses against the generated baseline.🤖 Generated with Claude Code