Skip to content

Conversation

@mohd-talib0
Copy link

@mohd-talib0 mohd-talib0 commented Nov 24, 2025

feat(orchestrator): implement plan approval workflow with feedback loop

Add comprehensive plan review system allowing users to control task execution
before agents begin work. Plans now require explicit user approval.

Plan Approval Features:

  • Users can approve plans to start execution ("Approve & Run")
  • Users can request modifications via text feedback ("Request Changes")
  • Users can cancel plans gracefully ("Cancel Run")
  • Feedback loop regenerates plan with AI incorporating user input
  • Maximum 5 regeneration attempts to prevent infinite loops
  • Plan display is read-only (modifications only via feedback)

Step-by-Step Approval:

  • Optional checkbox: "Require approval before each web action"
  • Optional checkbox: "Require approval before each coding step"
  • Individual step approval/rejection with optional notes

Graceful Cancellation:

  • Add UserCancellationError custom exception
  • Display friendly message: "Task cancelled by user. No changes were made."
  • No Python tracebacks shown to users

Backend Changes:

  • orchestrator_agent.py:
    • Add UserCancellationError exception class
    • Extend orchestrator_deps with approval state fields
    • Add _request_plan_approval() for plan approval handling
    • Add _ensure_step_approval() for step-level approvals
    • Modify plan_task with approval loop and retry logic
    • Update system prompt with plan execution guidelines
  • instructor.py:
    • Import and handle UserCancellationError
    • Return friendly cancellation message
  • stream_response_format.py:
    • Add metadata field for approval state

Frontend Changes:

  • ChatList.tsx:
    • Add PlanApprovalState and StepApprovalState types
    • Add state variables for approval workflow
    • Add handlePlanApprovalSubmit() for approve/cancel
    • Add handlePlanFeedbackSubmit() for feedback submission
    • Add handleStepApprovalDecision() for step approvals
    • Add Plan Approval UI with buttons and checkboxes
    • Add Step Approval UI with rejection notes
    • Plan display uses read-only Markdown component
  • chatTypes.ts:
    • Add metadata field to SystemMessage interface

WebSocket Message Types:

  • plan_approval: approve or cancel plan
  • plan_feedback: request changes with feedback text
  • step_approval: approve or reject individual steps

Docker/Infra (Windows Support):

  • docker-compose.yaml: Replace network_mode: host with port mappings
  • web_surfer.py: Change localhost:8000 to agentic_browser:8000
  • orchestrator_agent.py: Update API URL for container networking
  • ta-browser/Dockerfile: Update base to python:3.11-bookworm
  • Fixes inter-container communication on Windows Docker Desktop

…ames

- Replace network_mode: host with port mappings in docker-compose.yaml
- Change localhost:8000 to agentic_browser:8000 in web_surfer.py and orchestrator_agent.py

Fixes inter-container communication on Windows Docker Desktop.
Add comprehensive plan review system allowing users to control task execution
before agents begin work. Plans now require explicit user approval.

Plan Approval Features:
- Users can approve plans to start execution ("Approve & Run")
- Users can request modifications via text feedback ("Request Changes")
- Users can cancel plans gracefully ("Cancel Run")
- Feedback loop regenerates plan with AI incorporating user input
- Maximum 5 regeneration attempts to prevent infinite loops
- Plan display is read-only (modifications only via feedback)

Step-by-Step Approval:
- Optional checkbox: "Require approval before each web action"
- Optional checkbox: "Require approval before each coding step"
- Individual step approval/rejection with optional notes

Graceful Cancellation:
- Add UserCancellationError custom exception
- Display friendly message: "Task cancelled by user. No changes were made."
- No Python tracebacks shown to users

Backend Changes:
- orchestrator_agent.py:
  - Add UserCancellationError exception class
  - Extend orchestrator_deps with approval state fields
  - Add _request_plan_approval() for plan approval handling
  - Add _ensure_step_approval() for step-level approvals
  - Modify plan_task with approval loop and retry logic
  - Update system prompt with plan execution guidelines
- instructor.py:
  - Import and handle UserCancellationError
  - Return friendly cancellation message
- stream_response_format.py:
  - Add metadata field for approval state

Frontend Changes:
- ChatList.tsx:
  - Add PlanApprovalState and StepApprovalState types
  - Add state variables for approval workflow
  - Add handlePlanApprovalSubmit() for approve/cancel
  - Add handlePlanFeedbackSubmit() for feedback submission
  - Add handleStepApprovalDecision() for step approvals
  - Add Plan Approval UI with buttons and checkboxes
  - Add Step Approval UI with rejection notes
  - Plan display uses read-only Markdown component
- chatTypes.ts:
  - Add metadata field to SystemMessage interface

WebSocket Message Types:
- plan_approval: approve or cancel plan
- plan_feedback: request changes with feedback text
- step_approval: approve or reject individual steps

Infra:
- ta-browser/Dockerfile: Update base to python:3.11-bookworm
@mohd-talib0 mohd-talib0 changed the title fix(docker): support Windows by using bridge networking and service n… feat: Add plan approval workflow with feedback loop + Docker Windows support Dec 3, 2025
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