Repository navigation
Description
Parent roadmap: #261. Related work: conversation management #247 and turn/tool/job/receipt correlation #372.
Goal and scope
After stopping an Agent turn, let users edit its originating user message and resend it in the same conversation. Preserve earlier conversation context, attachments and project references.
User flow and rules
- Wait for the turn to reach a terminal state before enabling Edit and resend on its originating user message.
- Open the original text, attachments and reference selections in the composer. Allow editing, cancellation and submission; retain the draft on failure.
- Resending creates a new attempt linked to the original message and stopped turn. Preserve the original text, partial reply, tool calls and execution records for inspection.
- Build the new runtime context from the conversation before the edited message plus its revised content. Exclude the superseded request and stopped reply from the active conversational path. Ensure native runtime session state follows the same context.
- Existing project changes and accepted jobs remain authoritative. Expose their current outcomes to the new attempt so it can reuse results or query ongoing/unknown work before submitting again.
- Keep stop-response, orchestration stop and accepted-job cancellation semantics explicit. Editing and resending does not roll back project changes or cancel accepted jobs.
- Validate conversation revision and active-turn state on submission. Concurrent edits or a newly active turn return an actionable conflict.
- Initial scope covers the last user message associated with the stopped turn. Earlier-message editing requires separate scope.
Implementation impact
Reuse conversation persistence, drafts, turn submission and stop services. Add the minimal revision/attempt relationship needed for history and context selection. Provide a shared edit/resend operation for UI and Agent/CLI access with discoverable help. Verify adapter-specific session rewind, branching or reconstruction against actual runtime capabilities.
Acceptance criteria
- Stop a streaming turn, edit its user message and resend with earlier context, attachments and references preserved.
- The new attempt receives the revised request once; the superseded request and partial reply do not leak into active context.
- Original and revised attempts remain inspectable after reload and project reopening.
- Cancel editing and simulate save/submission failures without losing the original message or draft.
- Reject stale revisions and concurrent active turns without duplicate attempts; retry an uncertain submission using the original operation identity.
- Exercise a turn that already changed the project or accepted a generation job. Preserve those facts and avoid automatic duplicate generation.
- Verify supported Default, OpenCode, OpenJiuwen, Codex and dsh runtime paths with actual continuation/context evidence; document any unsupported path explicitly.
- Verify equivalent shared-operation behavior through UI and Agent/CLI, and complete English/Chinese interactions.
Decisions to confirm
Choose how the UI displays original and revised attempts while keeping execution history accessible.
Activity
Zhangbo-cn commentedon Nov 17, 2026
I would like to take this one. Before writing code I read the current paths and measured one assumption, because it changes how much of the acceptance list is actually new work. Two questions at the end need your call.
Native session resume invalidates itself, measured
Excluding the superseded pair from the active path is enough to make every native runtime rebuild from authoritative history. The reuse predicate in
context.py:42requires an exact message count:Driving the real
RunContextwith no CLI and no model:So a resend returns
Nonefromnative_session_id(), andnative.py:177-181then rebuilds the conversation from full history. The turn after the resend resumes normally against the new session, so this does not leave the conversation permanently unable to resume. OpenCode, Codex, Claude and dsh all read the same predicate throughnative.py:177; JiuwenSwarm reads it throughjiuwenswarm.py:143.One consequence to decide on rather than hide:
session_directoryis only computed whensession_idexists (native.py:178), so for Codex, Claude and dsh a resend also drops the reusedworkdirectory and starts a fresh one (reuse_workspacebecomes false atnative.py:192). Files the stopped turn published as assets are unaffected; uncommitted scratch files in that workspace are not carried over. I would document this as intended rather than add workspace-rewind logic, unless you want the workspace preserved.If that reading is right, acceptance item 7 becomes "show that all five paths take the rebuild branch" instead of implementing per-adapter rewind, which is a unit test on the predicate plus one stub-endpoint end-to-end run.
What already satisfies the list
agent.py:348and the re-check at:470already return 409.agent.py:134.<turn>.model.jsonl,<turn>.<runtime>.jsonl), and a resend needs a new turn id anyway, so the old files are untouched.stoppedandinterruptedalready exist andAssistantPanel.tsx:489already renders them.The genuinely new work is the edit/resend operation itself, the active-path exclusion, and draft retention on failure.
Two questions
1. Where does the revision relationship live? Messages in
conversation.jsonare a flat array whose entries carry no parent or revision link today. I can add a minimal link on the message entries, or wait for #372'sturn_id → call_id → jobIdcorrelation model and hang it off that. #372 (@yefuyou) and #247 (@MrDongsls) both modify this same file, so whoever lands first sets the shape. I would rather not introduce a second relationship concept — which of the two do you want this to follow?2. Is the display decision settled? Your "Decisions to confirm" asks how original and revised attempts appear. I do not want to guess at information architecture and rework it in review. If you have a preference (inline superseded-and-collapsed, versions behind the user message, or something else), I will build that.
Proposed slice
Assuming you are fine with it: Default runtime plus the UI, covering the edit/resend operation, active-path exclusion, stale and concurrency rejection, and draft retention, with bilingual copy. Tests go through the existing
--assistant-fixtureserver so no paid provider is involved, and each test is mutation-checked against the pre-fix revision.I would leave out of this PR, as separate scope: the Agent/CLI entry point for acceptance item 8, since
cli.pyhas no assistant or conversation command group at all today (the seven groups areasset canvas job model project timeline video), so that is a new surface rather than a flag; and editing any message other than the last, which your scope note already defers.If you would rather have the CLI side in the same change, say so and I will include it.
yefuyou commentedon Nov 17, 2026
Thanks for the detailed investigation, @Zhangbo-cn! I'm working on #372 in PR #374 and wanted to clarify the boundary so this doesn't block your implementation.
#374 persists the originating Agent turn ID and tool-call ID on accepted generation Jobs, and adds a read-only lookup at
GET /api/creation/projects/{project_id}/assistant/turns/{turn_id}/jobs. It does not changeconversation.jsonor introduce a message-revision/attempt model.For edit-and-resend, my suggestion is to keep a minimal revision link on the conversation message/new attempt, rather than attach message revisions to the Job lineage. They answer different questions: "which message/attempt revises which?" versus "which turn submitted this Job?" The original user message ID is already used as the turn ID in the current submission path, so #375 can retain that ID and look up the original turn's accepted Jobs through #374 once it lands.
One important limit: the endpoint makes existing Jobs and their outcomes discoverable, but it does not automatically decide whether a revised attempt should reuse work or submit a new generation. That decision stays with the edit/resend flow.
This should let the two changes evolve independently. No need to wait for #374 to define the conversation revision structure. Happy to help if you encounter a concrete integration gap.