Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Thread transfer impact
This comment will update automatically after the next completed run. |
A queued message that a client is editing gets a short hold. Once it is next, the queue waits there until the edit is saved, cancelled, or the hold lapses after two minutes without a renewal. A turn that fails during the edit still holds the queue, and a steer waiting for its turn waits for the edit too.
…ave or cancel Opening a queued message for editing asks the server to hold it, renews the hold every 30 seconds, and releases it on cancel or when another message is opened. A server without the hold rejects it and editing works as before.
555e351 to
6cd61c6
Compare
| runId: queuedRun.id, | ||
| providerInstanceId: queuedRun.providerInstanceId, | ||
| occurredAt: now, | ||
| payload: withoutEditHold(queuedRun), |
There was a problem hiding this comment.
🔴 Saving a queued edit interrupts work
Saving a held deferred steer as /goal <objective> restores steerWhenReadyRunId after the edit clears it. deliverSteerAfterEdit then promotes the command and stops the running turn on a goal-capable provider instead of leaving it queued.
Learn more
Editing a deferred steer into a slash command removes its target so it stays in its original queue position (dispatchQueuedRunEdit). The subsequent hold-release event starts from the original run, restoring the target. When the target turn is running, deliverSteerAfterEdit promotes the edited message. dispatchQueuedMessagePromoteToSteer moves a slash command to the front and can interrupt the target for a goal command.
Example: Ask to steer while a goal-capable provider is starting, open the deferred steer for editing, and save /goal finish the migration once the provider is running. The save interrupts the turn rather than leaving the command in its original queue position.
Recommended fix: Emit one run update that applies both field removals when they apply. Extend the deferred-steer integration case to verify that saving a slash command preserves queue position and writes no interrupt request.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Fixed in 1172481. The save now sends one run update that drops the edit hold and, for a slash command, the steer target. Before, the second update put the target back. The deferred-steer case in SteeringCompletion.integration.test.ts now also saves as /context all and checks that nothing is steered and the run stays queued with no target. That case fails without the fix.
| if ( | ||
| command.type === "queue.resume" || | ||
| command.type === "queued-run.start" || | ||
| startsQueueAfterCommit(command) || |
There was a problem hiding this comment.
🔴 Edit release bypasses failure holds
If an edit ends before the run-end handler processes a committed failure, startNextQueuedRun gets no failure context. It can start queued work on the failed provider or in the project checkout after failed worktree setup.
Learn more
The terminal run and the queue's failure pause are separate writes. dispatchPreparedRunFail records the failed run; handleRunUpdate later handles the terminal event and passes the ended and failed run IDs to queue promotion. A save or hold release can take the thread lock in between. The new automatic start path passes neither ID, so startNextQueuedRunOnce misses both checks even though it reads the failed run. Without a worktree, the runtime policy resolves the project checkout instead.
Example: Queue and edit a follow-up while a new thread prepares its worktree. If worktree setup fails and the save gets the thread lock before the failure reaction writes the queue pause, the follow-up starts in the project checkout.
Recommended fix: Give the new automatic start paths the latest-run safety checks already used by message intake, including receipt replay. Preserve the explicit resume and Send now behavior. Test a save after the terminal projection is committed but before its reaction processes it.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Fixed in 1172481. Starts that an edit triggers (save, release, expiry, remove, reorder) now pass latestRunEnded: true, as message intake does. They check the latest turn for a failure or a missing worktree even when the run-end handler has not run yet. Resume and Send now still go on as a person asked. New test in ThreadStop.test.ts: the failure is in the projection, its reaction has not run, and the save leaves the queue held. It fails without the change.
| if (!command.held) { | ||
| // The message may have started or been cancelled while the edit was open. | ||
| const run = projection.runs.find((candidate) => candidate.id === command.runId); | ||
| if (run?.status !== "queued" || run.editHeldUntil === undefined) return; | ||
| yield* emitEvent({ | ||
| type: "run.updated", | ||
| threadId: command.threadId, | ||
| runId: run.id, | ||
| providerInstanceId: run.providerInstanceId, | ||
| occurredAt: now, | ||
| payload: withoutEditHold(run), |
There was a problem hiding this comment.
🔴 One device cancels another’s edit hold
When two devices edit the same message, dispatchQueuedRunHold clears their shared hold as soon as either device cancels. The queue can send the original text while the other edit is open, leaving that edit unsavable.
Learn more
Each client starts and renews a hold independently through makeQueuedRunEditStore, but the server stores one deadline per run. A cancellation clears that deadline regardless of which client renewed it. If the queue starts the message, the other client closes the edit; resolveQueuedEditExit discards changed content when the thread already has a draft.
Example: Edit the same queued follow-up on a phone and browser while the previous turn runs. Change the browser text, wait for the turn to finish, then cancel on the phone. The original follow-up runs, and the browser cannot save its changes to that message.
Recommended fix: Associate each hold with an edit-session identifier. Renew and release only that session’s hold, and keep the message paused while any live hold remains. If concurrent edits are not supported, reject the second acquisition and prevent the second editor from releasing the first hold.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Not changing this. One hold per message is deliberate. If one device cancels while another is editing, the message goes out with its original text and the other device's edit goes through the existing recovery: back into the composer, or dropped if the composer has a draft. That is the same outcome as on main today, so nothing gets worse. Tracking each device's hold would add per-session state to the run for a rare case: two devices editing the same queued message at once.
| if (options?.queuedRunId === undefined && storedQueuedRun.editHeldUntil !== undefined) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
🟡 Queued subagent results wait behind edits
When a subagent result queues behind an edited message, startNextQueuedRunOnce stops at the edit once the parent turn ends. The parent agent gets no result until the edit hold ends.
Learn more
dispatchContinuation sends completed subagent results with queue_after_active. If the active turn cannot take the result as a steer, the result enters the queue. queuedRunsInDeliveryOrder typically puts the earlier user message first. The idle-thread exception for new results in dispatchMessage does not apply to a result already in the queue.
Example: While a parent turn that cannot accept a steer is running, queue a follow-up and open it for editing. Let a subagent result queue behind that message, then let the parent turn finish. The result waits for the unrelated edit instead of reaching the parent.
Recommended fix: When the next user message is paused for editing, consider eligible delegated completions already in the queue. Preserve the general queue pause and failure checks, and test a completion that queues before the parent becomes idle.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Fixed in 1172481. nextQueuedRun moved to QueuedRunOrder.ts. When the head is being edited, it now starts the first subagent result in the queue that no Stop or failure holds, so results queued after the edited message still reach the parent. Failure checks still apply to whatever starts. A unit test in QueuedRunOrder.test.ts covers both a user message, which waits, and a subagent result, which passes.
| ) | ||
| -- Titles and edit-hold timers wait only on their own kind: a timer due in | ||
| -- minutes would otherwise hold back the thread's turns until it fires. | ||
| AND ${effectLane("candidate")} = ${effectLane("active")} |
There was a problem hiding this comment.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Not changing this. It needs two different messages on one thread to be held at the same time (two devices, two messages), and the cost is only a late expiry, bounded by the other hold's deadline. Giving each run its own lane would put a JSON read into every outbox claim, which is a hot path.
| renew: setInterval(() => hold(true), QUEUED_RUN_EDIT_HOLD_RENEW_MS), | ||
| }); |
There was a problem hiding this comment.
🔍 Pending renewal can rehold saved edits
startHold can queue a renewal behind an in-flight save on the shared thread command scheduler. Clearing the interval cannot cancel that renewal, which can reapply the hold while the saved message is still queued.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Fixed in 3579040. Renewals pause while a save is in flight and resume, with an immediate hold, if the save fails. So no renewal can run after a successful save. The store test now checks that no renewals go out during a save and that one goes out after a failed save.
| yield* TestClock.adjust("3 minutes"); | ||
| yield* holdForEdit(threadId, 1, `${threadId}:renew`, true); | ||
| yield* TestClock.adjust("2 minutes"); | ||
| yield* fireDueHoldTimer; |
There was a problem hiding this comment.
🔍 Renewal test misses the live deadline
fireDueHoldTimer first runs when both deadlines are due, and the test renews only after the original deadline. Draining one effect cannot show that a renewal made before expiry keeps the queue paused at that deadline.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Fixed in 1172481. When the hold went from 5 minutes to 2, the test's 3-minute renewal ended up after the first deadline. The test now steps in halves of QUEUED_RUN_EDIT_HOLD_MS: it renews halfway, fires the first timer at the original deadline (the message is still held), then lets the renewed hold expire or releases it.
| (held) => { | ||
| void holdQueuedRun({ ...target, input: { threadId: target.threadId, runId, held } }); | ||
| }, |
There was a problem hiding this comment.
🔍 Real-client edit lifecycle remains unverified
The ThreadQueueSheet closes immediately after opening an edit. The PR lists no real-client pass or base/head scenario proof, both required by verification guidance.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of jagrat7
Agreed that a real-client pass is still owed; the PR description says so. The maintainer is checking it by hand in a dev build. The sheet closing after Edit is existing behavior: navigation.goBack() after beginQueuedRunEdit was already there, and the edit continues in the thread composer.
…aved command's place Starts that an edit triggers check the latest turn for a failure, as the run-end handler would, so a save that beats that handler cannot start queued work after a failed turn. Subagent results pass a message that is being edited. Saving a deferred steer as a slash command no longer restores its steer target in a second run update.
A renewal sent while a save is in flight runs after it and would hold the saved message again.
…ady make Starts that an edit triggers check the latest turn for a failure, so the queue no longer needs to read past an edit hold at turn end to apply it. Also drops comments that restated the code.
…very A renewal writes only once less than half the hold remains, so clients get one run update a minute instead of two. Taking a hold no longer tries to start the queue, and a timer that finds its hold renewed skips the post-commit work. Hold commands read only their run. Steers that waited for an edit go through the same promotion as other deferred steers, and a replayed command now delivers them too.
The hold, its renewal, and the watch always started and stopped together, so they now live in one record.
Problem
If you're editing a queued message when the running turn ends, the server sends the message with its old text. The client can't save the edit to a message that already started, so it moves the edit into the composer (or drops it) and shows "Queued message is no longer queued". The agent gets the wrong text, and your edit is left to send as a second message.
Repro: start a long turn, queue a follow-up, click ✏️ on it, change the text, and let the turn finish before you save.
Change
The server now knows when a queued message is being edited, and waits for you.
queued-run.hold, renews it every 30 seconds, and releases it on Cancel or when you open another message.sequenceDiagram participant C as Client participant S as Server participant A as Agent C->>S: queued-run.hold (open editor, renew every 30s) A->>S: turn ends Note over S: Q is next and held: nothing starts alt Save C->>S: queued-run.edit (new text) S->>A: start Q with the new text else Cancel C->>S: queued-run.hold { held: false } S->>A: start Q with the original text else no renewal for 2 min S->>S: hold expires S->>A: start Q with the original text endScope
Fixes pingdotgg#15611 (pingdotgg/t3code). It builds on the approach in pingdotgg#35475 and pingdotgg#18631. It also covers the gap that closed pingdotgg#35475: removing the edited message used to leave the queue stuck.
Verification
ThreadStop.test.ts:SteeringCompletion.integration.test.ts: a deferred steer waits for its edit, then steers the edited text. Saved as/context all, it stays queued and steers nothing; that case fails without the fix.QueuedRunOrder.test.ts: a user message waits behind an edited message, and a subagent result passes it.FoundationPersistence.test.ts: the expiry timer runs in its own outbox lane, so a pending timer doesn't block the thread's other effects.queuedRunEdit.test.ts:useQueuedRunEditbrowser tests and mobilequeued-run-edittests pass, and so doesvp run check:changed.Claude Opus 5.5 via Claude Code in T3 Code.