Skip to content

Add ikwid mode for agent autoaproval#47

Merged
nezhar merged 1 commit into
mainfrom
issue-43
Mar 17, 2026
Merged

Add ikwid mode for agent autoaproval#47
nezhar merged 1 commit into
mainfrom
issue-43

Conversation

@nezhar
Copy link
Copy Markdown
Collaborator

@nezhar nezhar commented Mar 17, 2026

This pull request introduces a new --ikwid option to the run command, allowing users to enable an "I Know What I'm Doing" mode that auto-approves or skips permission prompts for supported agents. The implementation includes updates to agent specifications, command handling, and comprehensive tests to ensure correct behavior for both supported and unsupported agents.

New feature: "IKWID" mode support

  • Added the ikwid boolean option to the run command in src/vibepod/commands/run.py, which enables auto-approval/permission skipping for supported agents.
  • Updated the AgentSpec class in src/vibepod/core/agents.py to include an optional ikwid_args field, specifying extra command-line arguments for "IKWID" mode.

Agent specification updates

  • Added ikwid_args for the claude agent (["--dangerously-skip-permissions"]) and for the codex agent (["--full-auto"]). Other agents do not have ikwid_args set, so "IKWID" mode is ignored for them. [1] [2]

Command handling improvements

  • Modified the run command logic to append the appropriate ikwid_args to the agent command when "IKWID" mode is enabled, and to log a warning if the selected agent does not support it.

Implements #43

Summary by CodeRabbit

Release Notes

  • New Features
    • Added --ikwid CLI flag to the run command, enabling auto-approval mode and permission prompt skipping
    • When enabled, automatically applies optimized command configurations for supported agents (claude and codex)
    • Each supported agent receives tailored augmentations for enhanced automation
    • Existing behavior is preserved when the flag is not used or for unsupported agents

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

This PR implements the --ikwid ("I Know What I'm Doing") CLI feature for the run command. When enabled, the feature appends agent-specific permission-skip arguments to the launch command if the agent has preconfigured ikwid_args. Two agents (claude and codex) receive corresponding auto-approval directives. Default behavior remains unchanged when ikwid is disabled.

Changes

Cohort / File(s) Summary
Core Feature Implementation
src/vibepod/commands/run.py, src/vibepod/core/agents.py
Introduces --ikwid CLI flag with conditional logic to append agent-specific ikwid_args to launch commands. AgentSpec dataclass extended with ikwid_args field; claude and codex agents configured with auto-approval arguments.
Test Coverage
tests/test_agents.py, tests/test_run.py
Validates ikwid_args field presence and values for all agents; tests ikwid flag behavior including command augmentation for supported agents, ignoring for unsupported agents, and no modification when flag is disabled.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as run command
    participant AgentSpec
    participant Docker as DockerManager
    
    User->>CLI: invoke with --ikwid=true, agent=claude
    CLI->>AgentSpec: get agent spec for claude
    AgentSpec-->>CLI: return AgentSpec with ikwid_args=["--dangerously-skip-permissions"]
    
    alt ikwid enabled and args exist
        CLI->>CLI: append ikwid_args to launch command
    else ikwid disabled or args missing
        CLI->>CLI: use original command unchanged
    end
    
    CLI->>Docker: launch container with (possibly augmented) command
    Docker-->>User: container running
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related issues

Poem

🐰 A rabbit hops with glee today,
--ikwid flags the way!
"No prompts!" we cry, "We know just right,"
Skip the checks, launch with might!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change—adding an ikwid mode for agent auto-approval—which aligns with the core functionality implemented across the changeset.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-43
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

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

Tip

Flake8 can be used to improve the quality of Python code reviews.

Flake8 is a Python linter that wraps PyFlakes, pycodestyle and Ned Batchelder's McCabe script.

To configure Flake8, add a '.flake8' or 'setup.cfg' file to your project root.

See Flake8 Documentation for more details.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 17, 2026

Greptile Summary

This PR introduces a new --ikwid ("I Know What I'm Doing") flag to the run command that appends agent-specific auto-approval arguments when the user explicitly opts in, with graceful no-op behavior for agents that don't support it. The implementation is clean and follows the existing codebase patterns well.

Key changes:

  • AgentSpec gains an optional ikwid_args: list[str] | None field; claude maps to ["--dangerously-skip-permissions"] and codex to ["--full-auto"]
  • The run command appends ikwid_args after the full command is resolved (including after resolve_launch_command for init-command flows), so ordering is correct
  • Unsupported agents log a warning and continue unmodified — sensible fallback behaviour
  • Test coverage is solid at the spec level (test_agents.py) and for the four main integration paths in test_run.py, though the test helper class is duplicated across all four new tests and the init_commands + ikwid interaction is not covered

Confidence Score: 4/5

  • Safe to merge; the feature is intentionally dangerous by design and is gated behind an explicit opt-in flag
  • The implementation is correct and handles all current edge cases (None command, unsupported agents, command already being a list). The only gaps are minor: test code duplication and no coverage of the init_commands + ikwid combination.
  • tests/test_run.py — duplicated mock helper and missing init_commands+ikwid test case

Important Files Changed

Filename Overview
src/vibepod/commands/run.py Adds --ikwid boolean option and appends spec.ikwid_args to the agent command when enabled; correctly handles None command with list(command or []) and warns for unsupported agents.
src/vibepod/core/agents.py Adds optional ikwid_args field to the frozen AgentSpec dataclass and populates it for claude (--dangerously-skip-permissions) and codex (--full-auto); all other agents leave the field as None.
tests/test_agents.py Adds targeted unit tests verifying ikwid_args values for claude, codex, and all unsupported agents; clean and thorough for the spec layer.
tests/test_run.py Four new integration tests cover the main IKWID paths, but _CapturingDockerManager is duplicated verbatim across all four, and the init_commands + ikwid combination is not tested.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[run command invoked] --> B{ikwid flag set?}
    B -- No --> E[command = spec.command]
    B -- Yes --> C{spec.ikwid_args set?}
    C -- Yes --> D["command = list(command or []) + ikwid_args\ninfo log: IKWID mode appending args"]
    C -- No --> F[warning: IKWID not supported for agent\ncommand unchanged]
    E --> G[run_agent called with command]
    D --> G
    F --> G
Loading

Comments Outside Diff (1)

  1. tests/test_run.py, line 537-716 (link)

    P2 No test for --ikwid combined with init_commands

    The four new tests only exercise IKWID in isolation (no init commands configured). When init_commands is non-empty, the code takes a different branch: command is first replaced by manager.resolve_launch_command(...) and then the ikwid_args are appended. This path is currently untested. An argument can be made that a fifth test covering agents.claude.init = ["pip install foo"] with ikwid=True would confirm that the two features compose correctly (IKWID args appear after the resolved command, and the entrypoint is set independently).

Last reviewed commit: 97a42bb

Comment thread tests/test_run.py
Copy link
Copy Markdown
Contributor

@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)
tests/test_run.py (1)

538-708: Consider extracting shared test fixture to reduce duplication.

The _CapturingDockerManager class is duplicated across these tests and several existing tests in the file. Consider extracting it to a shared fixture or module-level class.

That said, the tests themselves are well-structured and correctly verify all ikwid scenarios:

  • ✓ Appends args for claude
  • ✓ Appends args for codex
  • ✓ Ignores for unsupported agent
  • ✓ No modification when disabled
♻️ Optional: Extract shared capturing manager
# Add at module level (around line 409, near _StubDockerManager)
class _CapturingDockerManager:
    """DockerManager mock that captures run_agent kwargs."""

    def __init__(self) -> None:
        self.captured: dict = {}

    def ensure_network(self, name: str) -> None:
        pass

    def networks_with_running_containers(self) -> list[str]:
        return []

    def pull_image(self, image: str) -> None:
        pass

    def ensure_proxy(self, **kwargs) -> None:  # type: ignore[no-untyped-def]
        pass

    def run_agent(self, **kwargs) -> object:  # type: ignore[no-untyped-def]
        self.captured.update(kwargs)
        return type(
            "_Container",
            (),
            {
                "name": f"vibepod-{kwargs.get('agent', 'test')}-test",
                "id": "abc123",
                "status": "running",
                "attrs": {"NetworkSettings": {"Networks": {}}},
                "reload": lambda self: None,
                "labels": {},
                "logs": lambda self, **kw: b"",
            },
        )()

Then use it in tests:

def test_ikwid_appends_args_for_claude(monkeypatch, tmp_path: Path) -> None:
    """--ikwid appends --dangerously-skip-permissions to claude command."""
    manager = _CapturingDockerManager()
    monkeypatch.setattr(run_cmd, "get_config", lambda: _make_config())
    monkeypatch.setattr(run_cmd, "DockerManager", lambda: manager)

    run_cmd.run(agent="claude", workspace=tmp_path, detach=True, ikwid=True)

    assert manager.captured["command"] == ["claude", "--dangerously-skip-permissions"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_run.py` around lines 538 - 708, Extract the duplicated
_CapturingDockerManager into a module-level class with an instance-level
captured dict (e.g., class _CapturingDockerManager with self.captured),
implement
ensure_network/networks_with_running_containers/pull_image/ensure_proxy as
no-ops and run_agent to self.captured.update(kwargs) and return the fake
container (use kwargs.get("agent") for the name); then in tests
(test_ikwid_appends_args_for_claude, test_ikwid_appends_args_for_codex,
test_ikwid_ignored_for_unsupported_agent,
test_ikwid_false_does_not_modify_command) replace the inner class with manager =
_CapturingDockerManager() and monkeypatch.setattr(run_cmd, "DockerManager",
lambda: manager) and update assertions to check manager.captured["command"]
(instead of the local captured dict).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/test_run.py`:
- Around line 538-708: Extract the duplicated _CapturingDockerManager into a
module-level class with an instance-level captured dict (e.g., class
_CapturingDockerManager with self.captured), implement
ensure_network/networks_with_running_containers/pull_image/ensure_proxy as
no-ops and run_agent to self.captured.update(kwargs) and return the fake
container (use kwargs.get("agent") for the name); then in tests
(test_ikwid_appends_args_for_claude, test_ikwid_appends_args_for_codex,
test_ikwid_ignored_for_unsupported_agent,
test_ikwid_false_does_not_modify_command) replace the inner class with manager =
_CapturingDockerManager() and monkeypatch.setattr(run_cmd, "DockerManager",
lambda: manager) and update assertions to check manager.captured["command"]
(instead of the local captured dict).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08e99d7f-d5f6-4974-ad3e-047d664b09df

📥 Commits

Reviewing files that changed from the base of the PR and between 6cb5897 and 97a42bb.

📒 Files selected for processing (4)
  • src/vibepod/commands/run.py
  • src/vibepod/core/agents.py
  • tests/test_agents.py
  • tests/test_run.py

@nezhar nezhar merged commit c7fb101 into main Mar 17, 2026
20 checks passed
@nezhar nezhar deleted the issue-43 branch March 20, 2026 13:54
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.

1 participant