Skip to content

feat: fx-style overflow handles, named prefix caps, extra roots - #574

Merged
justrach merged 4 commits into
release/v0.0.268from
cursor/fx-adapt-554f
Aug 20, 2026
Merged

feat: fx-style overflow handles, named prefix caps, extra roots#574
justrach merged 4 commits into
release/v0.0.268from
cursor/fx-adapt-554f

Conversation

@justrach

@justrach justrach commented Aug 19, 2026

Copy link
Copy Markdown
Owner

v0.0.267 is already on main, so this targets a new release/v0.0.268 line.

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 with offset/limit or a literal query. The full blob does not re-enter history.

Named prefix caps--context-limit name=N and GRAFF_CONTEXT_LIMIT set skill_catalog_bytes (4 KiB), mcp_schema_bytes (8 KiB), and agents_md_bytes (8 KiB). apply never grows.

MCP search-then-selectmcp_search_tools lists deferred tools and does not enable them. mcp_select_tool loads the chosen names. load_tool_schemas stays for bulk/compat.

--add-dir (max 16) — extra file-tool roots. Complementary to the workspace cwd 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:

check result
Auth ping grok-46-auth-ok · 640 cached · $0
Overflow leftover tr_0 skipped → tr_1read_tool_result query=NEEDLE_FX_ADAPTNEEDLE=yes
--add-dir /tmp/fx-extra-root read_file absolute path → ADDDIR=yes / FX_ADD_DIR_OK from extra root

Fixes along the way: realDir now arena.dupes the extra-root realpath (stack buffer was garbage); exclusive tr_N create 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_result is a local/lean tool; the MCP pair is root meta (hidden while nothing is deferred).

Open in Web Open in Cursor 

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
cursor Bot force-pushed the cursor/fx-adapt-554f branch from fe5b52e to d368009 Compare August 20, 2026 02:31
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
justrach marked this pull request as ready for review August 20, 2026 02:53
@justrach
justrach merged commit 9eca9ef into release/v0.0.268 Aug 20, 2026
6 checks passed
@justrach
justrach deleted the cursor/fx-adapt-554f branch August 20, 2026 02:53
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.

2 participants