feat: fx-style overflow handles, named prefix caps, extra roots - #574
Merged
Conversation
Adapt the four cache-friendly pieces from vercel-labs/fx: - read_tool_result pages a spilled #440 handle (tr_N) by byte range or literal search so one fat bash/codedb hit never re-enters history - --context-limit name=N (and GRAFF_CONTEXT_LIMIT) caps skill_catalog_bytes, mcp_schema_bytes, and agents_md_bytes - mcp_search_tools lists deferred MCP tools without enabling them; mcp_select_tool loads the chosen names. load_tool_schemas stays - --add-dir (max 16) is a PathConfine allow-list, not a cwd switch; extra roots never contribute skills or sessions Tool catalog kernel, SDKs, and ADR 0011 updated. xAI login remains `graff login xai` with grok-4.6 as the default model.
add() copied a slice of a local realPath buffer after it went out of scope, so --add-dir registered garbage and read_file still refused absolute extra-root paths. Live Grok 4.6 caught it: overflow handle tr_0 + NEEDLE=yes, ADDDIR=no. Store the arena-owned realpath instead.
cursor
Bot
force-pushed
the
cursor/fx-adapt-554f
branch
from
August 20, 2026 02:31
fe5b52e to
d368009
Compare
0011 is already prompt-cache max on the 268 line. The overflow / named-limit / extra-root record takes the next free number.
g_seq is per-process. Exclusive create of tr_0.txt failed when a prior graff left the file, so the model saw "No handle could be written" and lost the tail. Retry the next free id.
justrach
marked this pull request as ready for review
August 20, 2026 02:53
This was referenced Aug 20, 2026
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
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.
v0.0.267 is already on main, so this targets a new
release/v0.0.268line.Adapts the four cache-friendly pieces from vercel-labs/fx. ADR 0012 (0011 on this line is prompt-cache max).
What landed
read_tool_result— a fat bash/codedb result still spills at the #440 threshold, now as.graff/tool-results/tr_N.txt. The model pages it withoffset/limitor a literalquery. The full blob does not re-enter history.Named prefix caps —
--context-limit name=NandGRAFF_CONTEXT_LIMITsetskill_catalog_bytes(4 KiB),mcp_schema_bytes(8 KiB), andagents_md_bytes(8 KiB).applynever grows.MCP search-then-select —
mcp_search_toolslists deferred tools and does not enable them.mcp_select_toolloads the chosen names.load_tool_schemasstays for bulk/compat.--add-dir(max 16) — extra file-tool roots. Complementary to theworkspacecwd switch. Extra roots never contribute skills or sessions. Absolute paths under a registered root with no..are PathConfine-legal.Live Grok 4.6 (xAI SuperGrok OAuth)
Rebased onto
release/v0.0.268(832236a) and retested after the handle-collision fix:grok-46-auth-ok· 640 cached · $0tr_0skipped →tr_1→read_tool_result query=NEEDLE_FX_ADAPT→NEEDLE=yes--add-dir /tmp/fx-extra-rootread_fileabsolute path →ADDDIR=yes/FX_ADD_DIR_OK from extra rootFixes along the way:
realDirnowarena.dupes the extra-root realpath (stack buffer was garbage); exclusivetr_Ncreate retries when a prior process left the file.Unit suite 1497 (floor 1486) + leftover-handle test. fmt / 600-line / reach green.
Catalog / SDK
Tool-catalog kernel (64-cell cube), exported JSON, and generated SDKs updated:
read_tool_resultis a local/lean tool; the MCP pair is root meta (hidden while nothing is deferred).