Skip to content

feat(persona-kit): suppress codex 'are you sure?' via single bypass flag#86

Merged
khaliqgant merged 3 commits into
mainfrom
feat/codex-bypass-approvals-flag
May 11, 2026
Merged

feat(persona-kit): suppress codex 'are you sure?' via single bypass flag#86
khaliqgant merged 3 commits into
mainfrom
feat/codex-bypass-approvals-flag

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Adds dangerouslyBypassApprovalsAndSandbox?: boolean to HarnessSettings. When set, the codex spec emits the single --dangerously-bypass-approvals-and-sandbox flag instead of the --sandbox danger-full-access + --ask-for-approval never pair. The two-flag form still trips codex's interactive "are you sure?" startup prompt; the combined flag suppresses it.
  • Parse-time mutual exclusion with sandboxMode / approvalPolicy / workspaceWriteNetworkAccess so personas can't half-set both shapes.
  • hasCodexLaunchSettings updated so claude/opencode runtimes still warn when a persona carries the new field.

Persona shape:

"harnessSettings": {
  "reasoning": "high",
  "timeoutSeconds": 600,
  "dangerouslyBypassApprovalsAndSandbox": true
}

Test plan

  • pnpm -r typecheck
  • pnpm -r test (persona-kit + cli + workload-router + agentworkforce all green)
  • New unit tests cover: spec emits the single flag; parse rejects each conflicting field; parse rejects a non-boolean value.

🤖 Generated with Claude Code

…ttings

The two-flag form (--sandbox danger-full-access + --ask-for-approval never)
still trips codex's interactive "are you sure?" startup confirmation. The
combined --dangerously-bypass-approvals-and-sandbox flag suppresses it.

Expose it as a first-class HarnessSettings field, mutually exclusive with
sandboxMode / approvalPolicy / workspaceWriteNetworkAccess at parse time so
personas cannot half-set both shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1aad5319-8374-4d5c-b9ed-e914e4db0108

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb0eab and a86e842.

📒 Files selected for processing (1)
  • packages/persona-kit/src/parse.test.ts

📝 Walkthrough

Walkthrough

Adds dangerouslyBypassApprovalsAndSandbox to HarnessSettings, validates it (boolean, mutually exclusive with other sandbox/approval settings), updates Codex harness argument generation to emit a single combined flag, and adds tests covering parsing and emitted args.

Codex Bypass Approvals and Sandbox Option

Layer / File(s) Summary
Type Definition
packages/persona-kit/src/types.ts
Adds dangerouslyBypassApprovalsAndSandbox?: boolean to HarnessSettings with documentation describing the emitted Codex CLI flag and mutual-exclusion constraints.
Parsing and Validation
packages/persona-kit/src/parse.ts, packages/persona-kit/src/parse.test.ts
parseHarnessSettings now reads and validates the new boolean field and rejects co-declaration with sandboxMode, approvalPolicy, or workspaceWriteNetworkAccess. Tests cover acceptance when alone, conflict errors (true/false), and type errors.
Codex Harness Integration
packages/persona-kit/src/interactive-spec.ts, packages/persona-kit/src/interactive-spec.test.ts
hasCodexLaunchSettings recognizes the new option; buildInteractiveSpec emits a single combined --dangerously-bypass-approvals-and-sandbox argument (skipping per-setting flags) and still emits -m and --search when appropriate. Tests assert emitted argv.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • AgentWorkforce/workforce#85: Modifies buildInteractiveSpec’s Codex argument generation; related to flag emission changes.
  • AgentWorkforce/workforce#73: Touches the same persona-kit files (types/parse/interactive-spec) and related HarnessSettings parsing/translation.
  • AgentWorkforce/workforce#53: Also threads Codex harnessSettings through parsing/types and buildInteractiveSpec to produce Codex launch args.

Poem

🐰 I’m a rabbit in the code, so spry,
One flag to hush the sandbox cry,
It keeps the model and adds still search,
Tests hop through each guarded perch,
Cheers for one tidy CLI tie.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: introducing a way to suppress Codex's interactive 'are you sure?' prompt via a single bypass flag, which aligns with the primary feature added across all modified files.
Description check ✅ Passed The description is directly related to the changeset, detailing the new HarnessSettings field, its behavior, mutual exclusions, and test coverage—all present in the file modifications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/codex-bypass-approvals-flag

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning messages for claude/opencode omit newly added dangerouslyBypassApprovalsAndSandbox setting

The hasCodexLaunchSettings() function at packages/persona-kit/src/interactive-spec.ts:83-92 now detects dangerouslyBypassApprovalsAndSandbox, but the warning messages emitted by the claude (line 233) and opencode (line 303) branches still enumerate only the original four settings: sandboxMode, approvalPolicy, workspaceWriteNetworkAccess, and webSearch. If a persona sets only dangerouslyBypassApprovalsAndSandbox: true with a non-codex harness, the trigger fires but the warning names settings the user never set, making it confusing rather than helpful.

(Refers to line 233)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning message for opencode omit newly added dangerouslyBypassApprovalsAndSandbox setting

Same issue as the claude branch: the opencode warning at line 303 lists the four original codex-only settings but not the newly added dangerouslyBypassApprovalsAndSandbox. This triggers when hasCodexLaunchSettings() returns true due to the new field, producing a misleading warning.

(Refers to line 303)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/persona-kit/src/interactive-spec.ts (1)

83-91: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Codex-only warning logic misses explicit bypass-field presence and warning text is incomplete.

hasCodexLaunchSettings only treats the new field as set when truthy, so an explicitly provided false won’t trigger claude/opencode warnings. Also, the warning message should name this field too.

Proposed fix
 function hasCodexLaunchSettings(settings: HarnessSettings | undefined): boolean {
   if (!settings) return false;
   return Boolean(
     settings.sandboxMode ||
       settings.approvalPolicy ||
       settings.workspaceWriteNetworkAccess !== undefined ||
       settings.webSearch ||
-      settings.dangerouslyBypassApprovalsAndSandbox
+      settings.dangerouslyBypassApprovalsAndSandbox !== undefined
   );
 }
- 'persona declares codex-only harnessSettings but the claude harness ignores sandboxMode, approvalPolicy, workspaceWriteNetworkAccess, and webSearch.'
+ 'persona declares codex-only harnessSettings but the claude harness ignores sandboxMode, approvalPolicy, workspaceWriteNetworkAccess, webSearch, and dangerouslyBypassApprovalsAndSandbox.'
- 'persona declares codex-only harnessSettings but the opencode harness ignores sandboxMode, approvalPolicy, workspaceWriteNetworkAccess, and webSearch.'
+ 'persona declares codex-only harnessSettings but the opencode harness ignores sandboxMode, approvalPolicy, workspaceWriteNetworkAccess, webSearch, and dangerouslyBypassApprovalsAndSandbox.'

Also applies to: 232-234, 302-304

🤖 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 83 - 91,
hasCodexLaunchSettings currently treats dangerouslyBypassApprovalsAndSandbox
only when truthy so an explicit false is ignored; update the predicate in
hasCodexLaunchSettings to treat dangerouslyBypassApprovalsAndSandbox as
"present" when !== undefined (same approach used for
workspaceWriteNetworkAccess) and update the corresponding warning text locations
(the other checks noted around the second and third occurrences) to explicitly
mention "dangerouslyBypassApprovalsAndSandbox" in their messages so callers see
that this field (whether true or false) was provided.
🧹 Nitpick comments (1)
packages/persona-kit/src/parse.test.ts (1)

198-224: ⚡ Quick win

Add a regression test for explicit false with conflicting legacy fields.

Given the exclusivity contract is shape-based, it’s worth locking this with a dangerouslyBypassApprovalsAndSandbox: false conflict test too.

Suggested test addition
+test('parseHarnessSettings rejects dangerouslyBypassApprovalsAndSandbox:false with conflicting fields', () => {
+  assert.throws(
+    () =>
+      parseHarnessSettings(
+        {
+          reasoning: 'high',
+          timeoutSeconds: 60,
+          dangerouslyBypassApprovalsAndSandbox: false,
+          sandboxMode: 'workspace-write'
+        },
+        'rt'
+      ),
+    /mutually exclusive with: .*sandboxMode/
+  );
+});
🤖 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/parse.test.ts` around lines 198 - 224, Add a
regression test to ensure parseHarnessSettings treats an explicitly-present
dangerouslyBypassApprovalsAndSandbox: false as conflicting with legacy fields
(shape-based exclusivity). Mirror the existing test 'parseHarnessSettings
rejects dangerouslyBypassApprovalsAndSandbox with conflicting fields' but set
dangerouslyBypassApprovalsAndSandbox to false and assert that
parseHarnessSettings(overlay, 'rt') throws with a RegExp containing the
conflicting field (use the same conflict loop over 'sandboxMode',
'approvalPolicy', 'workspaceWriteNetworkAccess' and the same error pattern).
This keeps the check tied to the parseHarnessSettings behavior and covers the
explicit-false case.
🤖 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.

Inline comments:
In `@packages/persona-kit/src/parse.ts`:
- Around line 136-150: The code currently only checks for conflicts with
sandboxMode/approvalPolicy/workspaceWriteNetworkAccess when
dangerouslyBypassApprovalsAndSandbox is true; change it so that as soon as
dangerouslyBypassApprovalsAndSandbox is present (after the type check) you
validate mutual exclusion regardless of its boolean value: inside the existing
block that handles dangerouslyBypassApprovalsAndSandbox !== undefined (and after
verifying it's a boolean), collect conflicts into the conflicts array using
sandboxMode, approvalPolicy, and workspaceWriteNetworkAccess and throw the same
Error(`${context}.dangerouslyBypassApprovalsAndSandbox is mutually exclusive
with: ...`) if conflicts.length > 0; keep the type check and no other behavior
changes.

---

Outside diff comments:
In `@packages/persona-kit/src/interactive-spec.ts`:
- Around line 83-91: hasCodexLaunchSettings currently treats
dangerouslyBypassApprovalsAndSandbox only when truthy so an explicit false is
ignored; update the predicate in hasCodexLaunchSettings to treat
dangerouslyBypassApprovalsAndSandbox as "present" when !== undefined (same
approach used for workspaceWriteNetworkAccess) and update the corresponding
warning text locations (the other checks noted around the second and third
occurrences) to explicitly mention "dangerouslyBypassApprovalsAndSandbox" in
their messages so callers see that this field (whether true or false) was
provided.

---

Nitpick comments:
In `@packages/persona-kit/src/parse.test.ts`:
- Around line 198-224: Add a regression test to ensure parseHarnessSettings
treats an explicitly-present dangerouslyBypassApprovalsAndSandbox: false as
conflicting with legacy fields (shape-based exclusivity). Mirror the existing
test 'parseHarnessSettings rejects dangerouslyBypassApprovalsAndSandbox with
conflicting fields' but set dangerouslyBypassApprovalsAndSandbox to false and
assert that parseHarnessSettings(overlay, 'rt') throws with a RegExp containing
the conflicting field (use the same conflict loop over 'sandboxMode',
'approvalPolicy', 'workspaceWriteNetworkAccess' and the same error pattern).
This keeps the check tied to the parseHarnessSettings behavior and covers the
explicit-false case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68c8ae76-48dc-49ba-aa51-e54ce4b69230

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5bb04 and c7e74b0.

📒 Files selected for processing (5)
  • packages/persona-kit/src/interactive-spec.test.ts
  • packages/persona-kit/src/interactive-spec.ts
  • packages/persona-kit/src/parse.test.ts
  • packages/persona-kit/src/parse.ts
  • packages/persona-kit/src/types.ts

Comment thread packages/persona-kit/src/parse.ts
Address feedback on #86:

- hasCodexLaunchSettings now treats an explicit `false` as "field present"
  via !== undefined, matching workspaceWriteNetworkAccess's shape semantics.
- Claude and opencode warning enumerations name the new field so the
  message lines up with what the predicate actually detects.
- parseHarnessSettings enforces mutual exclusion whenever the field is
  present, not only when true — co-declaring the two-flag fields with
  an explicit `false` was still a contradictory shape.
- New regression test covers the explicit-false conflict path.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/persona-kit/src/parse.test.ts (1)

186-196: ⚡ Quick win

Add an explicit happy-path assertion for dangerouslyBypassApprovalsAndSandbox: false.

Given the recent semantic change around field presence, it’s worth locking in that false alone parses and is preserved in output.

Proposed test update
-test('parseHarnessSettings accepts dangerouslyBypassApprovalsAndSandbox alone', () => {
-  const ok = parseHarnessSettings(
-    {
-      reasoning: 'high',
-      timeoutSeconds: 60,
-      dangerouslyBypassApprovalsAndSandbox: true
-    },
-    'rt'
-  );
-  assert.equal(ok.dangerouslyBypassApprovalsAndSandbox, true);
-});
+test('parseHarnessSettings accepts dangerouslyBypassApprovalsAndSandbox alone', () => {
+  for (const value of [true, false]) {
+    const ok = parseHarnessSettings(
+      {
+        reasoning: 'high',
+        timeoutSeconds: 60,
+        dangerouslyBypassApprovalsAndSandbox: value
+      },
+      'rt'
+    );
+    assert.equal(ok.dangerouslyBypassApprovalsAndSandbox, value);
+  }
+});
🤖 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/parse.test.ts` around lines 186 - 196, Add a second
happy-path unit test to ensure parseHarnessSettings preserves an explicit false
value for dangerouslyBypassApprovalsAndSandbox: call parseHarnessSettings with
dangerouslyBypassApprovalsAndSandbox: false (same other fields as the existing
test) and assert that the returned object's dangerouslyBypassApprovalsAndSandbox
=== false; use a clear test name like "parseHarnessSettings accepts
dangerouslyBypassApprovalsAndSandbox false" and reference the same
parseHarnessSettings helper used in the current test so the change validates the
new semantic that explicit false is preserved.
🤖 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.

Nitpick comments:
In `@packages/persona-kit/src/parse.test.ts`:
- Around line 186-196: Add a second happy-path unit test to ensure
parseHarnessSettings preserves an explicit false value for
dangerouslyBypassApprovalsAndSandbox: call parseHarnessSettings with
dangerouslyBypassApprovalsAndSandbox: false (same other fields as the existing
test) and assert that the returned object's dangerouslyBypassApprovalsAndSandbox
=== false; use a clear test name like "parseHarnessSettings accepts
dangerouslyBypassApprovalsAndSandbox false" and reference the same
parseHarnessSettings helper used in the current test so the change validates the
new semantic that explicit false is preserved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab54203d-e51d-442d-9444-fbabfc333254

📥 Commits

Reviewing files that changed from the base of the PR and between c7e74b0 and 9fb0eab.

📒 Files selected for processing (3)
  • packages/persona-kit/src/interactive-spec.ts
  • packages/persona-kit/src/parse.test.ts
  • packages/persona-kit/src/parse.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/persona-kit/src/interactive-spec.ts

Lock in that `dangerouslyBypassApprovalsAndSandbox: false` parses and is
preserved on output, matching the field-presence semantics introduced in
9fb0eab. Addresses PR #86 review feedback.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@khaliqgant khaliqgant merged commit 0fd4a94 into main May 11, 2026
2 checks passed
@khaliqgant khaliqgant deleted the feat/codex-bypass-approvals-flag branch May 11, 2026 20:48
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