Skip to content

Start new sessions with folder group defaults - #123276

Merged
jesse-merhi merged 15 commits into
mainfrom
feat/session-folder-group-defaults
Aug 15, 2026
Merged

jesse-merhi merged 15 commits into
mainfrom
feat/session-folder-group-defaults

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

New behavior

Folder groups can remember where new sessions should work. An operator saves a folder and Local or Worktree mode once, then the group’s + action opens New Session with those choices already selected and keeps the created session in that group.

  • The defaults dialog uses the same Gateway folder browser as New Session.
  • Renaming or reordering a group preserves its saved defaults.
  • A failed or stale save stays visible and can be retried without overwriting the previous values.
  • Existing databases remain unchanged until defaults are first saved.
  • Older Gateways still start the session safely without sending an unsupported group field.

Exact head: ffc7249d2be401e51d8650f1f2b12da45e8df20c

The hosted walkthrough was captured from runtime-identical commit 5abfd74cdc72b8646ae8ef1b60a24fc924f927d2. Later changes corrected tests and generated protocol output, hardened catalog loading, moved the New Session route loader behind the existing lazy boundary, enforced workspace scope for saved paths, gated group assignment on the new Gateway capability, and rebased the feature onto current main; they do not change the supported rendered states shown below. Exact head ffc7249d2be401e51d8650f1f2b12da45e8df20c also filters saved paths by session participation, rechecks current members at commit time using one canonical group name, blocks nonparticipants from changing a category by adopting an existing key, revalidates workspace containment against the current config immediately before persistence, and clears cached folders when an update removes cwd. Fresh isolated real-component staging on the preceding runtime-identical head verified both the walkthrough and clearing a group back to the agent workspace with Local mode; the final follow-up changes only the server-side authorization key and its regression test.

Visual proof

123276-5abfd74-folder-group-walkthrough.mp4

What this shows: From a seeded “Client work” group, the walkthrough opens the defaults dialog, browses /home/demo/client-work, saves Worktree mode, starts through the group +, observes the prefilled composer, and reaches the grouped session.

State: Real Control UI components with synthetic Gateway data at 1280×900; no credentials or production state. The retained media shows the unchanged UI states, while exact-head staging verifies the current loading and submission path.

Save folder-group defaults

Client work group defaults dialog with saved folder and Worktree mode

What this shows: The group owns /home/demo/client-work and Worktree mode before the session is started.

Shared folder browser selecting the Client work directory

What this shows: Folder-group defaults reuse the normal New Session browser, including the explicit Use this folder action.

Start in the saved place

New Session composer prefilled with client-work and Worktree

What this shows: The group + opens New Session with client-work and Worktree already selected; ordinary New Session preferences remain separate.

Created session routed back into the Client work group

What this shows: Creation completes at /chat/main/client-work, with the resulting session shown under the originating group.

How to verify

  1. Open a folder group’s options and choose New session defaults….
  2. Choose an absolute Gateway folder and Local or Worktree mode, then save.
  3. Select the group’s + action.
  4. Confirm New Session is prefilled, start it, and confirm the session remains in that group.

The representative create request from the proof run was:

{
  "agentId": "main",
  "category": "Client work",
  "cwd": "/home/demo/client-work",
  "message": "prepare the client release",
  "worktree": true,
  "worktreeBaseRef": "main"
}

Exact-head validation

  • Isolated local and public-browser staging both completed the group defaults → group + → grouped session flow on runtime-identical head 9a88f62b2485614d8ebe96957722afef7dd5f201, then cleared the saved folder back to the agent workspace and Local mode. The exact-head follow-up has no rendered or submission-path change.
  • The public browser reached /chat/main/client-work, sent the representative create request above, verified the cleared group reopened at the normal workspace, and contacted only the synthetic preview origin.
  • Exact Gateway sharing, group-handler, and authorization orchestration: 3 files, 39 tests passed.
  • Exact-head canonical-name authorization regression and owning group-handler suite: 2 files, 20 tests passed.
  • Exact keyed-adoption durable-commit regression: 1 test passed (93 unrelated cases skipped).
  • Exact group-defaults real-component E2E: 1 file, 7 tests passed.
  • Explicit-file formatting, lint, and diff hygiene passed on the rebased exact head.

Compatibility and safety

  • sessions.groups.list remains path-free and read-scoped. Saved paths load through the write-scoped defaults method.
  • The two nullable SQLite columns are added only when defaults are first saved for an existing group; reads, registration, reordering, rename, and stale saves do not migrate the table.
  • Relative folders are rejected without changing saved values. Non-admin callers can save only paths inside configured agent workspaces; the async containment result is revalidated against the latest config immediately before persistence, and other absolute Gateway paths require operator.admin.
  • Identified operators see and update defaults only for groups whose member sessions they may mutate. The authorizer returns null when mutation is allowed and an error when denied; focused proof verifies permitted groups remain visible while restricted groups are filtered. The update path canonicalizes the group name once, then rechecks the complete current member set immediately before its synchronous write.
  • Explicit-key session adoption uses the same participation fence and carries it through the durable create commit, so another operator cannot move an existing session into a different group through sessions.create.
  • Session creation registers a new category only after the durable create succeeds, then emits the normal group-catalog invalidation for other clients.
  • Group assignment is sent only when the Gateway advertises the write-scoped group-defaults contract; older Gateways create an ungrouped session instead.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 13, 2026
@jesse-merhi
jesse-merhi force-pushed the feat/session-folder-group-defaults branch from 57be04e to 033c42f Compare August 13, 2026 17:53
@jesse-merhi
jesse-merhi marked this pull request as ready for review August 13, 2026 18:03
Copilot AI lite review requested due to automatic review settings August 13, 2026 18:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Aug 13, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 1:01 AM ET / 05:01 UTC.

ClawSweeper review

What this changes

Adds group-specific working-directory and Local/Worktree defaults, uses them to prefill Control UI New Session, and assigns the created session to the originating group.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer product-direction review and exact-head CI resolution. The inspected Gateway and persistence paths are coherent and no discrete patch defect was found, but this member-authored PR adds a durable Gateway/UI contract and one UI E2E shard is currently failing.

Priority: P2
Reviewed head: ffc7249d2be401e51d8650f1f2b12da45e8df20c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation has useful, coherent evidence, but the unresolved UI E2E shard and required product decision limit merge readiness.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR nevertheless includes a user-visible recording and described staging evidence.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR nevertheless includes a user-visible recording and described staging evidence.
Evidence reviewed 6 items Current-main baseline: Current main stores only group name and position, so the requested defaults workflow is not already implemented.
Protocol boundary: The PR keeps path-bearing defaults out of the read-scoped group catalog and adds separate write-scoped defaults/update schemas.
Persistence compatibility: The two session-group columns are bare nullable first-use additions, preserving older-reader tolerance until the feature is used.
Findings None None.
Security None None.

How this fits together

Gateway owns session-group metadata, authorization, and session creation; Control UI loads the group defaults before opening New Session. The resulting category is persisted on the session and reflected in the sidebar group.

flowchart LR
  A[Group options] --> B[Write-scoped Gateway defaults]
  B --> C[Session group SQLite record]
  C --> D[Control UI New Session route]
  D --> E[Session creation request]
  E --> F[Persisted group membership]
Loading

Decision needed

Question Recommendation
Should OpenClaw make per-session-group folder and Local/Worktree defaults a supported Gateway and Control UI contract? Sponsor the group-defaults contract: Accept the persisted defaults and Gateway methods after exact-head UI E2E is green.

Why: The implementation adds public methods, durable state, and a new session-creation behavior; code review cannot decide whether that product surface should be permanent.

Before merge

  • Resolve merge risk (P1) - The PR creates a supported persisted-state and Gateway-method contract; maintainers should explicitly accept its long-term compatibility obligation.
  • Resolve merge risk (P1) - The provided exact-head status includes a failing checks-ui-e2e (2/12) shard, whose cause could not be inspected while GitHub/DNS access was unavailable.
Agent review details

Security

None.

PR surface

Source +1460, Tests +1587, Docs 0, Generated +2, Other +84. Total +3133 across 80 files.

View PR surface stats
Area Files Added Removed Net
Source 51 1738 278 +1460
Tests 22 1616 29 +1587
Docs 3 4 4 0
Config 0 0 0 0
Generated 1 2 0 +2
Other 3 86 2 +84
Total 80 3446 313 +3133

Review metrics

Metric Value Why it matters
Production vs test LOC production +1,733/-274; tests/support +1,713/-39 The feature is a large cross-layer change, so durable-contract and upgrade proof matter more than ordinary unit coverage alone.
Gateway contract 2 write-scoped methods and 1 session-create field added Existing Gateway clients must discover or safely ignore the new defaults and category behavior.
Persisted state 2 nullable first-use columns added Existing databases remain unchanged until defaults are saved, which is the required upgrade boundary to verify.

Stored data model

Persistent data-model change detected: database schema: src/gateway/session-groups.test.ts, serialized state: packages/gateway-protocol/src/schema/sessions-create.ts, serialized state: packages/gateway-protocol/src/schema/sessions.ts, serialized state: packages/gateway-protocol/src/sessions-groups-validators.test.ts, serialized state: src/gateway/server-methods/sessions-create.ts, serialized state: src/gateway/server-methods/sessions-groups.test.ts, and 46 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Resolve exact-head compatibility proof (recommended)
    Identify and fix or rerun the failing UI E2E shard, then verify old-Gateway fallback and existing-database first-use behavior before merge.
  2. Accept the new durable contract
    A product owner may intentionally accept the Gateway and SQLite surface once the UI E2E result is understood.

Technical review

Best possible solution:

Keep the group catalog path-free, retain write-scoped defaults and first-use nullable storage, and land only after a product owner accepts the public contract and the exact-head UI E2E failure is resolved.

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

Not applicable: this PR proposes a new workflow, and its supplied recording plus real-component staging demonstrate the intended flow rather than an existing defect.

Is this the best way to solve the issue?

Unclear: the implementation follows the existing Gateway-owned group boundary, but a maintainer must decide whether this new persistent public contract is desired.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6e5bf3ec55cb.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded session-organization feature with normal maintainer product and compatibility review needs.
  • merge-risk: 🚨 compatibility: The PR adds Gateway methods and first-use SQLite columns that must coexist with older clients and databases.
  • merge-risk: 🚨 session-state: The PR persists a category during session creation and uses group state to initialize new-session behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR nevertheless includes a user-visible recording and described staging evidence.

Evidence

What I checked:

Likely related people:

  • steipete: The feature history identifies Peter Steinberger as author of the server-side group catalog and its Gateway-owned sidebar ordering. (role: introduced the session-group and sidebar-order foundations; confidence: high; commits: 48b0f4edf554, 2de58d408a69; files: src/gateway/session-groups.ts, ui/src/lib/sessions/session-group-catalog.ts)
  • Jason (Json): Current-main blame and history place this contributor on the latest session-group/catalog-adjacent changes. (role: recent adjacent contributor; confidence: medium; commits: cae603057562; files: src/gateway/session-groups.ts, ui/src/lib/sessions/session-group-catalog.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve or explain the exact-head checks-ui-e2e (2/12) failure with its relevant log or rerun.
  • Record maintainer acceptance of the new Gateway and persisted-state contract.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (22 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-15T00:25:31.706Z sha c245c9c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T00:33:10.011Z sha c245c9c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T00:41:55.334Z sha c245c9c :: found issues before merge. :: [P1] Enforce participation for folder-group defaults | [P1] Clear removed cwd from cached defaults
  • reviewed 2026-08-15T01:17:04.159Z sha 8f9066c1066f1198f661780c5bbacd19c3a03712 :: found issues before merge. :: [P1] Fix the inverted group-defaults visibility filter | [P1] Authorize category changes when adopting an existing session | [P1] Revalidate workspace containment after the async path check
  • reviewed 2026-08-15T01:25:02.638Z sha 8f9066c1066f1198f661780c5bbacd19c3a03712 :: found issues before merge. :: [P1] Authorize category changes on existing keyed sessions | [P1] Recheck workspace containment after asynchronous path resolution | [P1] Keep group New Session usable on older Gateways
  • reviewed 2026-08-15T01:41:32.534Z sha 9755663ad3a4293b4e93205b717597a33521960f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T01:54:07.883Z sha 9a88f62 :: found issues before merge. :: [P1] Canonicalize the group name before the late-member fence
  • reviewed 2026-08-15T02:18:37.041Z sha 5c82f48 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 13, 2026
@jesse-merhi
jesse-merhi force-pushed the feat/session-folder-group-defaults branch from 8c46fa0 to 37f0640 Compare August 14, 2026 16:37
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. 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 Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: macos App: macos app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

2 participants