Skip to content

feat: queue drains one turn at a time, Steer now, reorder; plan card follow-ups (#1501 G3) - #1504

Merged
currentbits merged 4 commits into
mainfrom
coder/1501-g3-queue-plan-card-upgrades-5958f2
Oct 6, 2026
Merged

currentbits merged 4 commits into
mainfrom
coder/1501-g3-queue-plan-card-upgrades-5958f2

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Item G3 of #1501.

Queue

  • One turn per item: drainQueued takes only the head item on each successful turn end. A failure or Stop leaves the rest parked, shown as "Queued, paused". A start that fails puts the item back at the front.
  • Send now on a paused queue resumes it one item at a time (new runs.sendQueued, wired everywhere IPC is declared).
  • Steer now appears on queued items for steer-capable providers.
  • Drag to reorder, with the Up/Down buttons kept for the keyboard.
  • Existing bug fixed (reproduced on main first): when a turn ended with both a worker notice and a queued item pending, the queued drain won the idle slot and the notice bounced as "Not delivered". A notice that's starting now holds the drain (isNoticeStarting); its own turn end drains the queue, and a refused notice leaves the queue parked. An "already active" race is no longer recorded as a queue error.

Plan card

  • Keep planning takes optional notes: appended to the deny message when the CLI is live, or queued as the next planning turn otherwise.
  • Implement in a new thread: forks through the normal path, out of plan mode, with "Implement this plan:" plus the plan.
  • Save plan to file: writes docs/plans/<date>-<slug>.md in the thread's checkout. It never overwrites and refuses SSH projects.

Verified independently, on main merged with this branch, #1502 and #1503:

  • typecheck exits 0 and vite build passes.
  • test:renderer passes 2795 of 2795.
  • test:electron: 4224 passed and 1 failed. The failure was the memory-sup MCP-cleanup test, a known load flake that passes alone.
  • New electron tests cover drain order, Stop and failure mid-queue, a notice arriving mid-queue, Send now, and plan follow-ups.

Limits:

  • Queued attachments aren't tied to an item, so they ride with the first item sent.
  • Steer now on duplicate texts removes the first match.

🤖 Generated with Claude Code

Willem and others added 4 commits October 6, 2026 16:13
Each queued item now runs as its own turn: drainQueued takes only the
head and the next successful terminal drains the next one, so a failed
or stopped turn leaves the rest parked. A failed start puts the head back
in front. A machine notice flushed at the same terminal keeps the idle
slot (a deferred start used to lose to the drain and bounce as
"Not delivered"). Send now goes through a new runs.sendQueued.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steer now injects one queued item into the live turn and drops it from
the latest queue (matched by text, so a drain mid-hop cannot remove the
wrong item). Hidden when the provider has no supportsSteer. Items drag
to a new slot through the same replace write the Up/Down buttons use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… file (#1501)

- Keep planning takes optional notes. A live CLI gets them in the
  rejection; a persisted plan card sends them first in line as the next
  planning turn.
- Implement in a new thread forks through the ordinary fork path with
  leavePlan, so the fork starts out of plan mode, and sends the plan as
  its first prompt.
- Save plan to file (threads.savePlan) writes docs/plans/<date>-<slug>.md
  into the thread's checkout, never overwrites, refuses remote projects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T14:42:00.379208Z 1f827ed PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f827edb79

ℹ️ 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".

Comment thread src/useCoder.ts
try {
// ponytail: attachments stay queued and ride with the next drained
// head; the blob does not record which item they belong to.
await api.runs.steer({ threadId: id, prompt: item });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make steering atomic with removing the queued item

When steering succeeds but the subsequent threads.setQueued write fails, the instruction has already reached the live agent while remaining in the queue, so it will be sent again by the next drain. The same duplication can occur if the active turn completes between these two IPC calls and drains the item before the renderer removes it. Move the take/steer/restore operation into the main process so successful delivery and queue removal cannot diverge.

Useful? React with 👍 / 👎.

// The start below is deferred, so a queued drain from the same terminal
// would win the idle slot and this notice would bounce off "already
// active" (#1501). Hold the drain until the notice turn owns the thread.
noticeStarting.add(threadId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block reentrant notice flushes during startup

While the first notice is awaiting startRun—notably during the initial whenPathReady() wait—active is still empty, and a second deliverNotice can enter flushOrchNotices despite this set entry. That second flush deletes its notice from orchNotices and starts a competing run; one start then loses with “already active,” leaving that worker notice permanently undelivered. Check noticeStarting before consuming another notice, rather than using it only to block queued drains.

Useful? React with 👍 / 👎.

Comment thread src/dev/runs.ts
Comment on lines +926 to +929
const thread: ThreadInfo = {
...detail.thread,
queued: rest.length ? { prompt: rest.join("\n\n"), items: rest } : null,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the dev queue when Send now fails

In browser/dev mode, this clears the head from detail.thread.queued before calling runs.start, but start can reject—for example because the budget gate fires or a run became active—and there is no rollback. A rejected Send now therefore permanently loses the queued prompt and its attachments, unlike the production implementation's take-and-restore contract.

Useful? React with 👍 / 👎.

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.

1 participant