feat(grok): add Grok Build adapter (hooks, settings, session parse/tail, upstream pin) - #3
Open
darko-mijic wants to merge 16 commits into
Open
feat(grok): add Grok Build adapter (hooks, settings, session parse/tail, upstream pin)#3darko-mijic wants to merge 16 commits into
darko-mijic wants to merge 16 commits into
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
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.
What
Adds Grok Build as a second supported agent harness, alongside Claude:
src/grok/): envelope types + Zod validation for the 15 accepted wire values (14 wire events + legacysubagent_end),GrokHookOutputBuilder(gate allow/deny; stop block/approve/force-stop/additionalContext), and theexecuteGrokHookrunner with Grok's fail-open exit semantics (Grok-local stdin reader — zeroCLAUDE_*config coupling).config.rs.src/grok/processing/): discovery (GROK_HOME ?? ~/.grok, URL-encoded cwd with blake3 slug fallback >255B), parsers forupdates.jsonl(ACP + xAIsessionUpdateunions, known/unknown/invalid tag-peek — unknown variants never fatal) andevents.jsonl(~60-variant Event union), a bounded JSONL cursor, checkpointed two-source tailing (revisioned markers, per-source reset events, manual/automatic commit modes), and a Grok-native upsert/delete change model with rewind support.e5fd4816/ SOURCE_REVea094a8cunderdocs/upstream/grok/(Apache-2.0 NOTICE), drift tests that re-parse the vendored Rust on every run, andscripts/sync-upstream-grok.mjs --checkas the drift alarm.@libar-dev/agent-harness-kit/grokand/grok/processingsubpath exports; root"."and all Claude exports byte-identical.docs/reference/grok-adapter.md— event/envelope/stdout contracts, settings semantics, session layout, pin/drift policy, and the Grok-vs-Claude incompatibility matrix.What it deliberately does NOT do
Attach-only: it does not start or drive Grok sessions. No Claude-to-Grok translator, no 30-event parity, no mcp_tool/prompt/agent handlers, no ask/defer/updatedInput outputs (Grok ignores them), no new CLI bins, no edits to existing Claude modules (
src/types,src/validation,src/utils,src/processingbyte-clean).Verification
pnpm run test:runexit 0 — 1710/1710 (56 files), including 168 new Grok testspnpm run type-check,pnpm run lint,pnpm run build— all exit 0~/.groksession (11,682 records) is byte-identical across runs with 0 invalid lines;sync-upstream-grok.mjs --checkexit 06a08ff3) are fixed by it; zero product-surface impactDecisions to sanity-check
> target_prompt_index) per the approved plan; upstreamreplay.rsimplements rewind-before-N (>= N). Documented indocs/reference/grok-adapter.md.GrokHookEventName.length === 15, drift-test pinned).@noble/hashes(audited, ESM, zero deps) for >255-byte cwd slugs — decision recorded indocs/upstream/grok/pin.jsonnotes.Greptile Summary
This PR adds the Grok adapter, including hook handling, session processing, public exports, documentation, and upstream contract checks. The previously reported stale tool-state behavior was exercised with status-only and kind-only updates: the current reducer updates the existing tool-use block and keeps terminal tool-use and tool-result states aligned.
Confidence Score: 5/5
Safe to merge: no blocking failure remains.
No blocking failure remains. Direct reducer and filesystem tailing checks confirmed that incremental terminal tool updates preserve consistent normalized state.
What T-Rex did
Reviews (2): Last reviewed commit: "fix(grok): merge tool_call_update status..." | Re-trigger Greptile