Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… thread payload The app re-derived edit eligibility from the provider capability and the thread's archive state, separately from the server's edit route. Expose canEditMessages on the thread response, computed by the same function the edit route enforces, and gate the app on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/allow-message-edits-while-background-work-is-run-thr_pc5riqrbav
branch
from
October 19, 2026 22:35
002a3af to
f1892a8
Compare
ymichael
deleted the
bb/allow-message-edits-while-background-work-is-run-thr_pc5riqrbav
branch
October 19, 2026 22:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Editing a sent message was refused while the thread had background work running (a background command, agent, or workflow). The server rejected with 409 "Wait for background work to finish before editing the message", and the app independently hid the Edit action and disabled the edit composer's Submit button on the same condition. Once a turn ended with background work still open, there was no way to edit without stopping the thread first. The app kept its own copies of the server's thread-level edit rules (provider supports session rewind, thread not archived/deleted, no background work), so the rules could drift between client and server, as they did while fixing this.
What changed
apps/server/src/services/threads/thread-edit-message.ts: removed the background-work 409. After stopping the active turn, if the thread still has open background tasks, the edit performs a full stop withrequireStopped(settling those tasks as stopped/interrupted) before rewinding. If that stop fails, the edit is rejected and history is untouched. Together with Keep background work settlements across message edits #5656, a task card that started before the edited message is kept with its stopped status; cards after it are removed with the replaced history.apps/server/src/services/threads/thread-message-edit-policy.ts(new): one function for the thread-level edit rules (provider supports session rewind, thread not archived or deleted). The edit route enforces it at each checkpoint, andtoThreadResponseFromThreadexposes it as the newcanEditMessagesfield on the thread response (packages/server-contract). The plugin runtime's thread DTO reportsfalsewhen the host has no provider registry.apps/app:canEditSentMessagesreadsthread.canEditMessagesinstead of re-deriving provider capability and archive state, and the background-work gates were removed from both the Edit action and the edit composer's Submit (ThreadDetailView.tsx,ThreadDetailPromptArea.tsx); the now-unusedactiveBackgroundAgentCountprop is removed.canEditMessagesfield.No host-daemon wire change.
How you verified
apps/server/test/threads/thread-edit-message.test.ts: for each oflocal_bash,local_agent,local_subagent,local_workflow, the edit stops background work before the rewind, the earlier card endsstopped/interrupted, the later card is removed, and nothing is left open; a failed stop leaves history unchanged; the thread payload'scanEditMessagesand the edit route agree for an unsupported provider and an archived thread.pnpm exec turbo run typecheck lint --filter='...[origin/main]': 122/122 tasks pass. Focused vitest runs: edit-message + environment-restore server tests (66 passed),ThreadDetailPromptAreatests (54 passed).pnpm start:worktreewith a Claude Code thread, driving the UI in a browser:stopped, the replacement turn runs, and the running-background-command banner clears.bb thread show --jsonreportscanEditMessages: true.🤖 Generated with Claude Code