Skip to content

fix(projects): session-only checkouts are missing from project discovery - #191027

Merged
obviyus merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-observed-host-checkouts-20261102
Nov 2, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-observed-host-checkouts-20261102

Conversation

@Alix-007

@Alix-007 Alix-007 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Git checkouts used only by host sessions are missing from observed project discovery even though the folders appear in recents. The discovery owner reads node-only execCwd instead of the explicit host task directory persisted by sessions.create as spawnedCwd.

Changes and User Impact

Retains Alix-007's repair at the existing observed-project owner: consume the canonical host task cwd and keep the newest session representative per checkout before applying the existing candidate bound. Repeated sessions in one checkout no longer crowd another visible checkout out of that window.

Existing remote/node/device/repository-workspace exclusions, visibility filtering, bounded Git identity probes and final disclosure checks remain in force. No new scanner, project membership rule, SDK/protocol, configuration default or persisted schema.

Evidence

Built main e571cd1495c1358ab453c4496a645dc23af1602b and contributor production head c15686d2a771d78896587e0bd4bea1ece1d231a6 in secretless node:24.22.1 Docker. Later changes consolidate tests and document the existing contract; production behavior remains the contributor's built repair.

Adapted the contributor's published public-Gateway driver for archived built artifacts, explicit task-owned profiles/HOME/config/state, plus ordinary and outside-workspace controls. All source execution, dependencies, Git fixture creation, builds and Gateway runs stayed inside the task container.

Each ref ran twice, with fresh Gateway state and real independently committed Git checkouts A and B under the selected fixture workspace. Public authenticated WebSocket sessions.create({cwd}) created one B session and 50 A sessions. Readback confirms spawnedCwd equals each selected checkout, execCwd is absent, and runStarted is false. No provider/model call or direct session-store edit.

Readback Main, both runs Candidate, both runs
Two initial host sessions A/B present in folder recents; observed projects empty A/B present in recents and observed once each
After 50 A sessions observed projects still empty A and B both retained, one checkout each
Public sessions.list all 51 created sessions returned all 51 created sessions returned
Discovery not requested observedProjects field absent observedProjects field absent
Ordinary registered checkout remains in projects.list remains in projects.list
Real Git checkout outside selected workspace, with no selected session/registration not discovered not discovered

Candidate response shape after repeated sessions, normalized only here to omit disposable roots/timestamps:

{"observedProjects":[{"name":"A","checkouts":[{"runnerId":"gateway","path":"<selected-workspace>/A"}]},{"name":"B","checkouts":[{"runnerId":"gateway","path":"<selected-workspace>/B"}]}],"sessionCount":51}

Raw RPC replies and persisted-state readbacks are retained with the harness. Every observed checkout stayed under the selected fixture workspace; the unrelated outside Git repository was not scanned into the response. This is a negative discovery control, not a claim of a new filesystem authorization boundary. The Gateway config hash remained unchanged in all four runs.

Cleanup: all four task Gateways stopped. Three exited with code 0; the first candidate run exceeded the driver's 10-second cleanup wait and was killed. Functional assertions had completed before cleanup; graceful-shutdown behavior is not claimed by that run. No production services, live user data or external channels were touched.

Focused Checks and Simplification

  • 2 files / 40 tests passed, 98.02 s Vitest duration (projects-observed.test.ts, projects.test.ts). Formatting applied to the changed tests.
  • The same owner regression fails on main with no discovered project, then passes on candidate.
  • Consolidated the contributor's separate repeated-session case into existing 5,000-session ordering/unavailable-checkout coverage: one old checkout is surrounded by thousands of repeated newer checkouts, and reversed input order preserves newest representatives. Expected checkout ordering and exactly eight identity probes remain asserted.
  • All four distinct remote-placement exclusion cases remain. Existing project visibility/disclosure, opt-out and probe-bound tests passed. Spy cleanup is centralized in the existing suite lifecycle instead of a per-call wrapper; no new mock factory or production seam.
  • Removed the redundant separate regression setup and its growth allocation. Whole-PR delta: production +18 (20 added / 2 removed), tests net 0, docs +4. Broad checks belong to exact-head PR CI.

Compatibility and Merge Risk

Two-way door: reverting restores the former candidate selection; no migration or new stored format. Blast radius is optional observed Git discovery for visible local host sessions. Registered projects, ordinary listing without observed discovery, remote placements and disclosure authority retain their existing owners and contracts.

@clawsweeper

clawsweeper Bot commented Nov 2, 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 gateway Gateway runtime size: S labels Nov 2, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 2, 2026
@clawsweeper

clawsweeper Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Discover host-session Git checkouts from their canonical task directories and deduplicate checkout candidates before applying the limit.

Example: Create one host session in checkout B and 50 host sessions in checkout A, then request projects.list with includeObserved enabled.

  • Before: A and B appear in folder recents but observedProjects is empty.
  • After: A and B each appear once in observedProjects.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful owner-level repair with real Gateway red/green evidence, consolidated regressions and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The inspected public driver and readback exercise built Gateway sessions.create and projects.list with real Git checkouts, showing base-empty versus candidate A/B discovery, retention after 50 repeated A sessions, 51-session inventory and unchanged opt-out; obviyus additionally records paired Docker verification and controls.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Git checkouts used by host sessions appear in folder recents but are absent from explicitly requested observed projects.
Reason: The repair restores the existing discovery contract, and the collaborator's verification explicitly supports its direction without adding configuration, storage or public API.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a concrete discovery bug still present on current main, preserves existing access checks, and has matching public-Gateway proof; no actionable findings remain.

Priority: P2
Reviewed head: e3f5b588f4bf66fc724bed90ead96f4c4c85fe0b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway projects.list handler combines registered projects with optional observations from visible sessions and managed worktrees, resolves bounded Git identities, and returns authorized project summaries.

flowchart LR
  A[Session creation] --> B[Canonical session metadata]
  B --> C[Visible checkout candidates]
  D[Managed worktree registry] --> C
  C --> E[Bounded Git identity discovery]
  E --> F[Final disclosure checks]
  F --> G[Project list response]
Loading

Technical review

Best possible solution:

Land the focused repair in the existing observed-project owner once required exact-head checks pass.

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

Current-main source shows the producer/consumer field mismatch, and inspected public Gateway readbacks demonstrate the failure on the base and recovery on the unchanged production patch; this review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: consume canonical host task metadata and retain the newest representative per checkout inside the existing bounded discovery owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 37d681f0d323.

Provenance checked

  • Host-session directory selection changes intended behavior with a stated reason (853a79a: This commit extracted the existing observed owner while preserving behavior; it does not establish the original introduction of execCwd selection. Older git log -S/--follow searches encountered unavailable blobs. Current session types and creation code establish spawnedCwd as the host task directory.)
  • Candidate bounds and Git probing keeps the original intent (perf(gateway): overlap observed project identity probes #154210: Keep newest-first results and a bounded distinct Git probe set; this PR preserves those limits while preventing repeated sessions from consuming the raw candidate window.)
  • Test consolidation and discovery documentation keeps the original intent (test: remove low-value tests (batch d537) #183619: Consolidate repeated fixtures while preserving distinct owner-boundary assertions; the revised tests retain ordering, unavailable-checkout, remote-placement, probe-bound and disclosure coverage.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 853a79a adds src/gateway/server-methods/projects-observed.ts:180 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 853a79a7ca1f; files: src/gateway/server-methods/projects-observed.ts)
  • Vincent Koc: Raw commit 70bf512 adds src/gateway/server-methods/projects-observed.ts:174 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 70bf5121704c; files: src/gateway/server-methods/projects-observed.ts)

PR surface

Source +18, Tests 0, Docs +4. Total +22 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 20 2 +18
Tests 2 26 26 0
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 50 28 +22

Review metrics

Metric Value Why it matters
Production versus test changes Production +20/-2; tests +26/-26 The necessary production growth fixes canonical directory selection and candidate deduplication while consolidating regression coverage without net test growth.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Optional observed discovery omits real host-session checkouts, while folder recents and registered projects remain available.
  • 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.

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 (1 earlier review cycle)
  • reviewed 2026-11-02T10:33:08.784Z sha c15686d :: needs maintainer review before merge. :: none

Reviewed November 2, 2026, 6:32 AM ET / 11:32 UTC (Revision 2).

@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Git checkouts used only by host sessions are missing from observed project discovery even though the folders appear in recents. The discovery owner reads node-only execCwd instead of the explicit host task directory persisted by sessions.create as spawnedCwd.

Changes and User Impact

Retains Alix-007's repair at the existing observed-project owner: consume the canonical host task cwd and keep the newest session representative per checkout before applying the existing candidate bound. Repeated sessions in one checkout no longer crowd another visible checkout out of that window.

Existing remote/node/device/repository-workspace exclusions, visibility filtering, bounded Git identity probes and final disclosure checks remain in force. No new scanner, project membership rule, SDK/protocol, configuration default or persisted schema.

Evidence

Built main e571cd1495c1358ab453c4496a645dc23af1602b and contributor production head c15686d2a771d78896587e0bd4bea1ece1d231a6 in secretless node:24.22.1 Docker. Later changes consolidate tests and document the existing contract; production behavior remains the contributor's built repair.

Adapted the contributor's published public-Gateway driver for archived built artifacts, explicit task-owned profiles/HOME/config/state, plus ordinary and outside-workspace controls. All source execution, dependencies, Git fixture creation, builds and Gateway runs stayed inside the task container.

Each ref ran twice, with fresh Gateway state and real independently committed Git checkouts A and B under the selected fixture workspace. Public authenticated WebSocket sessions.create({cwd}) created one B session and 50 A sessions. Readback confirms spawnedCwd equals each selected checkout, execCwd is absent, and runStarted is false. No provider/model call or direct session-store edit.

Readback Main, both runs Candidate, both runs
Two initial host sessions A/B present in folder recents; observed projects empty A/B present in recents and observed once each
After 50 A sessions observed projects still empty A and B both retained, one checkout each
Public sessions.list all 51 created sessions returned all 51 created sessions returned
Discovery not requested observedProjects field absent observedProjects field absent
Ordinary registered checkout remains in projects.list remains in projects.list
Real Git checkout outside selected workspace, with no selected session/registration not discovered not discovered

Candidate response shape after repeated sessions, normalized only here to omit disposable roots/timestamps:

{"observedProjects":[{"name":"A","checkouts":[{"runnerId":"gateway","path":"<selected-workspace>/A"}]},{"name":"B","checkouts":[{"runnerId":"gateway","path":"<selected-workspace>/B"}]}],"sessionCount":51}

Raw RPC replies and persisted-state readbacks are retained with the harness. Every observed checkout stayed under the selected fixture workspace; the unrelated outside Git repository was not scanned into the response. This is a negative discovery control, not a claim of a new filesystem authorization boundary. The Gateway config hash remained unchanged in all four runs.

Cleanup: all four task Gateways stopped. Three exited with code 0; the first candidate run exceeded the driver's 10-second cleanup wait and was killed. Functional assertions had completed before cleanup; graceful-shutdown behavior is not claimed by that run. No production services, live user data or external channels were touched.

Focused Checks and Simplification

  • 2 files / 40 tests passed, 98.02 s Vitest duration (projects-observed.test.ts, projects.test.ts). Formatting applied to the changed tests.
  • The same owner regression fails on main with no discovered project, then passes on candidate.
  • Consolidated the contributor's separate repeated-session case into existing 5,000-session ordering/unavailable-checkout coverage: one old checkout is surrounded by thousands of repeated newer checkouts, and reversed input order preserves newest representatives. Expected checkout ordering and exactly eight identity probes remain asserted.
  • All four distinct remote-placement exclusion cases remain. Existing project visibility/disclosure, opt-out and probe-bound tests passed. Spy cleanup is centralized in the existing suite lifecycle instead of a per-call wrapper; no new mock factory or production seam.
  • Removed the redundant separate regression setup and its growth allocation. Whole-PR delta: production +18 (20 added / 2 removed), tests net 0, docs +4. Broad checks belong to exact-head PR CI.

Compatibility and Merge Risk

Two-way door: reverting restores the former candidate selection; no migration or new stored format. Blast radius is optional observed Git discovery for visible local host sessions. Registered projects, ordinary listing without observed discovery, remote placements and disclosure authority retain their existing owners and contracts.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 2, 2026
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 2, 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. clawsweeper:intake:needs-environment 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. labels Nov 2, 2026
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up shutdown control on the same built production refs and same public 51-host-session workload (fresh state each cycle, candidate/main interleaved): candidate 177.995 ms and 183.411 ms; main 172.442 ms and 216.433 ms, measured from cleanup/SIGTERM initiation to child process close. All four exited code 0 without a signal or forced stop, and all completed below the original 10-second ceiling. The diagnostic driver allowed up to 60 seconds rather than killing at 10 seconds, but none needed the extra allowance. Discovery, session-count, ordinary-checkout, outside-workspace and opt-out assertions also passed in every cycle. Neither original main run required a forced stop. The original first-candidate cleanup outlier remains unexplained; these matched controls do not reproduce a candidate-specific shutdown hang or establish a discovery handle leak. No product change or repush was made. Task container stopped; timing receipts retained with the existing proof harness.

@obviyus
obviyus merged commit cfde51d into openclaw:main Nov 2, 2026
127 of 130 checks passed
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Landed in cfde51d. Thanks @Alix-007. Host-session checkouts are now discovered.

@Alix-007

Alix-007 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@obviyus Thanks for the careful review, test consolidation, and landing this!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
…ery (openclaw#191027)

fix: discover checkouts used by host sessions



Checkout discovery did not find the Git checkouts that host sessions were using, so those checkouts were missing from the observed list. Discovery now includes the checkouts of host sessions in the selected workspace, each listed once. Registered checkouts are unchanged, checkouts outside the workspace are not discovered, and the discovery opt-out still works.

Evidence: built Gateway on Node 24.22.1 in secretless Docker with real Git checkouts and public host-session creation. Main returned no observed checkouts twice; with this change both checkouts were discovered once each, twice, including after 50 sessions on one checkout. Registered-checkout, outside-workspace and opt-out controls were unchanged. Shutdown timing matched main in four extra cycles. Details: openclaw#191027 (comment) and openclaw#191027 (comment).

Thanks @Alix-007.

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

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. 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.

2 participants