Skip to content

[Phase 2.5-F] Switch default engine to react and update documentation (#355)#388

Merged
frankbria merged 2 commits intomainfrom
feature/issue-355-switch-default-react
Feb 16, 2026
Merged

[Phase 2.5-F] Switch default engine to react and update documentation (#355)#388
frankbria merged 2 commits intomainfrom
feature/issue-355-switch-default-react

Conversation

@frankbria
Copy link
Owner

@frankbria frankbria commented Feb 16, 2026

Summary

  • Switches default execution engine from "plan" to "react" (ReAct) across all 9 code locations (runtime, CLI, API, conductor)
  • Updates CLAUDE.md with ReAct agent architecture documentation, dual execution flow diagrams, and engine selection table
  • Adds Phase 2.5 section to V2_STRATEGIC_ROADMAP.md marking it complete
  • Updates AGENT_V3_UNIFIED_PLAN.md status to "Implemented"
  • Updates all tests that asserted "plan" as default to expect "react"

Acceptance Criteria

  • Default engine changed to "react" in runtime.py
  • CLI help text updated to reflect new default
  • --engine plan still available as fallback
  • CLAUDE.md updated: architecture, execution flow, commands, Phase 2.5
  • docs/V2_STRATEGIC_ROADMAP.md updated: Phase 2.5 marked complete
  • docs/AGENT_V3_UNIFIED_PLAN.md status updated to "Implemented"
  • All existing tests pass with react as default (1855 v2 tests)
  • Smoke test: cf work start <task-id> --execute (no --engine flag) uses ReactAgent

Test plan

  • uv run pytest -m v2 -q — 1855 passed
  • uv run ruff check — all checks passed
  • Engine integration tests updated and passing (90 tests)
  • Plan-engine CLI tests use explicit --engine plan flag
  • Runtime/streaming tests mock ReactAgent instead of Agent

Closes #355

Summary by CodeRabbit

  • New Features

    • ReAct agent is now the default execution engine with seven built-in tools and a new fuzzy search-and-replace editor.
  • Documentation

    • Updated architecture, roadmap, and agent docs to describe ReAct (default) and legacy Plan flows; added Phase 2.5 guidance.
  • Chores

    • Default engine switched to ReAct across CLI, API, runtime, and examples; legacy Plan remains available via --engine plan.
  • Tests

    • Test suites updated to reflect ReAct as the default engine.

Switch the default execution engine from "plan" to "react" (ReAct)
across CLI, API, and runtime layers. Update all documentation to
reflect the new default and mark Phase 2.5 as complete.

Closes #355
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Walkthrough

Switches the default execution engine from "plan" to "react" across CLI, API, runtime, conductor, docs, and tests; adds React-centric modules (react_agent, tools, editor) and updates documentation/roadmap to mark ReAct as the default while preserving --engine plan fallback.

Changes

Cohort / File(s) Summary
Core: React agent & tools
codeframe/core/react_agent.py, codeframe/core/tools.py, codeframe/core/editor.py
New ReAct-centric modules added: default ReactAgent implementation, tool definitions, and a fuzzy editor component.
Runtime & Conductor
codeframe/core/runtime.py, codeframe/core/conductor.py
Default engine changed from "plan" to "react" in execute_agent, BatchRun.engine, and start_batch/subprocess execution paths.
CLI
codeframe/cli/app.py
CLI command defaults for work_start and batch_run switched default --engine to react; help text and examples updated; engine display logic adjusted to hide react when default.
API / UI routes
codeframe/ui/routers/tasks_v2.py
Request models and endpoint query defaults changed to react (ApproveTasksRequest, StartExecutionRequest, start_single_task param); descriptions updated to mark plan as legacy.
Documentation & Roadmap
CLAUDE.md, docs/AGENT_V3_UNIFIED_PLAN.md, docs/V2_STRATEGIC_ROADMAP.md
Docs updated to declare ReAct as default, add Phase 2.5 deliverables/status, and document new React-focused modules and flows.
Tests
tests/cli/test_v2_cli_integration.py, tests/core/test_agent_streaming.py, tests/core/test_react_engine_integration.py, tests/integration/test_tasks_v2_engine.py
Tests updated to expect react default: mocks now target ReactAgent, assertions use AgentStatus.COMPLETED, CLI tests add explicit --engine plan where needed, and default-engine expectations adjusted.
Public API docs / metadata
CLAUDE.md, README-like artifacts
Project status/date updates and public-facing entity descriptions adjusted to reflect ReAct-default architecture and preserved legacy Plan option.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hopping through the code with cheer,
ReAct is now the path we steer.
Tools and editors join the run,
Plan stays as fallback, never done.
I nibble bugs and carrot-dream—hello, React! 🎉

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: switching the default engine to react and updating documentation, which aligns with the primary objective.
Linked Issues check ✅ Passed The PR fulfills all acceptance criteria: engine defaults changed across runtime/CLI/API, --engine plan remains available, CLAUDE.md and roadmap updated, documentation status set to Implemented, tests passing with react default.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #355 requirements. Test updates reflect the new default engine, documentation updates are comprehensive and in-scope.
Docstring Coverage ✅ Passed Docstring coverage is 96.43% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/issue-355-switch-default-react

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

@claude
Copy link

claude bot commented Feb 16, 2026

Code Review: PR #388 - Switch Default Engine to ReAct

✅ Overall Assessment

This PR successfully completes Phase 2.5 by switching the default execution engine from plan to react across all relevant code locations. The implementation is clean, consistent, and well-documented.


🎯 Strengths

  1. Comprehensive Coverage: All 9 critical locations updated consistently:

    • runtime.py (default parameter)
    • cli/app.py (work start & batch run)
    • conductor.py (BatchRun class & start_batch)
    • ui/routers/tasks_v2.py (3 API endpoints)
  2. Documentation Excellence:

    • CLAUDE.md now includes dual execution flow diagrams (ReAct vs Plan)
    • Engine selection table clearly documents use cases
    • Phase 2.5 properly documented in roadmap with completion status
    • Component table updated to highlight ReAct architecture
  3. Backward Compatibility Preserved:

    • --engine plan flag still available as fallback
    • All tests updated to explicitly use --engine plan where needed
    • Legacy agent code untouched and functional
  4. Test Coverage:

    • 1855 v2 tests passing with new default
    • Integration tests properly mocked for ReactAgent
    • Test assertions updated from "plan" to "react" in 27 locations
    • Plan engine tests explicitly specify --engine plan

🔍 Code Quality Observations

Consistency ✅

All help text updates follow the same pattern:

  • Before: 'plan' (default)
  • After: 'react' (default, ReAct loop) or 'plan' (legacy step-based)

Test Updates ✅

Mock patches correctly updated:

# Old: @patch("codeframe.core.agent.Agent")
# New: @patch("codeframe.core.react_agent.ReactAgent")

Return value mocking properly adjusted:

# ReactAgent.run() returns AgentStatus, not AgentState
mock_agent.run.return_value = AgentStatus.COMPLETED  # ✅ Correct

Documentation Updates ✅

  • Phase 2.5 section added to roadmap with motivation and key decisions
  • AGENT_V3_UNIFIED_PLAN.md status changed to "Implemented"
  • Examples updated to reflect new defaults

🚨 Potential Issues

None identified. This PR is ready to merge.


💡 Recommendations (Post-Merge)

  1. Monitor Production Usage: Track --engine plan usage to identify if any workflows still prefer the legacy engine

  2. Deprecation Timeline: Consider documenting when/if --engine plan will be removed (or if it stays indefinitely as a fallback)

  3. Performance Metrics: Compare ReAct vs Plan performance in production to validate the switch

    • Iteration counts
    • Success rates
    • Token consumption
  4. Documentation Cleanup: The CLAUDE.md header still shows Last updated: 2026-02-03 but should be 2026-02-15 to match Phase 2.5 completion


📋 Checklist Verification

All acceptance criteria met:

  • ✅ Default engine changed to "react" in runtime.py
  • ✅ CLI help text updated
  • --engine plan fallback available
  • ✅ CLAUDE.md updated with architecture docs
  • ✅ V2_STRATEGIC_ROADMAP.md Phase 2.5 marked complete
  • ✅ AGENT_V3_UNIFIED_PLAN.md status updated
  • ✅ All 1855 v2 tests pass
  • ✅ Smoke test verified (ReactAgent is default)

🎉 Conclusion

LGTM - Recommend Merge

This PR delivers exactly what Phase 2.5 promised: switching to ReAct as the default while preserving backward compatibility. The documentation updates are comprehensive and the test coverage validates the change thoroughly.

Great work maintaining consistency across 11 files and 90+ test assertions! 🚀

@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Feb 16, 2026

Set ReAct as the default engine across CLI, API, runtime, and batch execution, and update docs to reflect Phase 2.5 completion

Switch default engine from plan to react in CLI options, API request models, runtime execution, batch scheduling, and subprocess construction; update tests to pin legacy plan where needed; refresh docs and CLI help to document ReAct defaults and Phase 2.5 status.

📍Where to Start

Start with the CLI engine switch in work_start and batch_run handlers in app.py, then follow engine propagation through runtime in runtime.py and batch orchestration in conductor.py.


Macroscope summarized 373b419.

Copy link
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.

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 (2)
codeframe/cli/app.py (1)

1996-2060: ⚠️ Potential issue | 🟡 Minor

Update engine label logic to reflect the new default.

engine_mode currently hides the label only when engine == "plan" (Line 2059), so the new default "react" always prints while legacy "plan" does not. Consider flipping the condition to hide the default and surface explicit legacy selection.

Suggested adjustment
-            engine_mode = f" [dim](engine={engine})[/dim]" if engine != "plan" else ""
+            engine_mode = f" [dim](engine={engine})[/dim]" if engine != "react" else ""
CLAUDE.md (1)

248-301: ⚠️ Potential issue | 🟡 Minor

Add languages to the fenced code blocks (markdownlint MD040).
This will satisfy the lint rule and improve rendering in some viewers.

🔧 Suggested fix
-```
+```text
 cf work start <id> --execute [--verbose]
     │
     ├── runtime.start_task_run()      # Creates run, transitions task→IN_PROGRESS
     │
     └── runtime.execute_agent(engine="react")
@@
-```
+```

@@
-```
+```text
 cf work start <id> --execute --engine plan
     │
     ├── runtime.start_task_run()
     │
     └── runtime.execute_agent(engine="plan")
@@
-```
+```
🤖 Fix all issues with AI agents
In `@docs/V2_STRATEGIC_ROADMAP.md`:
- Around line 370-374: The Phase 2 summary row in the roadmap table (the row
with "Phase 2" / "Server Layer") conflicts with the earlier "90% complete" text;
update the table row status to reflect remaining work (e.g., change the Status
cell from "✅ **COMPLETE**" to "⚠️ **90% COMPLETE**" or "In progress — WebSocket,
OpenAPI, pagination") or alternatively update the earlier "90% complete" section
to mark Phase 2 as complete; ensure the change references the "Phase 2" /
"Server Layer" row and mentions the outstanding items WebSocket, OpenAPI, and
pagination so the two places are consistent.

- Fix engine_mode label to hide default "react" instead of "plan"
- Add language annotations to execution flow code blocks in CLAUDE.md
- Update CLAUDE.md last-updated date to 2026-02-15
- Reconcile Phase 2 status in V2_STRATEGIC_ROADMAP.md (now ✅ COMPLETE)
- Update test assertion to match new default engine label behavior
@claude
Copy link

claude bot commented Feb 16, 2026

Code Review - PR #388: Switch Default Engine to ReAct

Summary

This PR successfully completes Phase 2.5 by switching the default execution engine from plan to react across the entire codebase. The implementation is clean, consistent, and production-ready.


✅ Strengths

1. Comprehensive and Consistent Changes

  • All 9 critical locations updated uniformly:
    • runtime.py default parameter (engine="react")
    • cli/app.py work start & batch run commands
    • conductor.py BatchRun class & start_batch function
    • ui/routers/tasks_v2.py 3 API request models
  • Help text consistently updated: 'react' (default, ReAct loop) or 'plan' (legacy step-based)

2. Excellent Documentation Updates

  • CLAUDE.md now includes:
    • Dual execution flow diagrams (ReAct vs Plan) with clear visual distinction
    • Engine selection table documenting use cases
    • Updated component table highlighting ReAct architecture (react_agent.py, tools.py, editor.py)
    • Phase 2.5 completion status
  • docs/V2_STRATEGIC_ROADMAP.md properly documents Phase 2.5 with motivation and key decisions
  • docs/AGENT_V3_UNIFIED_PLAN.md status changed to "✅ Implemented"

3. Backward Compatibility Preserved

  • --engine plan flag explicitly available as fallback
  • Legacy agent code remains functional
  • No breaking changes for existing integrations

4. Thorough Test Coverage

  • 1855 v2 tests passing with new default
  • 90+ test assertions updated from "plan" to "react"
  • Integration tests properly mock ReactAgent instead of Agent
  • Plan engine tests explicitly use --engine plan flag
  • Test documentation updated (e.g., test_execute_creates_file docstring)

5. Smart Console Output

  • Engine label hidden for default (react), shown only for legacy (plan)
  • Keeps CLI output clean while surfacing intentional engine selection

🔍 Code Quality Observations

Consistency ✅
All parameter defaults, help text, and docstrings follow identical patterns across CLI, API, and core modules.

Test Updates ✅

  • Mock patches correctly updated: @patch("codeframe.core.react_agent.ReactAgent")
  • Return value mocking properly adjusted: AgentStatus.COMPLETED (not AgentState)
  • Test names updated to reflect new defaults: test_subprocess_default_engine_is_react

Documentation ✅

  • Phase 2.5 section comprehensively documents motivation (config overwrites, cross-file inconsistency, accumulated errors)
  • Key architecture decisions documented (search-replace editing, read-before-write, lint-after-every-change)
  • Reference docs linked (AGENT_V3_UNIFIED_PLAN.md, REACT_AGENT_ARCHITECTURE.md)

📋 All Acceptance Criteria Met

  • ✅ Default engine changed to "react" in runtime.py
  • ✅ CLI help text updated for both commands
  • --engine plan available as fallback
  • ✅ CLAUDE.md updated with architecture, execution flows, commands, Phase 2.5
  • ✅ V2_STRATEGIC_ROADMAP.md Phase 2.5 marked complete
  • ✅ AGENT_V3_UNIFIED_PLAN.md status updated to "Implemented"
  • ✅ All 1855 v2 tests pass
  • ✅ Smoke test verified (ReactAgent is default)

💡 Minor Observations (Non-Blocking)

1. Date Consistency
The PR updates CLAUDE.md to Last updated: 2026-02-15 which matches the Phase 2.5 completion date. ✅

2. CodeRabbit's Suggestion on engine_mode Label
CodeRabbit suggested flipping the label logic in app.py:2059:

engine_mode = f" [dim](engine={engine})[/dim]" if engine != "react" else ""

This is already implemented correctly in the PR! The code hides the default (react) and surfaces legacy (plan). ✅

3. Roadmap Table Status
The Phase 2 row in the roadmap table shows "✅ COMPLETE" which matches the earlier "✅ COMPLETE" text. No conflict exists. ✅


🚨 Issues Found

None. This PR is ready to merge.


🎯 Recommendation

✅ APPROVE - Ready to Merge

This PR is exemplary in its execution:

  • Comprehensive: All code paths updated consistently
  • Well-documented: Both user-facing docs and implementation references
  • Well-tested: 1855 tests passing, proper mocking, updated assertions
  • Backward compatible: Legacy engine preserved as --engine plan
  • Clean commits: Single focused change achieving Phase 2.5 objective

The switch to ReAct as default is a significant architectural improvement, and this implementation ensures a smooth transition with zero breaking changes.

Great work! 🚀


Post-Merge Recommendations

  1. Monitor --engine plan usage in production to identify workflows that prefer legacy execution
  2. Track ReAct performance metrics: iteration counts, success rates, token consumption vs plan engine
  3. Document deprecation timeline (if any) for --engine plan in future releases
  4. Consider Phase 3: Web UI should expose engine selection in task execution UI

Copy link
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.

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)
CLAUDE.md (1)

489-497: ⚠️ Potential issue | 🟡 Minor

Verify OpenAPI completion status matches the roadmap.
This section marks OpenAPI docs as complete, but the roadmap still lists OpenAPI as open/partial. Please align the two documents to avoid mixed signals.

🤖 Fix all issues with AI agents
In `@CLAUDE.md`:
- Around line 34-41: The document is inconsistent: the "What's Working Now"
section mentions "up to 5 attempts" while the "Agent Self-Correction &
Observability" section still says "3 retries"; update the latter so both places
match (change the text in the "Agent Self-Correction & Observability" section
from "3 retries" to "up to 5 attempts" or vice versa if you prefer 3), ensuring
the phrases "up to 5 attempts" and "Agent Self-Correction & Observability" are
consistent across the file.

Comment on lines +34 to +41
## Current Reality (Phase 1, 2 & 2.5 Complete)

### What's Working Now
- **Full agent execution**: `cf work start <task-id> --execute`
- **Full agent execution**: `cf work start <task-id> --execute` (uses ReAct engine by default)
- **Engine selection**: `--engine react` (default) or `--engine plan` (legacy)
- **Verbose mode**: `cf work start <task-id> --execute --verbose` shows detailed progress
- **Dry run mode**: `cf work start <task-id> --execute --dry-run`
- **Self-correction loop**: Agent automatically fixes failing verification gates (up to 3 attempts)
- **Self-correction loop**: Agent automatically fixes failing verification gates (up to 5 attempts with ReAct)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align self-correction retry count across the doc.
Line 41 says “up to 5 attempts,” but the later “Agent Self-Correction & Observability” section still states 3 retries. Please reconcile the count in one place or the other.

🤖 Prompt for AI Agents
In `@CLAUDE.md` around lines 34 - 41, The document is inconsistent: the "What's
Working Now" section mentions "up to 5 attempts" while the "Agent
Self-Correction & Observability" section still says "3 retries"; update the
latter so both places match (change the text in the "Agent Self-Correction &
Observability" section from "3 retries" to "up to 5 attempts" or vice versa if
you prefer 3), ensuring the phrases "up to 5 attempts" and "Agent
Self-Correction & Observability" are consistent across the file.

@frankbria frankbria merged commit bd05c0e into main Feb 16, 2026
14 checks passed
@frankbria frankbria deleted the feature/issue-355-switch-default-react branch February 16, 2026 15:25
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.

[Phase 2.5-F] Switch default engine to react and update documentation

1 participant