⚡ Bolt: Skip live polling for terminal sessions#39
Conversation
- Updated `web/app/api/sessions/route.ts` and `src/commands/status.ts` to check if a session is in a terminal state (`completed` or `failed`) before polling the vendor API. - Replaced a `useEffect` with a conditional state update during render in `web/components/session-drawer.tsx` to fix a React warning and improve render performance. - Added a journal entry detailing the learning about terminal state polling. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b224aeabb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Skip live polling for terminal statuses to prevent unnecessary API calls | ||
| if (status !== "completed" && status !== "failed") { |
There was a problem hiding this comment.
Preserve summaries when skipping terminal sessions
For any session already stored as completed or failed, this branch is skipped after summary was initialized to undefined, so every subsequent /api/sessions response loses the final summary previously returned by the adapter. Because DbSession has no persisted summary field, the value cannot be recovered from storage; persist the summary when the session becomes terminal or otherwise retain it before bypassing the poll.
Useful? React with 👍 / 👎.
| // Skip live polling for terminal statuses to prevent unnecessary API calls | ||
| if (status !== "completed" && status !== "failed") { |
There was a problem hiding this comment.
Resume polling after a terminal-session follow-up
When a vendor accepts a follow-up that reactivates a completed or failed session, followupCommand reports success but does not reset the stored status. This condition then prevents polyagent status --watch from ever querying the vendor again, so it continues displaying the old terminal state while the follow-up runs, despite directing the user to track it with that command.
Useful? React with 👍 / 👎.
💡 What:
web/app/api/sessions/route.tsandsrc/commands/status.tsto skip live vendor polling for sessions that have reached a terminal state (completedorfailed).web/components/session-drawer.tsxby replacing auseEffecthook with a state update during render to reset optimistic messages when switching sessions.🎯 Why:
session-drawer.tsxchange removes an unnecessaryuseEffectthat was causing cascading renders, improving UI performance and fixing an ESLint warning.📊 Impact:
🔬 Measurement:
pnpm dev) with multiple completed/failed sessions in the history. Use the browser's Network tab (or logging) to observe that calls tobuildAdapter(vendor).getStatus()are only made for non-terminal sessions during the 3-second polling interval.pnpm testandcd web && pnpm lintto verify tests pass and no lint warnings exist.PR created automatically by Jules for task 3318047496366640461 started by @parvezk