Repository navigation
fix: preserve Draft when copying conversations - #186828
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 changesPreserve Draft visibility when copying whole conversations and recheck current creation policy before persistence. Example: A guest copies a Draft containing saved working notes through Advanced → Fork conversation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Draft audience defect and remains worthwhile; no actionable code defects were found. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway creation owner receives authenticated session requests, prepares workspace and transcript state, and commits destination metadata consumed by sharing readers. flowchart LR
A[Control UI fork request] --> B[Gateway authorization]
B --> C[Session creation owner]
C --> D[Visibility and current policy]
D --> E[Transcript and workspace preparation]
E --> F[Guarded session commit]
F --> G[Per guest history access]
Technical reviewBest possible solution: Keep Draft inheritance and live creation-policy checks in the existing creation owner while preserving explicit audience choices and existing-session behavior. Do we have a high-confidence way to reproduce the issue? Current-main visibility resolution omits parent Draft inheritance, and the report supplies a concrete original-denied/copy-readable guest scenario supported by a baseline screenshot. Is this the best way to solve the issue? The producer-side repair fits the existing ownership boundary; the extracted fork preparation replaces its former inline implementation without adding competing policy or state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 745e8f2121c2. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +76, Tests +185, Docs +4. Total +265 across 9 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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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, 12:36 PM ET / 16:36 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: whole-conversation Draft copies now respect the current Draft-creation policy without silently becoming Shared. |
Preserve Draft visibility when copying a whole conversation, revalidate current creation policy before commit, and keep existing Draft conversations usable. Fixes openclaw#186771.
Preserve Draft visibility when copying a whole conversation, revalidate current creation policy before commit, and keep existing Draft conversations usable. Fixes #186771. Release adaptation: preserve the stable creation, model-authority, incognito actor, lifecycle, and target-custody owners. Adapt only conflicting tests/docs to existing fixture APIs; retain all stronger base tests. Apply the three-line authorization-release fixture companion from ede7af8 to the touched handoff tests. Bounded companion audit through 4b8fbc7: 82210a2|not-applicable|Only inactive-operator recovery documentation. Base live authority checks retained; no Draft policy dependency. caa978c|not-applicable|Future template initialization feature; base initializeSession/atomic creation contracts unchanged. abb2690|present-equivalent|Stable worktree fixtures already set config before allocation. Adaptation preserves that order and adds live policy change only after allocation. 987a9ef|not-applicable|Independent Android active-response child creation behavior; no change to preserved active-parent fork guards. 5088eac|not-applicable|Guest typing-preview authority/documentation; no Draft creation producer change. 95363ce|not-applicable|Separate parent-approved restricted-repository lane. Overlap with this delta is docs/gateway/operator-scopes.md only. This lane preserves current project/access owners. b9a3df0|not-applicable|Trusted-admin Access eligibility docs, not creation visibility. 65c8e20|present-equivalent|Stable service already calls prepareSessionPatchRuntimeSelection with current authority validation before creation. Preserve stronger runtime selection/release contracts; unrelated typing half excluded. d0e78b0|not-applicable|Actions widget approved-query policy documentation, no creation visibility producer. 7552558|not-applicable|Future Beam conversation handoff/initialization feature. Existing incognito actor storage and publication ownership retained. 3552814|not-applicable|Users-sidebar guest presence disclosure documentation, no copy creation dependency. 1139abe|not-applicable|Future native child repository workspace inheritance. Base session-create-project owner and destination preservation tests retained, no unrelated migration. dc843b6|not-applicable|Agent avatar scope documentation, no Draft copy contract. 5d3e157|not-applicable|Private person activity timeline docs, no Draft copy contract. ede7af8|selected|Necessary touched-fixture lifecycle companion. Base creation-handoff test acquires retained authorization without releasing it. Apply exact onTestFinished authorization.release cleanup (3 lines plus import) to preserve process-wide sharing-read ownership. 65a125a|not-applicable|Future attended permission defaults; existing stable permission-default behavior unchanged. d40aa7c|not-applicable|Independent creation-request replay feature across restarts; stable creation operation and custody contracts retained. f33f9c1|not-applicable|Workspace repository discovery documentation/UI, no creation policy dependency. 1347e90|not-applicable|Clarifies none-cap membership docs, no Draft copy semantics. e0ed68c|not-applicable|Token-counter format changed to version2 on later main. Stable token-version1 producer retained; fork cap/version fixtures pass on current stable contract. 975e68c|not-applicable|Future human-owner cron management/transfer feature documentation. 0731967|not-applicable|Restricted-role UI forbidden-request documentation; no copied-conversation producer. 1851659|not-applicable|Future scoped cron management documentation, no copied-conversation producer. 284c109|not-applicable|Guest tool preview documentation, no copied-conversation producer. 6d8ba30|not-applicable|Separate parent-approved spawned-Draft lane. Exact overlap src/gateway/session-create-visibility.ts. Preserve operator-only copy condition in this lane; parent must reconcile later spawned audience policy. (cherry picked from commit 5ff57b8) Co-authored-by: RomneyDa <[email protected]>
Fixes #186771
What Problem This Solves
Using Advanced → Fork conversation on a Draft creates a Shared copy without asking the creator to change its audience. The copy includes saved conversation history, so another signed-in guest can read text that remains unavailable in the original Draft. This happens during creation, before anyone sends a message in the copy.
User Impact
Whole-conversation copies of Drafts now remain Draft unless an existing authorized action explicitly selects another audience. The creator can continue the copied work using its saved history. If new Draft creation is disabled, the copy fails with guidance to continue the existing conversation or ask an administrator to enable Draft creation; it never silently falls back to Shared.
Existing Draft conversations remain usable after that setting is disabled. Explicit Shared choices, Shared-source defaults, per-row readers, source history and authority, workspace selection, active-source last-completed history, keyed adoption, and generic reset behavior retain their existing contracts.
Why This Change Was Made
The creation owner previously considered only an explicit visibility or a caller-supplied default. The ordinary fork action supplies neither, leaving the destination unstamped and therefore Shared. The owner now inherits Draft for an operator’s whole-conversation copy while preserving explicit choices and existing-key adoption.
The existing validator checks current configuration before workspace preparation and at the final creation boundary. A setting change during preparation uses the existing structured refusal and rollback path. The restriction ends once the row is committed, so it cannot block continued work in an existing Draft. Transcript import passes its existing live configuration getter to the same guard, preserving its initial default and keyed re-import behavior. Fork preparation moves into a bounded module with the same source, transcript, size, publication and workspace custody.
Evidence
On
39bb42e61507acd4d086551f1ab1314b5eb43e0f, 26 affected test files pass 431 cases, all 38 selected compiler graphs are qualified, and formatting, lint, structural checks and hosted CI pass. A retained pre-fix replay reproduced the settled-copy and active last-completed Draft failures. On the current candidate, removing only the import getter adaptation reproduces its policy-change failure while the other 15 import controls pass.The exact-candidate live run created a Draft through the ordinary UI, copied it without an audience choice, and completed useful model work in the copy. Independent metadata confirmed Draft at first commit and after continuation, with the creator still owner. A separate ordinary guest was denied the source and copy before and after continuation. Copied history and source identities were preserved; original file-write content matched the copy’s first read before a later requested edit in their intentionally shared Agent workspace.
After disabling Draft creation through the native configuration owner, the same copy action returned
INVALID_REQUESTwithSESSION_VISIBILITY_DISABLEDand visible guidance. An existing Draft still completed another useful turn. Final native inventory retained exactly the two original sessions and one existing sandbox workspace, with no partial child or workspace; the original configuration was restored afterward.The queued source-access regression also passes: revoking parent participation while the writer is held rejects the fork without a child or transcript write. Current-policy preparation/rollback tests, existing Draft adoption and re-import, the initially-disabled Shared import default, and unchanged reset controls pass. No stored representation or reader-policy change is introduced.
Visual evidence
Draft copy, disabled-creation refusal, existing conversation continuation and foreign denial
draft-copy-proof-final.mp4
Visual verification
39bb42e61507acd4d086551f1ab1314b5eb43e0f