feat(tui): wire Queue overlay to JobQueue for real-time management #103

Merged
claude-desktop merged 1 commit from tui/queue-wire-95 into main 2026-04-12 15:36:51 +00:00
Collaborator

Summary

  • Wire the scaffolded QueueState component to loom-core's JobQueue via AppCtx, replacing placeholder data with live job snapshots
  • Handle Event::CoreMsg(LoomEvent::QueueChanged{..}) to refresh the overlay in real time
  • Implement d (cancel/dismiss), r (retry failed), j/k (navigate) keybinds inside the modal overlay
  • Add Ctrl+J global keybind and command palette entry to open the Queue overlay
  • Render job list with status coloring, progress gauge for running jobs, and contextual help line

Closes charles/loom#95

Test plan

  • cargo clippy -p loom-tui -- -D warnings clean
  • cargo test -p loom-tui passes (113 tests)
  • Pre-push just qa passes (fmt, lint, test)
  • Manual: open queue overlay with Ctrl+J, verify jobs render with correct status colors
  • Manual: enqueue a generation, confirm QueueChanged events update the overlay live
  • Manual: select a pending job and press d to cancel, verify removal
  • Manual: select a failed job and press r to retry, verify status resets to Pending

🤖 Generated with Claude Code

## Summary - Wire the scaffolded `QueueState` component to `loom-core`'s `JobQueue` via `AppCtx`, replacing placeholder data with live job snapshots - Handle `Event::CoreMsg(LoomEvent::QueueChanged{..})` to refresh the overlay in real time - Implement `d` (cancel/dismiss), `r` (retry failed), `j`/`k` (navigate) keybinds inside the modal overlay - Add `Ctrl+J` global keybind and command palette entry to open the Queue overlay - Render job list with status coloring, progress gauge for running jobs, and contextual help line Closes charles/loom#95 ## Test plan - [x] `cargo clippy -p loom-tui -- -D warnings` clean - [x] `cargo test -p loom-tui` passes (113 tests) - [x] Pre-push `just qa` passes (fmt, lint, test) - [ ] Manual: open queue overlay with `Ctrl+J`, verify jobs render with correct status colors - [ ] Manual: enqueue a generation, confirm QueueChanged events update the overlay live - [ ] Manual: select a pending job and press `d` to cancel, verify removal - [ ] Manual: select a failed job and press `r` to retry, verify status resets to Pending 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Connects the scaffolded Queue component to loom-core's actual JobQueue
via AppCtx. The overlay reads live job state, handles QueueChanged
events, and supports d (cancel/dismiss), r (retry), j/k navigation.
Accessible via Ctrl+J or the command palette.

Closes charles/loom#95

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Collaborator

Review — PR #103: Queue overlay wired to JobQueue

Good. Functional queue overlay with cancel/retry and progress gauge.

Concern: q.remove(id) || q.dismiss(id)

This uses || with side effects — dismiss only runs if remove returns false. This works but is surprising to read. Consider making it explicit:

if !q.remove(id) {
    q.dismiss(id);
}

Concern: sync_from_ctx on every render

render() calls self.sync_from_ctx(ctx) which does ctx.queue.try_read() and rebuilds the snapshot on every frame. For a ~60fps render loop this is 60 lock acquisitions per second while the overlay is open. Consider syncing only on Event::Tick (which is typically slower) or on QueueChanged events.

Cross-PR: duplicated centered_rect

centered_rect is copy-pasted here and also in PRs #106 (sharing) and #109 (LoRA picker). Extract it to crate::util or crate::components::layout to avoid three copies.

Nit

  • The Ctrl+j binding for opening the queue is a good default, but Ctrl+j is traditionally "newline" in terminal emulators. Could conflict with text input in prompts. Since the keybinds are configurable this is fine, just noting it.
## Review — PR #103: Queue overlay wired to JobQueue **Good.** Functional queue overlay with cancel/retry and progress gauge. ### Concern: `q.remove(id) || q.dismiss(id)` This uses `||` with side effects — `dismiss` only runs if `remove` returns `false`. This works but is surprising to read. Consider making it explicit: ```rust if !q.remove(id) { q.dismiss(id); } ``` ### Concern: `sync_from_ctx` on every render `render()` calls `self.sync_from_ctx(ctx)` which does `ctx.queue.try_read()` and rebuilds the snapshot on every frame. For a ~60fps render loop this is 60 lock acquisitions per second while the overlay is open. Consider syncing only on `Event::Tick` (which is typically slower) or on `QueueChanged` events. ### Cross-PR: duplicated `centered_rect` `centered_rect` is copy-pasted here and also in PRs #106 (sharing) and #109 (LoRA picker). Extract it to `crate::util` or `crate::components::layout` to avoid three copies. ### Nit - The `Ctrl+j` binding for opening the queue is a good default, but `Ctrl+j` is traditionally "newline" in terminal emulators. Could conflict with text input in prompts. Since the keybinds are configurable this is fine, just noting it.
charles force-pushed tui/queue-wire-95 from e76c2423c4 to 21abb3f474 2026-04-12 14:33:42 +00:00 Compare
claude-desktop changed target branch from tui/image-ctx-85 to main 2026-04-12 15:36:29 +00:00
claude-desktop deleted branch tui/queue-wire-95 2026-04-12 15:36:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/loom!103
No description provided.