Hmbown / Hmbown/Codewhale

v0.9.14: App-server turn queue inspect and cancel for client surfaces

Open
#6,176 1 comment 0 reactions 0 assignees View on GitHub
enhancement rust
Dominant language
Rust
Stars
41k
Forks
3.6k
Avg merge
13h 59m
Merged PRs (30d)
299

Description

## Why this matters

GPUI Hmbown/codewhale-apps#558 (Linear APPS-30) needs real queue semantics: submit while a turn runs, see what is pending, and cancel a queued turn before it starts. Without a client-visible queue, the desktop either rejects input while a turn is live or builds its own queue — a second turn scheduler is exactly the thing this product exists to not have.

## Current behavior

- `POST /v1/threads/{id}/turns` admits a turn and `RuntimeTurnStatus::Queued` exists internally (`crates/tui/src/runtime_threads.rs`, queue admission around `start_turn_with_source`), so the Engine already orders work.
- `/v1/threads/{id}/turns/{turn_id}/steer` and `/interrupt` exist for the *running* turn.
- No route lists queued/pending turns per thread, and nothing cancels a queued-but-not-started turn. A watch-only client cannot answer "what is waiting behind the active turn?"

## Desired behavior

1. A read surface exposing per-thread queued turns (id, prompt summary, position, admitted-at) — either on `GET /v1/threads/{id}` or a dedicated collection route.
2. Cancel/remove for a queued (never-started) turn with ownership checks, distinct from interrupting a running turn.
3. Queue position/state flows through the existing snapshot or event surface so clients stay read-only projections.

## Evidence

Route table audit at tip (`crates/tui/src/runtime_api.rs`, ~96 `/v1/*` routes): `turns`, `turns/{turn_id}/steer`, `turns/{turn_id}/interrupt`, `turn-operations/{operation_key}` exist; no queue listing or queued-turn removal route. `RuntimeTurnStatus::Queued` at `runtime_threads.rs:11673` confirms internal queue state exists to project.

## Acceptance criteria

- [ ] A client can list queued turns for a thread over HTTP (not only the running one)
- [ ] A queued turn can be removed before it starts, and a started turn still goes through interrupt
- [ ] Repeated enqueue/cancel is idempotent or returns an explicit conflict, never a silent double-execution
- [ ] `cargo test -p codewhale-tui` route tests cover list + cancel + a foreign-session rejection

Related: Hmbown/codewhale-apps#558, #6152 (event projection for watch-only clients), #5625 (queued follow-up steer delivery).

Contributor guide

Open the contributing guide

Research direction

Start with the route table and runtime queue handling in crates/tui/src/runtime_api.rs and crates/tui/src/runtime_threads.rs, especially RuntimeTurnStatus::Queued near line 11673 and start_turn_with_source. Review existing turn, steer, interrupt, and route tests before choosing the read and removal surfaces. Done means HTTP list and queued-cancel behavior, ownership rejection, idempotency or explicit conflict handling, and cargo test -p codewhale-tui coverage for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.