Repository navigation
fix: preserve Draft audience when forking from a message - #186820
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesMessage-level forks preserve Draft audience and refuse creation when current policy disables Drafts. Example: A guest selects Fork from here in a Draft conversation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current audience-inheritance bug through the existing storage owners; no actionable patch defect remains. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI sends sessions.fork with a selected message; the Gateway authorizes creation, the shared planner selects history and audience, and SQLite or memory storage installs the child before recipient-filtered publication. flowchart TD
A[Message menu] --> B[Gateway fork handler]
B --> C[Current creation policy]
C --> D[Shared message cut planner]
D --> E[SQLite or memory commit]
E --> F[Recipient filtered history and events]
Technical reviewBest possible solution: Preserve Draft in the shared planner and enforce current creation policy at the existing commit boundaries. Do we have a high-confidence way to reproduce the issue? Current-main source omits Draft on fresh message-cut children, whose reader default is Shared; the linked report supplies matching SQLite, memory, and browser observations. Is this the best way to solve the issue? The patch fixes the producer, reuses the existing visibility-policy resolver, and covers both storage owners without introducing another persistence or authorization path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f20d1f4000fe. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +60, Tests +68, Docs 0. Total +128 across 8 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 1:17 PM ET / 17:17 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: Fork from here preserves Draft audience and refuses new Draft copies when Draft creation is disabled. |
Preserve Draft audience from the first committed row of local message-cut forks and refuse new Draft copies when Draft creation is disabled, including policy changes during preparation. Closes openclaw#186773.
Closes #186773
What Problem This Solves
Fork from here on a user message in a local Draft conversation currently creates a Shared conversation. The caller selects a message boundary, not a broader audience, but the copied prefix becomes available under the Shared policy. The original conversation remains Draft, so its access restrictions do not protect the new copy.
This change covers message-cut forking through
sessions.fork. Whole-conversation copying and externally owned harness forks have separate owners.User Impact
When Draft creation is enabled, a local message fork stays Draft from its first committed row. The prefix ends before the selected user request, and the selected request and supported attachments return to the new composer unsent. The source and its history remain intact.
If Draft creation is disabled, the operation returns a policy error explaining that the user can continue in the existing conversation or ask an administrator to enable Drafts. A policy change during preparation also refuses the new copy; it never silently substitutes Shared. Existing Draft conversation work, Shared-source forks, workspace rules, and rewind/branch-switch behavior retain their contracts. There is no new configuration option, public request field, or schema.
Why This Change Was Made
The local message-cut planner creates a new identity from selection, creation and workspace metadata, but omits Draft audience. Both SQLite and memory storage install that planned entry, which then resolves to the Shared default.
The planner now carries Draft from the actual source row when creating a fork. The Gateway applies the existing visibility-creation policy against current committed configuration. Its private assertion runs through the existing transaction acceptance points, including the memory actor's final authority check after asynchronous observers. A refused candidate rolls back, and the existing repository-fork cleanup retains responsibility for an unclaimed workspace.
Evidence
The current-source regression used the real Gateway handler and actual SQLite and memory stores. Before the correction, the two Draft cases each reported expected
draft, receivedshared; the other 32 cases passed. The existing storage matrix also checks the exact copied prefix, source preservation, child identity, and workspace behavior. Additional cases exercise initially disabled policy and disabling at final acceptance for both backends, checking that refused operations leave storage unchanged.Focused validation passed across 12 related native test files (156 cases), affected production/test types, changed-file formatting and lint, and the enforced per-file line cap. The refreshed storage/handler batch passed 64 cases in 137.42 seconds; this includes the real worker and memory lifecycles. The accepted-base test counter reports 6,301,602 lines against the existing 6,310,000 ceiling.
On the exact candidate build, a real guest created a Draft source, received a useful planning answer, and used Fork from here on the selected user request. The new conversation was Draft on its first row, with only the earlier readiness exchange in history; the exact selected text and image returned unsent. Sending that input produced a useful answer. The original identity, audience, last run and workspace metadata stayed unchanged. An unrelated guest could open neither original nor copy, while the Shared-source control remained readable with a disabled composer.
With
session.sharing.drafts: false, the existing Draft retained its staged text and image, accepted another ordinary turn and remained the same Draft. A subsequent message fork returnedSESSION_VISIBILITY_DISABLED, preserved the current conversation and unsent note, and created no destination. A Shared-source fork still succeeded. Native SQLite and memory cases cover initial refusal and policy changes during preparation; the live UI scenario uses durable local storage.Hosted CI completed successfully on this head. One storage diagnostic test failed in the first attempt, did not reproduce in the unchanged-base replay, and passed in the single diagnostic CI retry with the same pinned runtime and test group. No code-fix or inherited-failure claim is made for that transient result.
The retained baseline copied only a neutral readiness exchange; it proves an audience change, not useful post-Draft content or file exposure. The candidate adds an image and useful continuation to that baseline. Latest stable already has the same Draft visibility representation and creation-policy contract; this patch introduces no migration or old-row reader change. No live latest-stable upgrade was run. Independent review is clean; the exact-head automated reassessment reports Platinum readiness and no findings.
Visual evidence
Owner uses Fork from here; selected text and image remain unsent
fork-action-cued.mp4
Visual verification
a334bd753a2bba08e63d56a17b5d3b60b20660adExisting Draft continuation succeeded while new Draft creation was disabled; the next fork was refused and the pending note remained unsent: