Add experimental sent-message editing - #1280
Conversation
d469223 to
29ce093
Compare
|
🚨 SLOP COP 🚨 · I am the SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior. |
SawyerHood
left a comment
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
ELI5: This feature lets a user change an old message. BB removes later chat events and asks the provider to answer again.
I found three defects that must be fixed before merge.
- The edit waits for a host rewind without a shared thread lock. A send, queued message, or interaction can change state during that wait.
- The edit API removes the agent caller identity. An agent can edit another root thread and start the replacement with user permission policy.
- The API accepts any operation ID. Two different IDs can map to the same Pi session file and use the wrong checkpoint.
I also found six other defects.
- Each prepared rewind keeps a provider session and two runtime entries until the daemon restarts.
- The inline editor puts the caret at the end. It does not select the existing message.
- A completed new turn restores the edit action only on the latest message. A page reload restores actions on earlier messages.
- A connected client reloads history after realtime already reloads the same history.
- The search suffix delete has no
(threadId, sourceSeq)index. It can scan a full long-thread search history under the write lock. - The client does not check the active background-agent count. It can show an action that the server rejects.
The supported provider list also appears in the client, server, and runtime. A shared provider capability would reduce policy drift.
I tested the feature with the local app and a real Codex thread. A first-message edit worked, and an earlier edit removed the complete later suffix.
The final provider output was FINAL-REPLY. The removed secret and second turn were absent from the server timeline.
The five package type checks passed. The 68 focused app, server, and runtime tests passed.
09d202e to
fca1801
Compare
3e3c82a to
520a045
Compare
Summary
editMessagesexperiment enforced by both the app and serverbb thread edit-messageBehavior
Opening or cancelling the inline editor is client-local and non-destructive. Submitting an edit stages provider history through the turn before the selected message, atomically replaces the selected conversation suffix, keeps workspace changes, and starts the edited turn.
Claude Code uses the latest assistant UUID with
forkSessionandupToMessageId. Pi records the session leaf entry and branches through it. Legacy Claude Code or Pi history without a checkpoint rejects safely when a retained turn is required.Review hardening
(thread_id, source_seq)and add a generated migration plus exact query-plan coverageValidation
The Pi smoke pass used
openai-codex/gpt-5.6-lunabecause the configured Anthropic route was out of extra usage.Related to #1114