#23803: Fix tool metadata truncation
agents
size: XS
Cluster:
Tool Execution and Error Handling
## Summary
- *Problem:* Tool call metadata (like file paths in `edit`/`write` or URLs in `web_fetch`) was being truncated to a hardcoded 160 characters.
- *Why it matters:* Modern development environments often have deep directory structures. Truncating these paths breaks the UI display and can cause `JSON parse errors` in providers like Gemini (Cloud Code Assist) that attempt to reconstruct tool calls from these summaries.
- *What changed:* Increased the default `maxStringChars` limit in `coerceDisplayValue` from 160 to 1024.
- *What did NOT change:* No logic changes to tool execution, security guards, or core schemas.
## Change Type
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [x] Integrations
- [ ] API / contracts
- [x] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #23622
## User-visible / Behavior Changes
None. (UI will simply show longer, complete paths in tool summaries instead of cutting them off).
## Security Impact
- New permissions/capabilities? (`No`)
- Secrets/tokens handling changed? (`No`)
- New/changed network calls? (`No`)
- Command/tool execution surface changed? (`No`)
- Data access scope changed? (`No`)
## Repro + Verification
### Environment
- OS: macOS (Darwin 25.2.0)
- Runtime: Node v22.17.0
- Model/provider: google-antigravity / gemini-3-flash
- Integration/channel: N/A
### Steps
1. Call the `edit` tool with a `path` argument longer than 160 characters.
2. Check the generated `meta` or `detail` string in the session.
3. Verify if the string is complete or cut off at 160 chars.
### Expected
- Path should be preserved up to 1024 characters.
### Actual
- Path was truncated at 160 characters (e.g., `README.m, ` instead of `README.md`).
## Evidence
- [x] Failing test/log before + passing after: Verified that metadata is now complete for long paths.
- [x] All Unit Tests passed: `pnpm test src/agents/tool-display.test.ts` (20 passed).
## Human Verification
- *Verified scenarios:* Manually verified `edit` and `write` tool metadata with paths > 200 characters.
- *Edge cases checked:* Verified that this does not impact `exec` which has its own truncation logic.
- *What you did not verify:* Paths exceeding 1024 characters.
## Compatibility / Migration
- Backward compatible? (`Yes`)
- Config/env changes? (`No`)
- Migration needed? (`No`)
## Failure Recovery
- How to disable/revert this change quickly: Revert the change in `src/agents/tool-display-common.ts`.
- Files/config to restore: `src/agents/tool-display-common.ts`.
## Risks and Mitigations
- *Risk:* None. (Metadata display only).
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Increases tool call metadata truncation limit from 160 to 1024 characters in `coerceDisplayValue()` to fix path truncation issues. This change addresses JSON parse errors in providers like Gemini that reconstruct tool calls from summaries, and improves UI display for deep directory structures. Also includes restoration of `@larksuiteoapi/node-sdk` dependency from commit 9487d7f2.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a single-line constant update that increases a display truncation limit from 160 to 1024 characters. It's non-breaking, backward compatible, affects display-only metadata, has no security implications, and tests pass. The change solves a real problem (truncated paths causing JSON parse errors) with a reasonable solution.
- No files require special attention
<sub>Last reviewed commit: 6aadc3f</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8888: fix: increase tool result/error context limits
by joetomasone · 2026-02-04
82.1%
#10189: fix: resolve file_path param in tool display for read/write tools
by Yida-Dev · 2026-02-06
80.0%
#19632: fix: suppressToolErrors now suppresses exec tool failure notifications
by Gitjay11 · 2026-02-18
79.7%
#9861: fix(agents): re-run tool_use/tool_result repair after limitHistoryT...
by CyberSinister · 2026-02-05
79.5%
#11274: fix(tools): truncate overly long tool names for API compatibility
by avirweb · 2026-02-07
79.5%
#22214: fix(tools): sanitize google-antigravity schemas for Gemini-compatib...
by Kansodata · 2026-02-20
78.7%
#3647: fix: sanitize tool arguments in session history
by nhangen · 2026-01-29
77.6%
#19094: Fix empty tool_call_id and function names in provider transcript pa...
by yxshee · 2026-02-17
77.5%
#5057: fix: add per-tool-result hard cap to prevent context overflow
by hanxiao · 2026-01-31
77.4%
#10915: fix: prevent session bloat from oversized tool results and improve ...
by DukeDeSouth · 2026-02-07
77.0%