Skip to content

fix: authenticate GitHub project worktree preparation - #196889

Merged
Patrick-Erichsen merged 5 commits into
mainfrom
fix-template-ci-readiness
Nov 10, 2026
Merged

Patrick-Erichsen merged 5 commits into
mainfrom
fix-template-ci-readiness

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

GitHub project sessions clone with the selected credential, then lose it while preparing their managed worktree's default branch. Private repositories receive unauthenticated branch requests.

User Impact

The selected GitHub identity now covers clone, refresh and default-base preparation. Retiring or replacing that identity blocks subsequent requests. Successful default selection updates the managed clone's tracking refs, including default-branch renames, so later offline reuse selects the last fetched commit. Partial clones retain their filter and promisor packs.

Why This Change Was Made

Default selection reuses the authenticated checkout lifecycle and registry identity. The existing default resolver owns cached refs and guarded compare-and-swap publication; its network operations receive clean Git metadata, the canonical URL and selected credential. The accepted worktree commit uses existing session fields.

The GitHub spawn fixture also reflects the existing contract that GitHub URL sessions use managed checkouts, including omitted or false worktree intent.

Evidence

  • Before: native Git/HTTP records authenticated clone requests followed by unauthenticated default-branch requests. The previously reviewed implementation also fails all three new partial-clone/source-cache regressions.
  • After: native clone/refresh/default-base allowed, retired and rotated identity cases pass 9/9, including successful contents and zero requests after revocation. Git, object transfers, session admission and credential ownership run against an owned authenticated loopback HTTP server. Wrapper: 163.11s; file: 153.10s.
  • Real-Git partial-clone and source-ref regressions pass 3/3. They cover advancing defaults, blob:none/promisor packs, lazy blobs, main/renamed default publication, offline reuse and canonical URL rewrite isolation. All 115 runtime, registry and default-base tests pass. Visible-spawn cases pass 27/27.
  • Core types, all 29 affected test graphs, scoped lint, formatting, import-cycle and other changed-file guards pass. Full check:changed remains red on broad Knip export inventories outside this patch. The separately investigated explicit-ref cleanup failure remains documented with its matching baseline reproduction.
  • Native OpenGrep reports no findings across 106 rules and seven files. Two parser warnings concern unchanged syntax in existing test fixtures; changed production files have no parser warnings. The test-only loopback auth-scope translation has a rule-specific explanation/suppression; executable assertions remain strict.

The exact 74-line fixture allocation preserves the base's 17-line slack without changing its shared scalar. Hosted CI and a fresh hosted review are required for the published repair.

@clawsweeper

clawsweeper Bot commented Nov 10, 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 agents Agent runtime and tooling size: M labels Nov 10, 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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Carries the selected GitHub credential through managed default-branch preparation while preserving partial-clone filtering and cached tracking refs.

Example: Start a session for private repository https://github.com/example/private.git without selecting a base.

  • Before: Clone authenticates, but subsequent default-branch discovery loses the selected credential.
  • After: Default discovery uses the selected credential, records the accepted commit, and rejects requests after identity retirement or rotation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch resolves the earlier defects and has meaningful native transport and authority proof; validation remains centered on an in-process production-boundary harness.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (live_output): The supplied production-owner campaign exercises sessions.create, native Git, real HTTP authentication, and object transfer against an owned loopback server: allowed operations produce the expected checkout contents, while retired and rotated identities produce zero subsequent requests. Inspected regressions additionally cover advancing partial clones, default renames, canonical URL isolation, and offline reuse; this is boundary-harness evidence rather than a deployed Gateway demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A private GitHub repository clones successfully, then worktree preparation makes unauthenticated default-branch requests.
Reason: Restoring the selected credential across one project-preparation flow has clear value, and the host identifies this as maintainer-authored work with approved direction.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current credential handoff defect. All three previous findings are resolved, and this review found no new actionable defect.

Priority: P1
Reviewed head: c3dac39f8e95740a498de8f738a899d56dc387b1

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway session preparation resolves a managed project, acquires its checkout lifecycle, authenticates native Git operations, and passes a pinned commit to managed worktree creation.

flowchart TD
A[Session creation] --> B[Selected GitHub identity]
B --> C[Managed checkout lifecycle]
C --> D[Default base resolver]
D --> E[Authenticated Git transport]
E --> F[Shared objects and tracking refs]
F --> G[Pinned session worktree]
Loading

Technical review

Best possible solution:

Retain the existing identity, checkout-lifecycle, and default-ref owners, with authenticated transport supplying the pinned worktree commit.

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

Current-main source exposes the missing credential handoff, and the supplied before/after native Git/HTTP evidence exercises it; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch repairs the credential handoff through existing owners and preserves canonical URL isolation, cached refs, filtering, and retry pinning without adding another state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Managed checkout refresh and authority keeps the original intent (fix: reject invalid bases before starting worktree sessions #135917: Validate and pin accepted bases while keeping remote refresh under canonical registry identity, checkout custody, and current caller authority.)
  • Registry-backed checkout lifecycle keeps the original intent (70b587b: Resolve saved refresh ownership through the state worker under the original checkout lease before transport effects.)
  • Default-branch isolated transport changes intended behavior with a stated reason (43dae0b: Avoid unrelated shared-ref negotiation work while preserving source-ref publication and effective transport policy.)
  • Partial-clone filtering keeps the original intent (9623635: Literal fetch URLs must explicitly retain the source filter and promisor packs.)
  • GitHub spawn fixture expectations keeps the original intent (97e91a1: Repository URL sessions use managed worktrees even when worktree intent is omitted or false.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 70b587b adds src/projects/project-clone.ts:195 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 70b587ba4056; files: src/projects/project-clone.ts)
  • Galin Iliev: Raw commit db01f6d adds src/projects/project-clone.ts:213 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: db01f6d520b8; files: src/projects/project-clone.ts)

PR surface

Source +77, Tests +74, Other +3. Total +154 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 105 28 +77
Tests 3 93 19 +74
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 8 201 47 +154

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Private GitHub project sessions lose authentication during workspace preparation, breaking the agent workflow despite successful cloning.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • 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-10T22:49:34.001Z sha 4c3a98e :: needs changes before merge. :: [P2] [P2] Preserve the source clone's filter during default fetching | [P2] [P2] Publish fetched default refs back to the managed clone | [P3] [P3] Move the unrelated model fallback fixture repair to a separate PR

Reviewed November 10, 2026, 6:20 PM ET / 23:20 UTC (Revision 2).

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Addressed the review findings in c3dac39:

  • Default fetching forwards the source clone filter and retains promisor packs. The existing resolver reads and CAS-publishes managed-source refs; only network metadata is isolated. Three new native regressions fail before this repair and pass afterward, covering advancing partial clones, main/renamed defaults and offline reuse.
  • The independent model fixture repair is isolated in test: use a neutral auto-fallback model fixture #196901, now merged. This PR has no model-fixture diff.
  • Full runtime/registry/default-base suites pass 115/115; fresh identity cases pass 9/9 and visible-spawn cases pass 27/27. Types, all 29 affected test graphs, scoped lint, formatting and budget guards pass. Full local changed-file checks still report the broad unused-export inventories described in the body; fresh hosted checks remain required.

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper clawsweeper Bot added the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Nov 10, 2026
@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Nov 10, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit ff392db into main Nov 10, 2026
160 of 161 checks passed
@Patrick-Erichsen
Patrick-Erichsen deleted the fix-template-ci-readiness branch November 10, 2026 23:27
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 11, 2026
* test: align fallback and GitHub spawn fixtures with current contracts

* fix: retain GitHub identity while preparing a project default worktree

* test: explain owned Git authentication transport routing

* fix: preserve project default filtering and source refs

* test: isolate the fallback fixture repair
steipete added a commit that referenced this pull request Nov 11, 2026
Adopt the original repair from #196487 while preserving its branch history.
Carry forward the independently validated context reader, focused regression
proof, documentation, and synthetic timing/allocation measurements.

The final tree matches 68aac2c exactly.
Keep the current admission and unrelated Gateway test repairs already landed
through #196702 and #196889. No runtime source change was added in adoption.

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

agents Agent runtime and tooling gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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