Skip to content

fix: show access guidance when New Session Git discovery is denied - #139030

Merged
shakkernerd merged 2 commits into
openclaw:mainfrom
ylcn91:fix/session-group-defaults-scope-error
Oct 20, 2026
Merged

shakkernerd merged 2 commits into
openclaw:mainfrom
ylcn91:fix/session-group-defaults-scope-error

Conversation

@ylcn91

@ylcn91 ylcn91 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #138955 and #139024.

What Problem This Solves

New Session reports a Git verification failure when the Gateway has actually denied permission to discover the selected folder's branches. With a selected or restored worktree choice, Start remains blocked and tells the user to choose the folder again to retry. Repeating that request cannot supply the missing access.

This affects both a connection missing the method's operator.write scope and a write-scoped connection whose selected path requires operator.admin. The latter was the original case in this contribution; a method-level denial does not establish that the folder is outside the agent workspaces.

User Impact

The Start explanation, Checkout picker, and command-palette Worktree switch now identify denied discovery as an access problem. When the Gateway provides a missing scope, the explanation names that scope and directs the user to the person who manages OpenClaw. A denial without scope details gets general access guidance. Ordinary discovery failures keep their retry message.

The selected isolation mode and unsent draft remain intact, and the existing creation gate continues to block an unverified worktree. This change grants no permissions, changes no defaults, and introduces no automatic switch to another checkout mode.

Why This Change Was Made

The repository-discovery owner previously discarded the error when marking Git discovery unavailable. This contribution preserves a separate forbidden state using the existing missing-scope reader and a typed denial check. The three existing displays consume one explanation helper. Its current Solid consumers replace the older rendering locations used by the original patch.

The explanation uses the permission facts supplied by the Gateway. It no longer assumes every missing scope means an outside-workspace folder or tells every user to request admin access through Devices. Existing backend path-containment and method-admission rules are unchanged.

Evidence

A focused reproduction on the target's unchanged production owner failed at the exact explanation: the permission-denial fixture received the generic Git-retry message while the worktree creation gate remained closed. The regression extends the existing draft/submission fixture rather than mocking the explanation helper.

The corrected head passes changed-file formatting/lint, i18n verification, the line-cap check, all selected compiler checks, and 148 tests across nine related files (19.41 seconds for the test runner). Single-worker checks with pnpm test ui/src/pages/new-session/submit-gates.test.ts --maxWorkers=1 passed the corrected 26-test suite in 2.96 seconds wall time (1.97 seconds Vitest); pnpm test ui/src/pages/new-session/draft-place-state.test.ts --maxWorkers=1 passed 53 tests in 3.95 seconds wall time (3.01 seconds Vitest). The selected hosted CI jobs used 5,338 seconds of aggregate job elapsed time. A paired-device regression also reproduced generic source-selection text taking precedence over a permission denial; its corrected case and ordinary remote-failure control now pass. The cases cover write-scope and admin-scope denials, a denial without scope details, ordinary discovery failures, saved and explicit isolation, unsent input, stale responses, and reconnect recovery after a synthetic access grant. The current CI run passed all selected UI/browser, lint, documentation, test-type, and boundary checks. Its production core typecheck failed with 809 DOM/JSX diagnostics that exactly match an executed unchanged-baseline reproduction at 37e60afc6d2ffb3dab5dee16a52f2aae2554d4ab; compiler, dependency, and causal helper inputs also match this PR’s actual CI merge. The browser-importing test-helper repair is tracked in #178306. This failure remains recorded as inherited, rather than reported as a passing check.

The production Control UI browser proof compares base d6bc6379147de87a9296a66ddedd9fff0f610e6c with head 6053e0290109b8606802d0b519a88094f9deaa76. All four after scenarios passed: saved local worktree intent after denied discovery, unchanged transient-failure guidance, remote-placement explanation precedence, and a separately restored command-palette draft. Keyboard and blocked-click attempts recorded zero creation, dispatch, or send requests; the unsent drafts, isolation choice, and foreground draft/caret remained intact. Served entry bytes and production-source hashes bind the captures to these public revisions.

The browser exercises the real UI and typed client with synthetic Gateway replies and device metadata. The remote-placement case is simulated and does not claim real paired-device execution. The comparison images and recording below show the changed explanations and preserved state.

Visual evidence

Open preview

View Before After
Permission denial — Start Permission denial — Start before: generic retry or source-selection guidance Permission denial — Start after: truthful access guidance with selection preserved
Permission denial — Checkout Permission denial — Checkout before: generic retry or source-selection guidance Permission denial — Checkout after: truthful access guidance with selection preserved
Simulated device — Start Simulated device — Start before: generic retry or source-selection guidance Simulated device — Start after: truthful access guidance with selection preserved
Separate palette draft Separate palette draft before: generic retry or source-selection guidance Separate palette draft after: truthful access guidance with selection preserved

Exact-head Start, Checkout and palette interactions; remote placement is simulated

after-interactions.webm

Visual verification

  • Baseline: d6bc637
  • Exact head: 6053e0290109b8606802d0b519a88094f9deaa76
  • Scenario: Restore saved worktree intent, receive a typed Git discovery denial, inspect Start and Checkout, and attempt keyboard submission while preserving the unsent draft. A separate palette draft and simulated remote-placement case exercise sibling displays. Gateway replies and device metadata are synthetic.
  • Runtime/build: Production Control UI bundles from the public base and candidate; served entry SHA256 f66226e1a1c236e3c44a68c00bfe848a491464d13702b299f4dbafec4f130de6 -> 38b4b7fbf44e012371b0591ea11fa85688ef5fc99009c1521f0f4d901bf8d0d7; isolated Chromium with mocked Gateway.
  • Creation / dispatch / send calls: 0 in every scenario, from the complete fixture recorder
  • Protected state: Unsent drafts and worktree intent retained; palette leaves foreground draft and caret unchanged
  • Transient control: Existing Git retry explanation retained before and after
  • Scope of proof: Real browser UI and typed client; synthetic Gateway replies and device metadata, not a real paired-device run
  • All four after scenarios passed on the public candidate
  • Matched base/candidate viewport, route, fixture and selected source
  • Served entry bytes match the captured build; production hashes match Git source
  • Original source recordings retained; the combined recording joins unchanged video streams

@clawsweeper

clawsweeper Bot commented Sep 5, 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.

@ylcn91
ylcn91 marked this pull request as ready for review September 5, 2026 11:02
@ylcn91
ylcn91 requested a review from a team as a code owner September 5, 2026 11:02
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M labels Sep 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR distinguishes denied Git discovery from ordinary failures and shows access guidance in New Session.

Example: A saved New worktree draft receives a worktrees.branches denial requiring operator.write.

  • Before: Start says to choose the folder again to retry.
  • After: Start names operator.write and directs the user to the person managing OpenClaw, while retaining the draft and worktree choice.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful repair with directly visible browser evidence, meaningful owner-boundary regressions, and no actionable finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots exercise the built Control UI's Start, Checkout, remote-placement explanation, and separate palette draft with synthetic Gateway denials; they directly demonstrate the changed presentation and retained state, without claiming real device execution or access-grant recovery.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A permission refusal tells users to retry Git discovery even though repeating it cannot grant access.
Reason: The existing contract requires truthful blocking explanations, and collaborator direction explicitly retained this New Session repair after the overlapping backend work landed.

Merge readiness

✅ Ready for maintainer review

Keep this PR: current main still misreports denied Git discovery, the narrowed fix follows collaborator direction, and no introduced correctness or security defect was found.

Priority: P2
Reviewed head: 6053e0290109b8606802d0b519a88094f9deaa76

Before merge

None.

Findings

None.

Agent review details

How this fits together

The New Session repository owner consumes Gateway discovery results and supplies checkout availability and explanations to Start, Checkout, and command-palette controls.

flowchart LR
  A[Gateway discovery reply] --> B[Repository state owner]
  B --> C[Shared explanation]
  C --> D[Start submission gate]
  C --> E[Checkout picker]
  C --> F[Command palette]
Loading

Technical review

Best possible solution:

Retain the narrow discovery-state and explanation fix while preserving the existing submission and Gateway authorization boundaries.

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

Current-main source deterministically converts a denied worktrees.branches request into unavailable, and the supplied browser comparison shows the resulting misleading retry guidance; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete fix: preserve denial facts in the existing repository owner and share their explanation across existing consumers without changing checkout intent or access decisions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 503ae08b7b16.

Provenance checked

  • Repository discovery failure classification changes intended behavior with a stated reason (495f295: The extracted repository owner retained the earlier distinction between confirmed non-Git folders and unavailable discovery, preserving isolation on failures.)
  • Worktree intent and reconnect behavior keeps the original intent (d8d70cf: Preserve explicit checkout details through reconnects and failed refreshes rather than replacing user intent.)
  • Remote-placement submission explanation changes intended behavior with a stated reason (1f6f0d4: Remote sessions can start in a new workspace, so unavailable repository sources receive source-selection guidance.)
  • Checkout and palette rendering keeps the original intent (74c7b3d: Move New Session rendering to Solid while retaining domain ownership, controls, and draft behavior.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +36, Tests +110, Docs +6. Total +152 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 45 9 +36
Tests 2 122 12 +110
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 173 21 +152

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Misleading recovery guidance affects selected or restored worktree drafts without changing authorization or losing their input.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster 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 (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-12T05:28:48.337Z sha 47bbc0f19e8943d54dfc4c03fbc0bacea9dc51c3 :: needs changes before merge. :: none
  • reviewed 2026-09-12T10:09:39.406Z sha fe7cf794231c2a1c75a5375c05d49830c3458cc9 :: needs changes before merge. :: none
  • reviewed 2026-09-17T19:21:42.190Z sha 329616d61001782520477fa0dd42cc28dd28fc48 :: blocked before merge. :: none
  • reviewed 2026-09-17T19:46:38.137Z sha 25c044477a49077d808a386a60090c763a07bf40 :: needs changes before merge. :: none
  • reviewed 2026-10-01T07:03:20.332Z sha 2fe36b5122c67415c6e43bbc939a00afce8b2eab :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-07T22:23:10.169Z sha 2fe36b5122c67415c6e43bbc939a00afce8b2eab :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T08:49:21.130Z sha 5d0ed3445d0f55d4dc2e376a201f5d959efc268e :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T09:00:38.745Z sha 5d0ed3445d0f55d4dc2e376a201f5d959efc268e :: needs real behavior proof before merge. :: none

Reviewed October 20, 2026, 4:17 PM ET / 20:17 UTC (Revision 26).

@ylcn91

ylcn91 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Note for reviewers: #139024 (opened 17 minutes before this one) fixes the same report at the same Gateway boundary, with the same missingScopeErrorShape swap in resolveAuthorizedRepoRoot; I saw it only after pushing. Where this PR differs, so the two can be weighed on substance:

  • Sibling surface: the New Session page probes worktrees.branches through DraftRepositoryController and had the same misreport (checkout chip and cloud-placement reason said "Couldn't verify Git"). This PR routes that probe through the same forbidden repository state and repositoryIssueText; fix(gateway): session group defaults show admin requirement instead of a Git error for outside-workspace folders #139024 leaves the New Session page unchanged by stated scope.
  • The dialog keeps the refusal as a discriminated { kind: "forbidden", missingScope } and interpolates the scope into the message (newSession.folderRequiresScope) instead of a fixed admin string, so the UI does not hardcode which scope the Gateway requires.
  • environments.list's runtimeId check gets the same structured MISSING_SCOPE details next to its unchanged legacy message; docs (docs/gateway/operator-scopes.md, docs/web/control-ui.md) state the refusal shape and the dialog behavior.
  • Proof: before/after screenshots from the mocked-Gateway Control UI e2e, the e2e and Gateway regressions captured failing on main, and unit coverage for the controller and gate text.

Happy to fold the New Session path into #139024 as a follow-up instead if maintainers prefer landing the earlier PR.

@ylcn91

ylcn91 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Added the live Gateway proof ClawSweeper asked for, under "Live Gateway proof" in the PR body: a real Gateway built from this branch, a Control UI device paired with operator.read/operator.write only, the worktrees.branches refusal in the canonical FORBIDDEN + MISSING_SCOPE shape with the dialog naming the requirement, then Inbox › Limited access › Request admin, an out-of-band device.pair.approve by a Gateway admin (pairing record silent → owner, scopes widened, pending cleared), the same device reconnecting with admin scopes, and the same folder saving as a Local default. Screenshots, two short recordings, and the redacted RPC frames are in the body.

@ylcn91

ylcn91 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
@ylcn91
ylcn91 force-pushed the fix/session-group-defaults-scope-error branch from 44d65ec to 27635ee Compare September 6, 2026 10:58
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 6, 2026
@ylcn91

ylcn91 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Applied the P1 in bdd12095fee: the rebase onto main (against #139417's folder-browser refactor) had dropped the dialog's readMissingScopeError import while the catch block still used it, so a refused probe threw and the dialog stayed on Checking Git. The import is restored; no other change.

The existing e2e case is the regression guard: on 27635ee "explains the admin requirement for a folder outside the agent workspaces" fails with expected 'checking' not to be 'checking' (CI had stopped at the shared preflight output-size failure, so checks-ui never ran on that head); on bdd12095fee the file passes 10/10, tsconfig.ui.json typechecks, and check:changed passes. Details under Rebase repair in the PR body. The live Gateway proof was captured on 44d65ec, whose refusal/Request admin/Save path is source-identical to this head; it was not re-shot.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 6, 2026
@ylcn91

ylcn91 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus. Rebased onto main (43d29bbdb11) and narrowed to the New Session surface: the Gateway, group-defaults dialog, and environments.list changes are gone, so the secops-owned test is no longer touched. The draft controller now maps the MISSING_SCOPE refusal from #139024 to a forbidden repository state, and the checkout chip, the palette Worktree switch, and the worktree submit gate name the admin requirement instead of "Couldn't verify Git". Single commit, +82/-11; submit-gates and draft-place-state tests pass, and the new case fails on main with expected { kind: 'unavailable' } to deeply equal { kind: 'forbidden' }.

@openclaw-barnacle openclaw-barnacle Bot added size: S and removed gateway Gateway runtime size: M labels Oct 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 1, 2026
@ylcn91
ylcn91 force-pushed the fix/session-group-defaults-scope-error branch from 2fe36b5 to 5d0ed34 Compare October 10, 2026 08:41
@ylcn91 ylcn91 changed the title fix: session group defaults show the operator.admin requirement instead of a Git error fix(ui): New Session explains the admin requirement for a folder outside the agent workspaces Oct 10, 2026
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@shakkernerd shakkernerd self-assigned this Oct 20, 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. 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 20, 2026
ylcn91 and others added 2 commits October 20, 2026 10:02
…ide the agent workspaces

Since openclaw#139024, `worktrees.branches` refuses a folder outside the agent
workspaces with the structured MISSING_SCOPE error, and the session-group
defaults dialog reads it. The New Session draft controller still collapsed
every probe rejection into `unavailable`, so the checkout chip, the palette
Worktree switch, and the worktree submit gate kept showing "Couldn't verify
Git for this folder. Choose it again to retry." for an authorization refusal
that a retry cannot fix.

- discovery / draft-repository-state: a MISSING_SCOPE refusal becomes the
  `forbidden` repository state carrying the missing scope
- checkout chip, palette Worktree switch, worktree gate: name the scope and
  the access-request path through the shared repositoryIssueText
- docs: note the refusal text on the New Session folder paragraph

Refs openclaw#138955
@shakkernerd

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@shakkernerd

Copy link
Copy Markdown
Contributor

Fixed: denied Git discovery now shows access guidance in New Session while preserving the draft and selected worktree isolation.

With thanks to @ylcn91.

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 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

3 participants