Repository navigation
fix: show access guidance when New Session Git discovery is denied - #139030
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 changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +36, Tests +110, Docs +6. Total +152 across 9 files. Added test files: 0. View PR surface stats
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 (25 earlier review cycles; latest 8 shown)
Reviewed October 20, 2026, 4:17 PM ET / 20:17 UTC (Revision 26). |
|
Note for reviewers: #139024 (opened 17 minutes before this one) fixes the same report at the same Gateway boundary, with the same
Happy to fold the New Session path into #139024 as a follow-up instead if maintainers prefer landing the earlier PR. |
|
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 |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
44d65ec to
27635ee
Compare
|
Applied the P1 in The existing e2e case is the regression guard: on @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks @obviyus. Rebased onto |
2fe36b5 to
5d0ed34
Compare
…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
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: denied Git discovery now shows access guidance in New Session while preserving the draft and selected worktree isolation. With thanks to @ylcn91. |
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.writescope and a write-scoped connection whose selected path requiresoperator.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=1passed 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=1passed 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 at37e60afc6d2ffb3dab5dee16a52f2aae2554d4ab; 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
d6bc6379147de87a9296a66ddedd9fff0f610e6cwith head6053e0290109b8606802d0b519a88094f9deaa76. 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
Exact-head Start, Checkout and palette interactions; remote placement is simulated
after-interactions.webm
Visual verification
6053e0290109b8606802d0b519a88094f9deaa76