-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement step tracking and event streaming #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
- Add step tracking from task.result/summary - Extend timeout to 30 minutes - Add heartbeat events - Add comprehensive tests - Add documentation
Reviewer's GuideIntroduces a FastAPI-based backend that runs Codegen agent tasks, streams real-time step-wise progress via SSE with heartbeats, handles extended timeouts and cleanup, and includes corresponding docs and tests. Sequence diagram for task execution and event streamingsequenceDiagram
actor Client
participant FastAPI Server
participant Codegen SDK
Client->>FastAPI Server: POST /run (prompt)
activate FastAPI Server
FastAPI Server->>Codegen SDK: agent.run(prompt)
activate Codegen SDK
Codegen SDK-->>FastAPI Server: task object
deactivate Codegen SDK
Note right of FastAPI Server: Creates AgentCallback, spawns monitor_task()
FastAPI Server-->>Client: 200 OK (task_id)
deactivate FastAPI Server
Client->>FastAPI Server: GET /events/{task_id}
activate FastAPI Server
Note right of FastAPI Server: Returns StreamingResponse from callback.get_events()
loop Background Monitoring & Streaming
FastAPI Server->>Codegen SDK: task.refresh()
activate Codegen SDK
Codegen SDK-->>FastAPI Server: Updated task status
deactivate Codegen SDK
alt Step/Status Changed
FastAPI Server->>FastAPI Server: callback.on_status_change()
FastAPI Server-->>Client: data: {"status": "in_progress", "current_step": "...", ...}
else Timeout with no new events
FastAPI Server-->>Client: : heartbeat
end
end
FastAPI Server->>Codegen SDK: task.refresh()
activate Codegen SDK
Codegen SDK-->>FastAPI Server: Task completed
deactivate Codegen SDK
FastAPI Server->>FastAPI Server: callback.on_status_change("completed", ...)
FastAPI Server-->>Client: data: {"status": "completed", ...}
FastAPI Server-->>Client: data: [DONE]
deactivate FastAPI Server
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This PR implements step tracking and event streaming for the Codegen API server. Key features:
Step Tracking
task.resultandtask.summaryEvent Streaming
data:prefixTimeout Handling
max_retriesComprehensive Testing
Documentation
Example event format:
{ "status": "in_progress", "task_id": "123", "timestamp": "2025-06-12T14:58:40Z", "current_step": "Analyzing repository structure", "step_number": 1 }The implementation has been tested and validated to work with the Codegen SDK. All tests pass and the code is ready for review.
💻 View my work • About Codegen
Summary by Sourcery
Implement a FastAPI-based Codegen API server featuring real-time step tracking and SSE event streaming, extended timeouts, and comprehensive documentation and tests
New Features:
Build:
Documentation:
Tests: