Skip to content

fix: rebuild tool catalog after wide-native rlm showcase - #655

Closed
justrach wants to merge 2 commits into
mainfrom
cursor/rlm-empty-tools-4ffc
Closed

fix: rebuild tool catalog after wide-native rlm showcase#655
justrach wants to merge 2 commits into
mainfrom
cursor/rlm-empty-tools-4ffc

Conversation

@justrach

@justrach justrach commented Aug 28, 2026

Copy link
Copy Markdown
Owner

ADR 0030 showcased rlm after a 4-wide native read_file/codedb/bash/webfetch batch and only invalidated the cached catalog. The next xAI Responses request read toolsJson() == "" and writeOpenAITools printed the empty slice after the field name, so the body was "tools":,. xAI 400'd: Failed to parse the request body as JSON: tools: expected value.

That is why the grok-build rematch on latest 280 went 3/5 on the rlm suite (scatter-sum, multi-read). Both tasks did four parallel reads, showcased rlm, then died on the follow-up call. SWE stayed 5/6 because those tasks never hit a 4-wide native batch.

Fix

  • noticeWideNativeAndRefresh invalidates and rebuilds (same as #492 load-native).
  • runTurn calls ensureRootTools before every toolsJson() read, so any mid-turn invalidate cannot ship an empty catalog.
  • writeOpenAITools("") writes [] instead of a missing JSON value.

Comments for later agents (follow-up commit): call sites + ADR 0030 now name the 2026-08-28 rematch 400 and say not to revert this to invalidate-only. SWE hid the bug; the rlm suite is what catches it.

Tests

  • FakeAgent: a 4-wide batch rebuilds once; a 3-wide batch does not.
  • Empty catalog serializes as [].
  • Suite 1725 (was 1723 on main). +2 tests.

Live rematch SuperGrok OAuth, grok-4.6, grok-build 1.0.5, graff-dev:

SWE (cookie-store retry after one SIGABRT): 5/6 vs 5/6, graff 259s / 9.4M / 158k vs grok 330s / 156M / 120k. Both miss label-sort.

RLM: 5/5 vs 5/5, graff 46s / 8.6M / 70k vs grok 120s / 160M / 54k.

Core (new): shared 11 tasks 11/11 vs 11/11, graff 89s / 9.1M / 144k vs grok 141s / 156M / 111k. schema-output is graff-only (grok has no --output-schema); graff missed it this rep (stdout was pulse chrome, not JSON).

Cherry-pick onto 280: #656.

Tier 1: fmt/lines/reach/build/tests/sdk green. test-tui-hover.py flaked in the parallel pool, then passed solo.

Open in Web Open in Cursor 

ADR 0030 showcased rlm after a 4-wide read/bash batch and only
invalidated the cached catalog. The next xAI Responses body was
`"tools":,` (empty toolsJson printed after the field), so scatter-sum
and multi-read 400'd mid-turn. Rebuild on showcase, ensure before
every request, and write [] for an empty catalog so that shape cannot
reach the wire.
@justrach
justrach marked this pull request as ready for review August 28, 2026 02:05
Invalidate-only after a 4-wide native batch shipped `"tools":,` and
xAI 400'd the rlm rematch. Comments at the call sites plus ADR 0030
name the failure so this does not get "simplified" back.
@justrach

Copy link
Copy Markdown
Owner Author

Already on main via 281 (catalog rebuild after wide-native rlm showcase). Closing as superseded.

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