Skip to content

Add a prompt based worflow using AgentQuery#17

Closed
swghosh wants to merge 1 commit intomainfrom
e2e
Closed

Add a prompt based worflow using AgentQuery#17
swghosh wants to merge 1 commit intomainfrom
e2e

Conversation

@swghosh
Copy link
Collaborator

@swghosh swghosh commented Feb 16, 2026

The server currently runs a single /oape:api-implement command per job. We need to transform it into a full workflow orchestrator that takes only an EP URL and runs the entire feature development pipeline:

PR # 1: init → api-generate → api-generate-tests → review-and-fix → raise PR
PR # 2: api-implement → review-and-fix → raise PR
PR # 3: e2e-generate → review-and-fix → raise PR

Summary by CodeRabbit

  • New Features

    • Added NO_TICKET mode for code reviews, allowing validation without Jira integration.
    • Introduced workflow phase tracker UI displaying progress through review stages.
  • Refactor

    • Transitioned from command-based to unified workflow execution model.
    • Simplified submission process by removing command selection and working directory input.
    • Removed synchronous API-implement endpoint.
  • Chores

    • Version bumped to 0.2.0.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Walkthrough

Replaces command-based agent execution with workflow-prompt execution model. Adds NO_TICKET mode to review command for conditional Jira validation. Updates UI with workflow phase tracking. Removes command and working directory parameters from job submission, incrementing version to 0.2.0.

Changes

Cohort / File(s) Summary
Review Command Enhancement
plugins/oape/commands/review.md
Introduces NO_TICKET sentinel parameter to skip Jira validation and intent match checks. Sets jira_intent_met to null in NO_TICKET mode while preserving code quality and safety validation.
Agent Core Refactoring
server/agent.py
Replaces per-command execution with workflow-based prompt interface. Adds new run_workflow entry point, WORKFLOW_SYSTEM_PROMPT constant, and TEAM_REPOS_CSV for repository resolution. Updates run_agent signature from command-based to prompt-based parameters.
UI Updates for Workflow
server/homepage.html
Adds workflow phase tracker UI with phase icons and state management (active, done, failed). Removes command selector and working directory field. Implements JavaScript logic to track and display phase progression from agent output messages.
Server API Simplification
server/server.py
Removes command and working directory parameters from submit_job endpoint. Eliminates /api-implement endpoint and _resolve_working_dir helper. Replaces run_agent with run_workflow integration. Removes cwd field from job status responses. Updates app version to 0.2.0.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UI as UI (Phase Tracker)
    participant Server
    participant Agent
    participant Workflow

    Client->>Server: submit_job(ep_url)
    Server->>Server: create job, initialize phases
    Server->>UI: display phase tracker
    
    Server->>Agent: run_workflow(ep_url, on_message)
    Agent->>Workflow: start OAPE cycle (init → api-generate → tests → review → PR → controller → e2e)
    
    loop Workflow Execution
        Workflow->>Agent: execute phase
        Agent->>Server: on_message(phase_update)
        Server->>UI: stream phase status
        UI->>UI: update phase state (active/done/failed)
        UI->>Client: display current phase
    end
    
    Workflow->>Agent: workflow complete
    Agent->>Server: return AgentResult
    Server->>UI: display completion with cost
    UI->>Client: show final results
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

  • Add agent jobs flow #13: Directly refactors the agent/job flow—moving from per-command execution (run_agent with command parameter) to workflow-based orchestration (run_workflow with prompt parameter) introduced in that PR.
  • OAPE-436: Add review command #4: Both PRs modify plugins/oape/commands/review.md to enhance the review command—main PR adds NO_TICKET sentinel mode that builds on the review command foundation.
  • Integrate with Claude Agent SDK #7: Both PRs modify the same server API surface—main PR removes the /api-implement endpoint and swaps agent integration from run_agent/command-based to run_workflow/prompt-based that was introduced in #7.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions 'prompt based workflow' and 'AgentQuery', but the PR's main objective is transforming the server into a workflow orchestrator that runs a full feature development pipeline without per-command execution. Clarify the title to better reflect the primary change: consider 'Convert server to workflow orchestrator' or 'Replace command-based execution with full workflow pipeline'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% 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 e2e

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

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.

🧹 Nitpick comments (4)
plugins/oape/commands/review.md (1)

143-158: Consider adding an example for NO_TICKET mode.

The examples section demonstrates usage with ticket IDs but doesn't show the new NO_TICKET mode that the workflow heavily relies on. Adding an example would improve discoverability:

4. **Review without Jira validation (code quality only)**:
   ```shell
   /oape:review NO_TICKET origin/master

</blockquote></details>
<details>
<summary>server/agent.py (1)</summary><blockquote>

`328-330`: **Temp directory is created but never cleaned up.**

The workflow creates a unique directory under `/tmp/oape-{job_id}` but there's no cleanup mechanism. For long-running servers, this could accumulate significant disk usage over time. Additionally, consider using `tempfile.mkdtemp()` for more secure temp directory creation as flagged by static analysis.

<details>
<summary>♻️ Suggested improvement using tempfile</summary>

```diff
 import os
+import tempfile
 import uuid

...

 async def run_workflow(
     ep_url: str,
     on_message: Callable[[dict], None] | None = None,
 ) -> AgentResult:
     ...
-    job_id = uuid.uuid4().hex[:12]
-    working_dir = f"/tmp/oape-{job_id}"
-    os.makedirs(working_dir, exist_ok=True)
+    working_dir = tempfile.mkdtemp(prefix="oape-")

Note: Cleanup could be handled at the server layer after the workflow completes, or a periodic cleanup task could remove old directories.

server/server.py (2)

82-82: Store the task reference to avoid potential issues.

The asyncio.create_task() return value should be stored. Untracked tasks can be garbage collected before completion in edge cases, and exceptions may go unobserved. This aligns with the static analysis hint.

♻️ Suggested fix
-    asyncio.create_task(_run_job(job_id, ep_url))
+    jobs[job_id]["task"] = asyncio.create_task(_run_job(job_id, ep_url))

This also enables future enhancements like job cancellation.


42-42: Consider adding job cleanup for long-running servers.

The in-memory jobs dict will grow unbounded over time. For a production deployment, consider adding TTL-based cleanup or a maximum job history limit.

@swghosh swghosh changed the title Add a worflow based agent Add a worflow based agent w/ prompt Feb 17, 2026
@swghosh swghosh changed the title Add a worflow based agent w/ prompt Add a prompt based worflow using AgentQuery Feb 17, 2026
@swghosh
Copy link
Collaborator Author

swghosh commented Feb 18, 2026

closing in favour of #21

@swghosh swghosh closed this Feb 18, 2026
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