Skip to content

fix(agent-tools): give the payload-read fixtures the cutAttributeBytes column - #1169

Closed
JeremyFunk wants to merge 2 commits into
mainfrom
fix/agent-tools-test-after-payload-cap
Closed

JeremyFunk wants to merge 2 commits into
mainfrom
fix/agent-tools-test-after-payload-cap

Conversation

@JeremyFunk

@JeremyFunk JeremyFunk commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Main is red since #1148 (run 36651793700), which blocked the prod deploy (run 36652303690).

  • fix(agent-sessions): decode tool-error payloads the way the session page does #1148's last commit added cutAttributeBytes to aiToolErrorPayloadsRowSchema. Two fixtures that answer the payload read still returned rows without it, so decoding failed with "Compiled query row 0 did not match its declared output schema":
    • apps/ai/src/mcp/tools/__tests__/agent-tools.test.ts (6 tests, lane small-2)
    • apps/api/src/routes/internal/ai-sessions.http.test.ts (1 test, lane small-1)
  • The fix adds cutAttributeBytes: {} to both fixtures. None of their values goes over AI_TOOL_ERROR_ATTRIBUTE_MAX (16 384), so the real query would return an empty map too. The schema is unchanged.
  • No other fixture answers this read. The backend tests and the ClickHouse e2e test run the real query.

Tests: agent-tools.test.ts (19/19), ai-sessions.http.test.ts (49/49), ai-tools.test.ts (42/42).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Tests
    • Updated test payload fixtures to include the cutAttributeBytes field.

…s column

#1148's last commit added cutAttributeBytes to aiToolErrorPayloadsRowSchema,
but the MCP and internal-API fixtures that answer the payload read still
returned rows without it, so every decode failed the row schema.
@maple-review-bot

maple-review-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 5/5 · safe to merge
Both fixtures now carry the field the schema requires, and each value stays under AI_TOOL_ERROR_ATTRIBUTE_MAX (16 384), so the empty map is what the real read returns.
quality 100/100 · no findings · tests not needed · risk low

Adds cutAttributeBytes: {} to the two test fixtures that answer the aiToolErrorPayloadsQuery read, so their rows decode against aiToolErrorPayloadsRowSchema again. Test-only, safe to merge.

  • payload in agent-tools.test.ts now returns cutAttributeBytes: {}
  • The aiToolsErrorPayloads fixture row in ai-sessions.http.test.ts carries cutAttributeBytes: {}
What was checked
  • AI_TOOL_ERROR_ATTRIBUTE_MAX = 16_384 and AI_TOOL_ERROR_PAYLOAD_MAX = 4_000 (ai-tools.ts:634,642); the 12 000-byte LONG_ARGUMENTS fixture is display-cut but not attribute-cut, so {} is faithful
  • aiToolErrorPayload only reads the map to override the utf8.encode fallback (ai-tools.ts:1063), so an empty map leaves the asserted argumentsBytes/resultBytes unchanged
  • Every fixture answering this read: the trace_detail_spans rules in agent-tools.test.ts:167,194 and the single aiToolsErrorPayloads row; the e2e and backend tests run the real query

b255373 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 40f77005-8859-4172-b45f-1f0665c92771

📥 Commits

Reviewing files that changed from the base of the PR and between 671e80a and b255373.

📒 Files selected for processing (2)
  • apps/ai/src/mcp/tools/__tests__/agent-tools.test.ts
  • apps/api/src/routes/internal/ai-sessions.http.test.ts

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


📝 Walkthrough

Walkthrough

Two test payload fixtures now include an empty cutAttributeBytes field. No other changes are described.

Changes

Payload fixture updates

Layer / File(s) Summary
Add cutAttributeBytes to test fixtures
apps/ai/src/mcp/tools/__tests__/agent-tools.test.ts, apps/api/src/routes/internal/ai-sessions.http.test.ts
Both test payload fixtures include an empty cutAttributeBytes field.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: makisuo

Merge Risk: ⚪ Minimal · up to b2553

These fixture updates do not change runtime behavior, and byte-count fallback coverage remains in place. No actionable merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the missing cutAttributeBytes column to payload-read fixtures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JeremyFunk JeremyFunk closed this Sep 30, 2026
@maple-review-bot

maple-review-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Maple review

Nothing to review

The PR adds cutAttributeBytes: {} to two agent-tool payload fixtures, but main already contains that fix (via #1171/#1172), so the merge head has no net change. Nothing to review; safe to close.

What was checked
  • git diff --stat main..head is empty, so the PR changes no file against its base
  • Base main already has cutAttributeBytes: {} at agent-tools.test.ts:161 and ai-sessions.http.test.ts:1676

2187377 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

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