Skip to content

fix: restore guest message forking in the chat menu - #185486

Merged
shakkernerd merged 1 commit into
mainfrom
guest-message-fork
Oct 27, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
guest-message-fork

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #185414

What Problem This Solves

Guests with session read/write access cannot choose Fork from here on a persisted user message in their own settled conversation. The message menu suppresses the action even though the Gateway already supports that guest-owned fork. Users have no ordinary UI route to branch the conversation without broader access.

User Impact

Eligible guest owners can fork from a saved user message using the existing message menu. The fork keeps the preceding conversation context and restores the selected message as a draft, as the existing operation does for broader writers. Read-only and foreign-session access remain restricted, active runs keep the action disabled, and the Gateway retains its ownership, agent, runtime and sandbox checks. This change introduces no new permission, configuration option or stored representation.

Why This Change Was Made

The chat action adapter already receives the selected session row and calls the shared method-access policy. Its Stop action opts into the session-scoped grant, but its message-fork action still requires broad write access. The fix passes that existing opt-in and row for sessions.fork; the pane already repeats the access check at invocation, so no new callback or authorization mechanism is needed.

One focused regression extends the adapter's existing scope tests with owned, foreign, missing-ownership and read-only cases. The guest control documentation now names message forking. Whole-conversation forking and recovery use separate entry points and are outside this correction.

Evidence

The live baseline reproduced the missing action on the same persisted second message: the guest menu exposed Reply and Copy as markdown, while the administrator menu also exposed Fork. Neither inspection sent a fork request. The baseline served source was 22cd584794efafce3b2df2f1f41ad7a8276fd847; the relevant UI, shared scope and backend authorization/fork owners were unchanged at the repair base c8ea362fdaf94b50b5a9280d806f6b2eceada94c.

Remote pre-commit validation passed on the exact committed tree: changed-file formatting/lint, the selected production and consumer type graphs, and 154 focused tests. The new adapter regression failed at the guest-owner assertion with the original producer, then passed with the fix. Its three-test file took 1.49 seconds in Vitest (3.03 seconds through the repository runner); the 151 shared-access and message-view controls passed in 11.32 seconds in Vitest. Those controls cover read-only and foreign ownership, broader writer/admin access, persisted message targeting and active-run disabling.

On exact head 029fe02b7b2d42ebaa326dac8aaf93574358289e, the same guest completed one fork through the ordinary message menu. UI and Gateway readbacks verified the guest-owned child, parent link, preceding exchange, excluded cut point and restored draft. The source conversation's returned history was unchanged. One normal continuation completed a read-only command in the expected container; Fork was disabled while that run was active. The foreign guest's menu omitted Fork and the administrator's menu retained it, with neither control sending a fork request.

Hosted CI and the required exact-head gate passed. The screenshots and recording below bind the visible result to that same head. The pre-existing live foreign-session denial is applicable; a true read-only live identity was unavailable, so the read-only control is deterministic coverage. No transcript byte-equality or exhaustive sandbox-isolation claim is made.

Visual evidence

Open preview

Before After
Guest owner menu offers Reply and Copy, with Fork absent Same guest message menu includes enabled Fork from here

Exact-head guest message-menu fork

guest-ui-fork.webm

Visual verification

  • Baseline: 22cd584
  • Exact head: 029fe02b7b2d42ebaa326dac8aaf93574358289e
  • Scenario: A session-only guest opens the second saved user message, chooses Fork from here, and receives its own child conversation with preceding context and the selected message restored as a draft.
  • Runtime/build: OpenClaw native development Gateway and Vite at exact 029fe02; served fork adapter SHA256 1b65f8b0ac7c2eca70be47ebb964b0600a9302432243c9f1402bcbbd80d8230c; Chromium, light theme, 100% zoom.
  • Fork action: Absent before; present and enabled after
  • Requests: One UI fork request, no duplicate fork
  • Result: Guest-owned child; earlier exchange retained, selected turn excluded and restored as draft; source history unchanged
  • Same saved source message, viewport, light theme and framing. Sidebar inventory and relative timestamps reflect other retained Lab work; the tested conversation is unchanged.
  • Guest ownership, parent link, persisted cut point and draft verified through real UI and Gateway readbacks.
  • One normal continuation completed; active-run Fork disabled; foreign guest menu denied and administrator control preserved.
  • Read-only scope denial is deterministic; no live pure-reader identity or raw transcript byte-equality claim.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XS labels Oct 27, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allows eligible guests to fork from saved user messages in their own conversations through the chat menu.

Example: A guest with operator.sessions.write opens the second saved user message in an owned, settled conversation.

  • Before: The menu offers Reply and Copy as markdown, but omits Fork from here.
  • After: Fork from here is available and uses the existing Gateway fork operation.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal, justified repair supported by inspected browser evidence, recorded live fork validation, and successful exact-head gates.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser screenshots directly show the changed guest menu behavior; the exact-head live account records a completed fork with child/source readbacks and foreign-guest denial, with read-only denial covered deterministically.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Guests cannot branch their own settled conversation from a saved message despite already holding the required Gateway permission.
Reason: The maintainer-authored change restores an existing documented capability and preserves the established authorization owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main permission mismatch with a focused change to the existing policy adapter; no actionable defects remain.

Priority: P2
Reviewed head: 029fe02b7b2d42ebaa326dac8aaf93574358289e

Before merge

None.

Findings

None.

Agent review details

How this fits together

The chat adapter combines connection capabilities and session ownership into menu permissions; the pane dispatches fork requests, and the Gateway independently authorizes and persists the child conversation.

flowchart TD
  A[Gateway scopes and session ownership] --> B[Shared session access policy]
  B --> C[Chat action adapter]
  C --> D[Message menu and invocation check]
  D --> E[Gateway fork authorization]
  E --> F[Child conversation and restored draft]
Loading

Technical review

Best possible solution:

Merge the existing two-line policy opt-in with its focused regression and documentation.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically denies the narrow guest grant at the adapter, matching the reported reproduction and inspected baseline screenshot; this review did not execute target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair: it reuses the shared scope and ownership policy, preserves invocation-time checks, and adds no competing authorization mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 32d0945d21d2.

Provenance checked

  • Chat message-fork access keeps the original intent (af2f9c4: The original policy aligned UI actions with Gateway scopes; later guest-control work established the narrower ownership-aware grant.)
  • Guest control documentation keeps the original intent (2a88df0: Document which browser operations use the existing session grant while retaining privileged-operation restrictions.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Focused introduced change: The pinned introduction diff adds sessionScope and the selected session to the existing sessions.fork access request, with a focused regression and matching documentation. (ui/src/pages/chat/chat-session-action-access.ts:27, 029fe02b7b2d)
  • Current main still needs the repair: Fetched main requests broad operator.write for message forks without opting into the existing session grant. (ui/src/pages/chat/chat-session-action-access.ts:24, 32d0945d21d2)
  • Existing permission owner: The shared policy resolves opted-in forks to operator.sessions.write and rejects narrow writers without owner/admin session authority; the pane supplies the current row and repeats the access check at invocation. (ui/src/lib/session-method-access.ts:71, 029fe02b7b2d)
  • Gateway enforcement remains authoritative: Own-session authorization checks the authenticated creator and current session-write scope; the fork owner carries authorization assertions through asynchronous preparation into the storage commit guard. (src/gateway/server-methods/sessions-rewind.ts:500, 029fe02b7b2d)
  • Inspected browser evidence: The downloaded before/after screenshots directly show Fork from here absent and then enabled on the same saved message. The PR also records an exact-head browser fork, child and source readbacks, continuation, active-run disabling, and foreign-guest denial. (029fe02b7b2d)
  • Recording inspection limitation: The manifest reports “ffprobe failed: spawnSync ffprobe ENOENT”; browser fallback also failed because Chromium exited with “chrome_crashpad_handler: --database is required”. The recording was not independently inspected; this host limitation does not invalidate the inspected screenshots or supplied live evidence.

Likely related people:

  • Shakker: Raw commit 2a88df0 adds ui/src/pages/chat/chat-session-action-access.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2a88df00f68d; files: ui/src/pages/chat/chat-session-action-access.ts)

PR surface

Source +2, Tests +21, Docs +1. Total +24 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 0 +2
Tests 1 21 0 +21
Docs 1 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 25 1 +24

Labels

Label changes:

No label changes.

Label justifications:

  • P2: An authorized guest cannot branch an owned conversation through the message menu, while ordinary conversation remains available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-27T05:24:39.328Z sha 029fe02 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-27T05:39:06.976Z sha 029fe02 :: needs maintainer review before merge. :: none

Reviewed October 27, 2026, 1:44 AM ET / 05:44 UTC (Revision 3).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 27, 2026
@shakkernerd
shakkernerd merged commit de6ac4f into main Oct 27, 2026
138 checks passed
@shakkernerd
shakkernerd deleted the guest-message-fork branch October 27, 2026 06:51
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: guest owners can fork saved messages from the chat menu under their existing session permissions.

@shakkernerd shakkernerd self-assigned this Oct 27, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
Restore message forking for eligible guest owners through the existing session permission policy.

Fixes openclaw#185414.
RomneyDa added a commit that referenced this pull request Oct 28, 2026
Restore message forking for eligible guest owners through the existing session permission policy.

Fixes #185414.

(cherry picked from commit de6ac4f)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Guests cannot fork their own messages from the Control UI

1 participant