Skip to content

feat: add steering/follow-up queue inspection API#54

Merged
yuanhao merged 2 commits into
mainfrom
feat/steering-queue-access
Jul 4, 2026
Merged

feat: add steering/follow-up queue inspection API#54
yuanhao merged 2 commits into
mainfrom
feat/steering-queue-access

Conversation

@yuanhao

@yuanhao yuanhao commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #50

Adds the read side of the Agent queue API so clients can render and manage pending messages while the agent is busy (pi-style queue handling):

Method Purpose
steering_queue_snapshot() / follow_up_queue_snapshot() Point-in-time copy for display; does not consume
steering_queue_len() / follow_up_queue_len() Count for badges/UI
take_steering_queue() / take_follow_up_queue() Atomic drain-and-return — enables edit-and-requeue

The clear_* methods already existed; this completes the "access" half of the issue. Snapshots are documented as point-in-time (the loop can drain the queue concurrently); take_* is the atomic primitive for editing.

Non-breaking, additive, confined to agent.rs plus docs (docs/reference/api.md, docs/concepts/agent-loop.md) and a behavioral test covering inspect → take → requeue.

🤖 Generated with Claude Code

Add read access to the Agent's message queues so clients can render
pending messages while the agent is busy (pi-style queue UIs):

- steering_queue_snapshot() / follow_up_queue_snapshot() — point-in-time
  copy, does not consume
- steering_queue_len() / follow_up_queue_len()
- take_steering_queue() / take_follow_up_queue() — atomic drain-and-return,
  enabling edit-and-requeue

clear_* methods already existed; this adds the inspection half.
Non-breaking, agent.rs only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- add steer_all()/follow_up_all() batch enqueue (one lock) so requeues
  from take_*_queue() cannot be split by a concurrent drain
- document the edit-window semantics honestly: only the drain is atomic;
  survivors can deliver at the start of the next run; in-flight messages
  cannot be retracted; ordering vs concurrent producers; QueueMode effect;
  reset() and persistence caveats
- note the _with_sender precondition (queue accessors need the
  spawn-based flows)
- make the doc example self-contained (no undefined helper), derive the
  count from the snapshot instead of double-locking
- api.md: return types on the new rows + batch method rows
- test: batch-requeue via steer_all with survivor-content assertion;
  drop a redundant assertion

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yuanhao yuanhao merged commit 363599d into main Jul 4, 2026
1 check passed
@yuanhao yuanhao deleted the feat/steering-queue-access branch July 4, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve steering queue access

1 participant