-
Notifications
You must be signed in to change notification settings - Fork 10
feat(llm-builtin): improve cell link serialization with @link format and any-schema handling #2092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seefeldb
merged 4 commits into
main
from
feat/llm-friendly-link-for-any-on-deserialization
Nov 17, 2025
Merged
feat(llm-builtin): improve cell link serialization with @link format and any-schema handling #2092
seefeldb
merged 4 commits into
main
from
feat/llm-friendly-link-for-any-on-deserialization
Nov 17, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…and any-schema handling - Use `@link` format instead of `/` for cell link serialization to LLM tools - Add `@arrayEntry` decorator for array elements that reference cells - Handle `any` schema types by converting to cell links when appropriate - Add base64 validation to prevent false positive link detection - Add timeout handling for tool calls (30s timeout) - Refactor chatbot.tsx to use patternTool helper for listMentionable - Fix schema.ts to properly copy values before annotation to avoid mutations
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 5 files
Prompt for AI agents (all 3 issues)
Understand the root cause of the following 3 issues and fix them.
<file name="packages/runner/src/schema.ts">
<violation number="1" location="packages/runner/src/schema.ts:840">
When cloning the record before annotation, you also need to update the freshly pushed `seen` entry to point at the cloned value; otherwise future reads will return the outdated original object and lose the back-to-cell annotations.</violation>
</file>
<file name="packages/runner/src/builtins/llm-dialog.ts">
<violation number="1" location="packages/runner/src/builtins/llm-dialog.ts:1427">
handleRead now returns `{ type: "json", value: serialized }` even when the cell value is `undefined`, so the tool response sends `{ value: undefined }`, which is not valid JSON and violates Anthropic's tool_result contract.</violation>
<violation number="2" location="packages/runner/src/builtins/llm-dialog.ts:1541">
`clearTimeout(timeout)` and `cancel()` aren’t wrapped in a `finally`, so any rejected tool call (including timeouts) leaves the timeout and result sink running, leaking resources and risking multiple resolves.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
This reverts the base64 validation and stricter link detection changes in link-utils.ts and link-utils.test.ts to align with the main branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1. Fix seen cache tracking for cloned objects in validateAndTransform - Push cloned value to seen cache instead of original value - Ensures future circular reference checks return properly annotated objects 2. Handle undefined cell values in handleRead tool - Convert undefined to null (valid JSON) to comply with Anthropic's tool_result contract - Prevents invalid JSON responses when cell values are undefined 3. Prevent resource leaks in tool call execution - Wrap cleanup code (clearTimeout/cancel) in finally block - Ensures resources are freed even when tool calls timeout or reject 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@linkformat instead of/for cell link serialization to LLM tools@arrayEntrydecorator for array elements that reference cellsanyschema types by converting to cell links when appropriateSummary by cubic
Switches LLM tool serialization to the new "@link" format with smarter handling for any-schema and array entries to make responses clearer and safer. Adds tool call timeouts and includes schema in read responses.
New Features
Bug Fixes
Written for commit fb06802. Summary will update automatically on new commits.