Skip to content

feat: auto-verify, ToolInputDelta preview, fallback provider#40

Merged
kienbui1995 merged 1 commit intomainfrom
feat/agentic-gaps
Apr 12, 2026
Merged

feat: auto-verify, ToolInputDelta preview, fallback provider#40
kienbui1995 merged 1 commit intomainfrom
feat/agentic-gaps

Conversation

@kienbui1995
Copy link
Copy Markdown
Owner

@kienbui1995 kienbui1995 commented Apr 12, 2026

3 agentic gaps closed:

  1. Auto-verify after write — syntax check py/json after edits, errors fed back to LLM for self-healing
  2. ToolInputDelta preview — forward streaming tool input to TUI (was silently dropped)
  3. FallbackProvider — config fallback_provider/fallback_model now wired

192 tests pass.

Summary by CodeRabbit

  • New Features
    • Fallback provider support: Configure a secondary provider to automatically switch to when the primary provider is unavailable
    • Auto-verification after file writes: Automatic syntax validation for Python and JSON files with inline error reporting when issues are detected

1. Auto-verify: syntax check py/json files after write tools
   - Errors injected into context for self-healing
   - Runs before auto_test_cmd (lightweight, always on)

2. ToolInputDelta: forward to TUI for real-time write preview
   - Was swallowed in runtime, now forwarded via on_event
   - TUI already handles it (shows streaming edit content)

3. FallbackProvider: wrap primary+fallback providers
   - Config: fallback_provider + fallback_model
   - Wired in main.rs provider creation
   - Struct ready for full stream-level failover

192 tests pass.
@kienbui1995 kienbui1995 merged commit 7357b0f into main Apr 12, 2026
4 of 5 checks passed
@kienbui1995 kienbui1995 deleted the feat/agentic-gaps branch April 12, 2026 15:25
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a7fece0c-5732-4af0-8a6d-4daee948390d

📥 Commits

Reviewing files that changed from the base of the PR and between 510f409 and 92e2fb1.

📒 Files selected for processing (3)
  • mc/crates/mc-cli/src/main.rs
  • mc/crates/mc-cli/src/provider.rs
  • mc/crates/mc-core/src/runtime.rs

📝 Walkthrough

Walkthrough

The pull request introduces a fallback provider infrastructure in the CLI that wraps a primary provider with an optional fallback, along with an auto-verification step in the runtime that runs syntax checks on Python and JSON files after write operations. Event handling is updated to forward ToolInputDelta events downstream.

Changes

Cohort / File(s) Summary
Fallback Provider Infrastructure
mc/crates/mc-cli/src/main.rs, mc/crates/mc-cli/src/provider.rs
Added conditional fallback provider initialization in main and created a new FallbackProvider struct that wraps primary and fallback providers. The wrapper currently delegates all stream calls to the primary provider.
Auto-Verify & Event Handling
mc/crates/mc-core/src/runtime.rs
Added post-execution syntax verification for Python and JSON files after write operations, pushing error messages to the conversation on validation failure. Modified event handling to forward ToolInputDelta events instead of ignoring them.

Sequence Diagram

sequenceDiagram
    participant Provider as LLM Provider
    participant Runtime as Runtime
    participant Tools as Tool Executor
    participant Shell as Shell/Syntax Checker
    participant Events as Event System

    Provider->>Runtime: Stream write tool response
    Runtime->>Tools: Execute write_file/edit_file/batch_edit/apply_patch
    Tools->>Tools: Collect target file paths from tool_use blocks
    Runtime->>Shell: Run syntax check (ast.parse for .py, json.load for .json)
    alt Syntax Valid
        Shell-->>Runtime: Exit code 0
    else Syntax Error
        Shell-->>Runtime: Exit code non-zero + stderr
        Runtime->>Events: Push user message with error details
        Runtime->>Events: Emit ToolOutputDelta warning
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 bounces excitedly
When providers stumble, backups spring!
Syntax checked with careful hop,
Errors caught before they plop—
Quality code, clean as can be! 🌿

✨ 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/agentic-gaps

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

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