feat(web): fix jobs UI parity for non-sandbox mode#491
feat(web): fix jobs UI parity for non-sandbox mode#491think-in-universe merged 2 commits intomainfrom
Conversation
The web gateway Jobs UI was built primarily for sandbox (Docker) jobs. When running without sandbox (common for NEAR AI hosted envs), multiple features were broken. This change fixes all of them: - Agent jobs now broadcast live SSE events to the web UI (Activity tab) - Agent job restart via scheduler.dispatch_job (not chat message) - Follow-up prompts for agent jobs via WorkerMessage injection - Capability flags (can_restart, can_prompt, job_kind) in job detail API - Rate-limit retry with cap (10 consecutive) and Retry-After header parsing - Plan interruption on user message (breaks out of plan, re-evaluates) - Correct SSE status field in mark_completed/mark_failed/mark_stuck - SseManager preserved across rebuild_state calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the web UI's interaction with agent jobs by introducing real-time event streaming, enabling job restarts with failure context, and allowing users to send follow-up prompts. It also bolsters the system's resilience against LLM rate limits and refines the UI's dynamic display of job capabilities, bringing non-sandbox job parity closer to sandbox mode. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant improvements to the web UI's parity with non-sandbox jobs, enabling live SSE event broadcasting, job restart functionality, and follow-up prompts. The changes also enhance rate-limit resilience with intelligent retry mechanisms and improve the robustness of the web gateway's state management by preserving SSE broadcast channels across rebuilds. The UI now conditionally renders prompt bars and restart buttons based on job capabilities, providing a more intuitive user experience. Overall, the changes are well-implemented and contribute positively to the agent's functionality and user interface.
Note: Security Review did not run due to the size of the PR.
| .unwrap_or(50) as usize; | ||
| let max_iterations = max_iterations.min(MAX_WORKER_ITERATIONS); | ||
| let mut iteration = 0; | ||
| const MAX_CONSECUTIVE_RATE_LIMITS: usize = 10; |
There was a problem hiding this comment.
The value 10 for MAX_CONSECUTIVE_RATE_LIMITS is a hardcoded threshold. While this value might be reasonable, consider making this limit configurable via the agent's configuration. This would allow for easier tuning of the rate-limiting behavior in different deployment environments without requiring code changes and recompilation, improving operational flexibility.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(web): fix jobs UI parity for non-sandbox mode The web gateway Jobs UI was built primarily for sandbox (Docker) jobs. When running without sandbox (common for NEAR AI hosted envs), multiple features were broken. This change fixes all of them: - Agent jobs now broadcast live SSE events to the web UI (Activity tab) - Agent job restart via scheduler.dispatch_job (not chat message) - Follow-up prompts for agent jobs via WorkerMessage injection - Capability flags (can_restart, can_prompt, job_kind) in job detail API - Rate-limit retry with cap (10 consecutive) and Retry-After header parsing - Plan interruption on user message (breaks out of plan, re-evaluates) - Correct SSE status field in mark_completed/mark_failed/mark_stuck - SseManager preserved across rebuild_state calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * style: fix formatting in db/mod.rs and nearai_chat.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
scheduler.dispatch_job— creates a real job with failure context instead of sending a chat messageWorkerMessage::UserMessageinjection through the schedulercan_restart,can_prompt,job_kind) in job detail API, with conditional UI renderingRetry-Afterheader parsing (both seconds and HTTP-date), capped retry (10 consecutive), marks Stuck instead of infinite loopmark_completed/mark_failed/mark_stuck(previously all broadcaststatus: "completed")rebuild_statecalls viafrom_sender()constructorTest plan
cargo clippy --all --benches --tests --examples --all-features— zero warningscargo test— all pass (1 pre-existing failure inregistry::artifactsunrelated)SANDBOX_ENABLED=false), verify jobs tab works🤖 Generated with Claude Code