feat: add grok harness support#204
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
CodeAnt AI is reviewing your PR. |
|
Too much diff to scan? Review this PR in Change Stack to start with the highest-impact changes. Warning Review limit reached
More reviews will be available in 41 minutes and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR adds comprehensive support for the ChangesGrok Harness Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b5fb12559
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| const args = ['--no-auto-update', '--model', model]; | ||
| if (permissions?.mode) { | ||
| args.push('--permission-mode', permissions.mode); |
There was a problem hiding this comment.
Stop passing Claude permission modes to Grok
When a Grok persona sets permissions.mode, this emits grok --permission-mode <mode>, but the Grok Build docs I checked list --always-approve as the CLI approval flag and describe permission_mode only as a ~/.grok/config.toml setting with ask/always-approve values (headless flags, modes). Since this schema's modes are Claude values such as acceptEdits, bypassPermissions, and plan, those personas will either fail on an unknown/invalid option or fail to enable the intended approval behavior; the non-interactive path also suppresses --always-approve once this flag is present.
Useful? React with 👍 / 👎.
| return { | ||
| bin: 'grok', | ||
| args, | ||
| initialPrompt: null, |
There was a problem hiding this comment.
Preserve the system prompt for Grok sessions
For interactive Grok personas that do not also declare an agentsMd sidecar, the required persona systemPrompt is dropped: the argv only carries model/update flags, configFiles is empty, and initialPrompt is null, so runInteractive has nothing to append or materialize. Grok does read AGENTS.md instruction files from the cwd per xAI's skills/instructions docs, but this branch does not generate one from systemPrompt, so a valid Grok persona with only the required systemPrompt launches as a generic Grok session rather than with the persona's instructions.
Useful? React with 👍 / 👎.
| * when the persona runs under the opencode/codex/grok harnesses. Same resolution | ||
| * rules as {@link claudeMd}. |
There was a problem hiding this comment.
🟠 Architect Review — HIGH
Persona docs and persona-kit now state that AGENTS.md sidecars apply to opencode/codex/grok, but the cloud runtime's sidecarForPersona in packages/runtime/src/cloud-defaults.ts still only materializes AGENTS.md for codex/opencode, so grok personas launched via runtime/cloud flows will silently skip their AGENTS.md sidecar content.
Suggestion: Extend sidecarForPersona in packages/runtime/src/cloud-defaults.ts to treat harness 'grok' like codex/opencode for AGENTS.md, ensuring grok cloud/runtime launches materialize the same sidecar content as CLI interactive launches.
Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.
**Path:** packages/persona-kit/src/types.ts
**Line:** 455:456
**Comment:**
*HIGH: Persona docs and persona-kit now state that AGENTS.md sidecars apply to opencode/codex/grok, but the cloud runtime's sidecarForPersona in packages/runtime/src/cloud-defaults.ts still only materializes AGENTS.md for codex/opencode, so grok personas launched via runtime/cloud flows will silently skip their AGENTS.md sidecar content.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| return []; | ||
| } | ||
| if (harness === 'opencode' || harness === 'codex') { | ||
| if (harness === 'opencode' || harness === 'codex' || harness === 'grok') { |
There was a problem hiding this comment.
Suggestion: This adds Grok to local sidecar planning, but the cloud non-interactive path still only materializes AGENTS.md for codex/opencode (runtime sidecarForPersona excludes grok). That creates an integration mismatch where local Grok runs get AGENTS.md but cloud Grok runs silently lose it. Update the cloud sidecar resolver to include grok so both execution paths behave consistently. [incomplete implementation]
Severity Level: Major ⚠️
- ❌ Cloud Grok runs never materialize AGENTS.md sidecar.
- ⚠️ Grok behavior diverges between CLI and cloud runtime.
- ⚠️ Persona docs/metadata missing in Grok cloud sandboxes.Steps of Reproduction ✅
1. Define a persona with `harness: 'grok'` and AGENTS sidecar content using the persona
schema in `packages/persona-kit/src/types.ts:22-27` and
`packages/persona-kit/src/types.ts:15-21,28-30` (fields `agentsMd`, `agentsMdMode`,
`agentsMdContent` are documented as applying to "opencode/codex/grok" harnesses).
2. Deploy this persona to the cloud and start the runtime via `startRunner` in
`packages/runtime/src/runner.ts:79-120`, which builds the execution context using
`createCloudRuntimeDefaults` (`packages/runtime/src/cloud-defaults.ts:7-38`) and wires
`harnessRunner` to `createProcessHarnessRunner`
(`packages/runtime/src/cloud-defaults.ts:412-417`).
3. Inside your handler, call `await ctx.harness.run({ prompt: '...' })`; `buildCtx` in
`packages/runtime/src/ctx.ts:10-22` binds `ctx.harness.run` to `options.harnessRunner`, so
this call executes the process harness runner created above, which in turn calls
`materializeSidecar` at `packages/runtime/src/cloud-defaults.ts:22-31`.
4. `materializeSidecar` calls `sidecarForPersona`
(`packages/runtime/src/cloud-defaults.ts:44-62`), which only returns an `AGENTS.md`
sidecar when `persona.harness === 'codex' || persona.harness === 'opencode'` (line 55);
for `persona.harness === 'grok'` it returns `undefined`, so no `/workspace/AGENTS.md` is
written in cloud runs, while the local CLI path uses `resolveSidecarWrite` in
`packages/persona-kit/src/plan.ts:139-56` (which explicitly includes `harness === 'grok'`
at line 164) and `writePersonaSidecars` in `packages/persona-kit/src/sidecars.ts:73-91` to
materialize `AGENTS.md`, creating a behavior mismatch between local and cloud Grok
executions.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** packages/persona-kit/src/plan.ts
**Line:** 164:164
**Comment:**
*Incomplete Implementation: This adds Grok to local sidecar planning, but the cloud non-interactive path still only materializes `AGENTS.md` for `codex`/`opencode` (runtime `sidecarForPersona` excludes `grok`). That creates an integration mismatch where local Grok runs get `AGENTS.md` but cloud Grok runs silently lose it. Update the cloud sidecar resolver to include `grok` so both execution paths behave consistently.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
packages/cli/README.md (3)
336-336:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
--filter-harnessallowed values are stale.This line omits
grok, but the rest of the README treats it as a supported harness. Please update the flag value list to includegrok.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/README.md` at line 336, Update the README entry for the --filter-harness flag to include the missing "grok" option in the allowed values list (the line that currently shows `--filter-harness <harness>` with values `claude | codex | opencode`); modify that list to include `grok` so it matches the rest of the documentation that treats "grok" as a supported harness.
1172-1174:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTroubleshooting harness list should include
grok.The “install the harness CLI” list is missing
grok, which can mislead users debugging PATH issues for Grok personas.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/README.md` around lines 1172 - 1174, Update the troubleshooting bullet that lists harness CLIs to include "grok" alongside "claude", "codex", and "opencode" so the message **`Failed to spawn "claude": binary not found on PATH.`** (and similar entries) suggests installing the `grok` CLI when appropriate; edit the README entry to add `grok` to the inline list of CLI names.
783-784:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSandbox-mount scope conflicts with later sections.
This sentence says only
claudeandopencodeuse default mount behavior, but later sections describe default sandboxing for interactive harness sessions broadly (including grok/codex behavior). Please align this section so the mount default is described consistently.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/README.md` around lines 783 - 784, Update the sentence so it consistently describes the default sandbox-mount behavior for all interactive harness sessions rather than only "Interactive `claude` and `opencode` sessions"; edit the phrasing containing "Interactive `claude` and `opencode` sessions run inside a Relayfile mount by default" to state that interactive harness sessions (e.g., `claude`, `opencode`, `grok`, `codex`) run inside a Relayfile mount by default and that file visibility/writability are controlled by the persona's settings; ensure you keep the reference to "Relayfile mount" and the persona-controlled visibility/writability language intact for clarity.packages/persona-kit/src/interactive-spec.ts (1)
326-328:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRefresh pluginDirs warning text to include Grok support.
Line 327 and Line 396 still say plugin dirs are “claude-only”, but this PR adds Grok plugin-dir wiring. That user-facing warning is now inaccurate.
Proposed patch
- 'pluginDirs is currently claude-only; ignoring under the codex harness. Skills must be staged via codex conventions.' + 'pluginDirs is currently supported only for claude and grok; ignoring under the codex harness. Skills must be staged via codex conventions.' ... - 'pluginDirs is currently claude-only; ignoring under the opencode harness. Skills must be staged via opencode conventions.' + 'pluginDirs is currently supported only for claude and grok; ignoring under the opencode harness. Skills must be staged via opencode conventions.'Also applies to: 395-397
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/persona-kit/src/interactive-spec.ts` around lines 326 - 328, Update the user-facing warning pushed into warnings in interactive-spec.ts for pluginDirs to reflect that plugin-dir wiring now supports Grok (not just Claude); change the message used in the warnings.push(...) calls (both occurrences around the pluginDirs check) to mention Grok support and that pluginDirs are still ignored under the codex harness (or whatever harnesss should ignore them) so the warning is accurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/cli/README.md`:
- Line 336: Update the README entry for the --filter-harness flag to include the
missing "grok" option in the allowed values list (the line that currently shows
`--filter-harness <harness>` with values `claude | codex | opencode`); modify
that list to include `grok` so it matches the rest of the documentation that
treats "grok" as a supported harness.
- Around line 1172-1174: Update the troubleshooting bullet that lists harness
CLIs to include "grok" alongside "claude", "codex", and "opencode" so the
message **`Failed to spawn "claude": binary not found on PATH.`** (and similar
entries) suggests installing the `grok` CLI when appropriate; edit the README
entry to add `grok` to the inline list of CLI names.
- Around line 783-784: Update the sentence so it consistently describes the
default sandbox-mount behavior for all interactive harness sessions rather than
only "Interactive `claude` and `opencode` sessions"; edit the phrasing
containing "Interactive `claude` and `opencode` sessions run inside a Relayfile
mount by default" to state that interactive harness sessions (e.g., `claude`,
`opencode`, `grok`, `codex`) run inside a Relayfile mount by default and that
file visibility/writability are controlled by the persona's settings; ensure you
keep the reference to "Relayfile mount" and the persona-controlled
visibility/writability language intact for clarity.
In `@packages/persona-kit/src/interactive-spec.ts`:
- Around line 326-328: Update the user-facing warning pushed into warnings in
interactive-spec.ts for pluginDirs to reflect that plugin-dir wiring now
supports Grok (not just Claude); change the message used in the
warnings.push(...) calls (both occurrences around the pluginDirs check) to
mention Grok support and that pluginDirs are still ignored under the codex
harness (or whatever harnesss should ignore them) so the warning is accurate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 801609a7-98f4-4bb9-9fc8-a67c37b6b0f9
📒 Files selected for processing (14)
packages/cli/README.mdpackages/cli/src/cli.test.tspackages/cli/src/cli.tspackages/cli/src/launch-metadata.test.tspackages/cli/src/launch-metadata.tspackages/persona-kit/schemas/persona.schema.jsonpackages/persona-kit/src/constants.tspackages/persona-kit/src/index.test.tspackages/persona-kit/src/interactive-spec.test.tspackages/persona-kit/src/interactive-spec.tspackages/persona-kit/src/plan.test.tspackages/persona-kit/src/plan.tspackages/persona-kit/src/skills.tspackages/persona-kit/src/types.ts
There was a problem hiding this comment.
3 issues found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/persona-kit/src/interactive-spec.ts">
<violation number="1" location="packages/persona-kit/src/interactive-spec.ts:489">
P2: Grok permission mode is passed through without harness-specific mapping. Shared persona modes can produce unsupported Grok `--permission-mode` values and break or weaken intended approval behavior.</violation>
<violation number="2" location="packages/persona-kit/src/interactive-spec.ts:519">
P1: For interactive Grok sessions, the persona's `systemPrompt` is never passed to the harness: the args only contain model/permission/plugin flags, `initialPrompt` is `null`, and `configFiles` is empty. A Grok persona that declares only the required `systemPrompt` (without an explicit `agentsMd`/`agentsMdContent` sidecar) will launch as a generic Grok session with no persona instructions. Either generate an AGENTS.md from the system prompt, or pass it through another mechanism (e.g., `initialPrompt` or a config file).</violation>
</file>
<file name="packages/persona-kit/src/plan.ts">
<violation number="1" location="packages/persona-kit/src/plan.ts:164">
P2: This adds `grok` to the local sidecar resolution path, but the cloud runtime's `sidecarForPersona` in `packages/runtime/src/cloud-defaults.ts` still only materializes AGENTS.md for `codex`/`opencode`. Cloud Grok runs will silently skip their AGENTS.md sidecar content, creating a behavioral mismatch between local and cloud execution paths. The cloud sidecar resolver should be updated to include `grok`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| return []; | ||
| } | ||
| if (harness === 'opencode' || harness === 'codex') { | ||
| if (harness === 'opencode' || harness === 'codex' || harness === 'grok') { |
There was a problem hiding this comment.
P2: This adds grok to the local sidecar resolution path, but the cloud runtime's sidecarForPersona in packages/runtime/src/cloud-defaults.ts still only materializes AGENTS.md for codex/opencode. Cloud Grok runs will silently skip their AGENTS.md sidecar content, creating a behavioral mismatch between local and cloud execution paths. The cloud sidecar resolver should be updated to include grok.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/persona-kit/src/plan.ts, line 164:
<comment>This adds `grok` to the local sidecar resolution path, but the cloud runtime's `sidecarForPersona` in `packages/runtime/src/cloud-defaults.ts` still only materializes AGENTS.md for `codex`/`opencode`. Cloud Grok runs will silently skip their AGENTS.md sidecar content, creating a behavioral mismatch between local and cloud execution paths. The cloud sidecar resolver should be updated to include `grok`.</comment>
<file context>
@@ -161,7 +161,7 @@ function resolveSidecarWrite(
return [];
}
- if (harness === 'opencode' || harness === 'codex') {
+ if (harness === 'opencode' || harness === 'codex' || harness === 'grok') {
if (selection.agentsMdContent !== undefined) {
return [
</file context>
User description
Summary
Tests
CodeAnt-AI Description
Add Grok harness support across persona launches and skill setup
What Changed
AGENTS.md,.grok/skills, permission mode, and Grok Build’s one-shot launch flowImpact
✅ Launch personas with Grok✅ Keep Grok skill installs out of the real repo✅ Apply AGENTS.md sidecars and permission mode in Grok sessions💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.