Skip to content

feat(cloud-workers): cloud sessions use the shared GitHub identity instead of github_publish - #136583

Merged
steipete merged 3 commits into
mainfrom
steipete/cloud-sessions-github-token-480a66
Sep 3, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/cloud-sessions-github-token-480a66

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Cloud sessions running on OpenClaw workers (paired devices and Crabbox cloud workers) could not use GitHub directly. The worker had no GitHub credential, its checkout had no origin and a synthetic openclaw-worker branch, and the only publication path was a github_publish tool that recorded a request for the Gateway to commit, push, and open a draft PR after the turn ended. The model could not run gh pr create or git push and see the result, and every publication detoured through the broker.

Why This Change Was Made

Each OpenClaw worker-turn now receives the Gateway's effective shared GitHub identity (the same tools.github selection ordinary Gateway-host exec uses) as a turn-bound binding in the private launch envelope: access token, verified login, session branch, canonical HTTPS origin for GitHub repositories, and any configured Git author. The worker writes the token into a private gh profile inside its throwaway state directory and binds it to every exec launch through the existing launch-time credential resolver, so GH_TOKEN exists only in the child process, GITHUB_TOKEN is cleared, and HTTPS Git authenticates through gh auth git-credential with inherited helpers reset. The checkout is renamed to the session branch and gets an HTTPS origin at turn start.

The credential resolver is shipped as a third sealed artifact (github-exec-launcher.mjs) in the hash-bound worker bundle next to worker.mjs and the rsync receiver; the deployed bundle registers its sibling path so the same code path works on the Gateway host and on workers. The worker-side github_publish tool, its worker.github.publish RPC, and the worker-github-publication-v1 protocol feature are deleted. The Gateway publication broker stays for the Control UI Publish PR action and for Codex remote-exec sessions, which still see the local github_publish tool. Codex remote-exec token forwarding is a named follow-up (plugin-owned exec-server env boundary).

Non-goals: no new config option, no SQLite or protocol-version change, no change to personal GitHub connections (workers use the shared identity only), no change to model-provider credential handling (inference stays proxied).

User Impact

On a cloud worker or paired session host, gh is authenticated as the Gateway's shared GitHub identity and git push to GitHub works over HTTPS without any setup on the box. The agent commits, pushes, and opens PRs directly and sees the results in the same turn. gh must be installed on the worker host (Crabbox developer images include it; the docs show a settings.setup example). Reconciliation still copies file contents, not commit history, back to the Gateway worktree, so pushed work lands on GitHub first. Cloud workers no longer offer github_publish; Codex remote-exec sessions and the Control UI button are unchanged.

Evidence

Live proof on a real worker turn (paired-device session host, this Mac)

Isolated dev Gateway (OPENCLAW_STATE_DIR in a scratch dir, port 19821, native gh identity = the Gateway host's keyring login), a paired node run with openclaw connect --session-host, a session with a managed worktree on a private scratch repo, sessions.dispatch to the device, then one chat.send asking the agent to run a fixed shell script through exec. Sanitized tool output from chat.history:

== gh auth status
github.com
  ✓ Logged in to github.com account steipete (GH_TOKEN)
  - Active account: true
  - Git operations protocol: https
  - Token: gho_************************************
  - Token scopes: 'admin:ssh_signing_key', 'gist', 'read:org', 'repo', 'workflow'

  ✓ Logged in to github.com account steipete (keyring)
  - Active account: false
  - Git operations protocol: https
  - Token: gho_************************************
  - Token scopes: 'admin:ssh_signing_key', 'gist', 'read:org', 'repo', 'workflow'
== env
GH_CONFIG_DIR=<tmp>/openclaw-worker-gKSx1Q/github-profile
GITHUB_TOKEN=[]
token_sha256_prefix=f0c43122c1ff9334
== git config
file:/Applications/Xcode-beta.app/Contents/Developer/usr/share/git-core/gitconfig	osxkeychain
command line:	
command line:	!gh auth git-credential
== checkout
refs/heads/openclaw/gh-binding-proof2
https://github.com/steipete/openclaw-github-identity-proof.git
== remote read
c0c6d142788819122049868eaa724174ce4364c3	refs/heads/main
== push
remote:      https://github.com/steipete/openclaw-github-identity-proof/pull/new/openclaw/gh-binding-proof2        
remote: 
To https://github.com/steipete/openclaw-github-identity-proof.git
 * [new branch]      HEAD -> openclaw/gh-binding-proof2
branch 'openclaw/gh-binding-proof2' set up to track 'origin/openclaw/gh-binding-proof2'.
== pr
https://github.com/steipete/openclaw-github-identity-proof/pull/1
  • gh auth status shows the bound token as the active account via GH_TOKEN; the node account's own keyring login is present but inactive.
  • The token hash reported by the worker equals the hash of gh auth token on the Gateway host (f0c43122c1ff9334), so the worker used exactly the Gateway's effective identity, not a device credential.
  • GH_CONFIG_DIR points at the private profile inside the worker's throwaway state dir; GITHUB_TOKEN is empty; the effective credential helper list is reset and ends with !gh auth git-credential.
  • The checkout is on the session branch with an HTTPS origin; git ls-remote, git push -u origin HEAD, and gh pr create --draft all succeeded from the worker (draft PR created on the private proof repo, then closed and its branch deleted).
  • sessions.reclaim afterwards reconciled the pushed PROOF.md back into the Gateway worktree as file content (untracked, as documented: reconciliation carries files, not commits).

Rig note: a node state directory under a deep scratch path made the worker workspaceDir exceed the 256-character identifier limit and every turn failed with invalid worker launch descriptor before any GitHub logic ran; a short state dir fixed it. That limit predates this change.

Sealed launcher artifact

pnpm build produces dist/worker/github-exec-launcher.mjs (287 KB, all deps bundled) next to worker.mjs and workspace-rsync-receiver.mjs; the paired node installed bundle 3956de0a… and the worker resolved the sibling launcher at exec launch (the live proof above runs through it). Launcher smoke: prints exactly the token for a 0700 dir / 0600 hosts.yml, exits 1 with the "credential is unavailable or insecure" line for a 0755 dir or 0644 file.

Local gates

  • Focused Vitest (worker binding boundary, launch descriptor, gateway binding, launcher argv): green. Broad Vitest over src/worker, src/gateway/worker-environments, src/gateway/server/ws-connection, packages/gateway-protocol, src/node-host, the GitHub identity/publication suites, bundle/archive/CI-scope tests: 63 files, 811 passed, 4 skipped, 1 failed. The single failure (node-worker-supervisor.test.ts "records a gated child that exits before journal readiness as terminal", expected failed got interrupted) is a pre-existing timing race hit while a full build and the changed-file gate saturated the machine; it is untouched by this PR and passed twice in isolation afterwards.
  • pnpm protocol:check: registry, schema, Swift/Kotlin generation, and since-guard passed with no generated-client drift.
  • Full pnpm build (isolated copy-install checkout, so sibling pnpm install runs cannot trip the declaration-input fence): exit 0, no [INEFFECTIVE_DYNAMIC_IMPORT] warnings. In the shared worktree the runtime stages pass and only the 25-minute declaration phase fails on Boundary input changed during compilation: ../../../node_modules/@types/events/index.d.ts whenever another worktree runs pnpm install (pnpm store hardlinks share inodes, so their ctime moves); environmental, not caused by this change.
  • node scripts/check-changed.mjs: every lane green on the final tree (format, core/UI/test/extensions/scripts typecheck, import cycles, dead-export scan, coercion/sidecar/database-first guards, max-lines and SAFETY ratchets, lint) after four small lint repairs in this PR's own files (cause-preserving rethrow, an unnecessary regex escape, map-spread and variable shadowing in tests) and one pre-existing no-shadow in test/scripts/changed-lanes.test.ts that the test-root lint lane surfaces because this PR touches the file.
  • Autoreview (Codex, P0): scoped-clean, no accepted findings (three chunks).

Follow-up (not in this PR)

Tracked in #136584.

OpenClaw worker-turn cloud workers now receive the Gateway's effective shared GitHub identity per turn (sealed credential launcher + private gh profile in the worker state dir), and the worker-side github_publish tool was removed. Codex remote-exec placements still run their shell on the box without any GitHub credential and keep the Gateway publication broker (github_publish dynamic tool) as their only publication path.

What a parity change needs (plugin-owned, extensions/codex):

  • The node exec-server (extensions/codex/src/node-exec-server.runtime.ts) starts with a fresh private HOME and a strict sanitized env; per-process env from the app-server is scrubbed again on the node (sandbox-exec-server/processes.ts, sanitizeEnvVars blocks GH_TOKEN/GITHUB_TOKEN). A deliberate OpenClaw-owned credential channel is needed rather than smuggling the token through the Codex-requested env.
  • Materialize the same gh profile document next to the exec-server's private HOME and point GH_CONFIG_DIR at it (Codex-native shells already use the profile-overlay contract locally, see docs/gateway/config-tools.md "Codex-native shell is a separate boundary").
  • The token must not ride the codex.exec-server.stdio.v1 invocation params (approval-visible, journaled); deliver it over the authenticated exec-server channel or through the placement's node workspace transfer.
  • Gateway side can reuse prepareWorkerGitHubBinding (src/gateway/worker-environments/worker-github-binding.ts).
  • Codex hard gate: inspect ../codex/codex-rs/exec-server/src/local_process.rs (child env construction) and codex-rs/core/src/exec_env.rs before changing env routing.

Until then, remote-exec keeps github_publish and the Control UI Publish PR broker.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 20:32
@steipete
steipete requested a review from a team as a code owner September 2, 2026 20:32
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

OpenClaw worker-turn cloud sessions now receive the Gateway's effective shared
GitHub identity per turn instead of a `github_publish` tool. The launch
envelope carries the verified access token, login, session branch, and HTTPS
origin; the worker writes a private gh profile in its throwaway state dir and
binds it to every exec launch through the existing launch-time credential
resolver, so `gh` and HTTPS `git push` work on the worker with the same
identity ordinary Gateway-host exec uses. The credential launcher ships as a
third sealed artifact in the hash-bound worker bundle.

The worker-side `github_publish` tool, its `worker.github.publish` RPC, and
the `worker-github-publication-v1` protocol feature are removed. The Gateway
publication broker stays for the Control UI Publish PR action and for Codex
remote-exec sessions.
@steipete
steipete force-pushed the steipete/cloud-sessions-github-token-480a66 branch from 3167fa3 to 5664f5f Compare September 2, 2026 20:38
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 7:28 PM ET / 23:28 UTC.

ClawSweeper review

What this changes

The branch gives cloud worker exec commands a per-turn shared GitHub identity for direct gh and HTTPS Git operations, replacing the worker-side publication broker.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 10 items remain

Keep open: the direct worker credential path works for ordinary GitHub commands, but it gives retained background processes a bearer token that remains usable after the originating turn closes. This is a material security-boundary decision and needs explicit approval plus final-effect closure proof before merge.

Priority: P1
Reviewed head: 25dc4448001cfa475270e2057f374b029ab8a2dd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation and ordinary authenticated workflow are well exercised, but the unresolved closed-turn bearer authority is a merge-blocking security defect.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated-worker terminal evidence exercises authenticated gh, HTTPS push, and draft PR creation, while focused tests prove profile rotation; neither proves that a retained process loses GitHub access when its turn closes or its identity is replaced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated-worker terminal evidence exercises authenticated gh, HTTPS push, and draft PR creation, while focused tests prove profile rotation; neither proves that a retained process loses GitHub access when its turn closes or its identity is replaced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Retained child receives the bearer token: The launcher resolves the profile token into GH_TOKEN and then execs the requested shell command, so a background descendant can retain that token after the turn's supervising path returns.
The new test preserves that capability: The retained-process regression intentionally keeps the first worker process alive across a second turn and verifies only that its old profile path is removed; it does not fence the original process's inherited token or require current turn authority before GitHub I/O.
Gateway checks happen before credential delivery: The binding validates the current worker claim around identity and worktree lookup, then returns the token in the launch binding; there is no later Gateway revalidation at child-process GitHub use.
Findings 1 actionable finding [P1] Fence retained processes from closed-turn GitHub credentials
Security Needs attention Retained child keeps GitHub bearer authority: The child launcher exports the turn token directly into a command that can outlive the turn, so later GitHub side effects cannot be checked against the authoritative active claim.

How this fits together

The Gateway prepares a GitHub identity binding for a cloud worker turn, which the worker materializes as a private GitHub CLI profile before launching agent shell commands. Those commands can commit or push directly, while Codex remote-exec and the Control UI retain their separate Gateway publication path.

flowchart LR
A[Gateway session] --> B[GitHub identity binding]
B --> C[Worker turn launch]
C --> D[Sealed credential launcher]
D --> E[Agent shell command]
E --> F[GitHub CLI and HTTPS Git]
Loading

Decision needed

Question Recommendation
May a retained background process on a single-session cloud worker continue to use the Gateway's shared GitHub bearer token after the turn that authorized it has closed? Fence closed turns: Use a credential path that revalidates current turn authority at each GitHub operation, or stop/fence credential-bearing retained descendants when the turn closes.

Why: The current design intentionally preserves background processes, but direct bearer delivery cannot revalidate a closed or changed turn at the GitHub side effect.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated-worker terminal evidence exercises authenticated gh, HTTPS push, and draft PR creation, while focused tests prove profile rotation; neither proves that a retained process loses GitHub access when its turn closes or its identity is replaced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Fence retained processes from closed-turn GitHub credentials (P1) - exec "$@" leaves GH_TOKEN in the launched command's environment, and retained background descendants survive the admitted turn. Removing the prior profile directory only prevents the old path from reading a later profile; it does not revoke the first token or require authority to still be current before a later GitHub operation. Either fence credential-bearing descendants at turn closure or replace this with an owner-mediated credential path that checks current authority per operation.
  • Resolve security concern: Retained child keeps GitHub bearer authority - The child launcher exports the turn token directly into a command that can outlive the turn, so later GitHub side effects cannot be checked against the authoritative active claim.
  • Resolve merge risk (P1) - A retained worker process can retain its injected GitHub bearer token after turn authority, identity selection, or session ownership changes; another process under the same worker OS user can also access a later turn's profile as the branch documents.
  • Complete next step (P2) - Resolve the closed-turn GitHub credential boundary with the responsible security owner, then add final-effect evidence for the chosen design before merge.
  • Improve patch quality - Obtain the explicit security-boundary decision.
  • Improve patch quality - Implement the selected authority fence if the retained-token boundary is not accepted.
  • Improve patch quality - Capture after-fix evidence that exercises a retained process after turn closure or identity replacement.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Fence retained processes from closed-turn GitHub credentials — src/agents/github-exec-launch.ts:39
  • [high] Retained child keeps GitHub bearer authority — src/agents/github-exec-launch.ts:39
Agent review details

Security

Needs attention: The direct bearer-token path crosses the worker turn boundary and remains available to retained same-user processes after that boundary closes.

PR surface

Source +208, Tests +507, Docs +13, Other +23. Total +751 across 66 files.

View PR surface stats
Area Files Added Removed Net
Source 31 407 199 +208
Tests 27 781 274 +507
Docs 4 24 11 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 4 27 4 +23
Total 66 1239 488 +751

Review metrics

Metric Value Why it matters
Production versus test delta production +434/-203; tests/support +781/-274; docs +24/-11 The +231 net production lines add a direct credential-delivery path and require security-boundary validation beyond the larger focused test expansion.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/gateway-protocol/src/schema/worker-admission.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #136583
Summary: This is the active direct-GitHub-identity implementation for worker turns; retained worker lifetime from PR 130733 is a distinct but enabling condition.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Fence authority before merge (recommended)
    Prevent retained descendants from using a closed turn's GitHub credential and add final-effect proof for turn closure or identity replacement.
  2. Accept the documented OS-user boundary
    A responsible security owner may accept the retained same-user bearer capability as an intentional cloud-worker trust model.

Technical review

Best possible solution:

Make direct GitHub authority unavailable once its admitted turn closes, or explicitly accept this retained same-user bearer-capability boundary after security-owner review and demonstrate the accepted final-effect behavior.

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

Yes, from source: launch a retained background process during a credential-bound worker turn, let the turn close, and the process retains the GH_TOKEN exported by the sealed launcher; the focused regression already keeps that process alive across a later turn.

Is this the best way to solve the issue?

No: per-turn profile rotation prevents an earlier inherited profile path from exposing a later token, but it cannot revoke the token already exported into a retained child or revalidate authority at its later GitHub side effect.

Full review comments:

  • [P1] Fence retained processes from closed-turn GitHub credentials — src/agents/github-exec-launch.ts:39
    exec "$@" leaves GH_TOKEN in the launched command's environment, and retained background descendants survive the admitted turn. Removing the prior profile directory only prevents the old path from reading a later profile; it does not revoke the first token or require authority to still be current before a later GitHub operation. Either fence credential-bearing descendants at turn closure or replace this with an owner-mediated credential path that checks current authority per operation.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 94edd0f0d5fc.

Labels

Label justifications:

  • P1: The PR changes live cloud-worker GitHub authority and can let closed-turn background processes perform repository actions.
  • merge-risk: 🚨 security-boundary: Merging grants direct reusable GitHub bearer capability to processes that can outlive the originating turn.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated-worker terminal evidence exercises authenticated gh, HTTPS push, and draft PR creation, while focused tests prove profile rotation; neither proves that a retained process loses GitHub access when its turn closes or its identity is replaced. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Retained child keeps GitHub bearer authority — src/agents/github-exec-launch.ts:39
    The child launcher exports the turn token directly into a command that can outlive the turn, so later GitHub side effects cannot be checked against the authoritative active claim.
    Confidence: 0.96

Acceptance criteria:

  • [P1] Exercise a retained background process after the originating turn closes and verify it cannot perform GitHub I/O unless the explicit accepted trust model says otherwise.
  • [P1] Exercise identity replacement or revocation while a retained process exists and capture the resulting GitHub operation outcome.
  • [P1] Rerun focused worker GitHub binding and worker runtime tests on the exact revised head.

What I checked:

  • Retained child receives the bearer token: The launcher resolves the profile token into GH_TOKEN and then execs the requested shell command, so a background descendant can retain that token after the turn's supervising path returns. (src/agents/github-exec-launch.ts:39, 25dc4448001c)
  • The new test preserves that capability: The retained-process regression intentionally keeps the first worker process alive across a second turn and verifies only that its old profile path is removed; it does not fence the original process's inherited token or require current turn authority before GitHub I/O. (src/worker/worker.runtime.test.ts:2161, 25dc4448001c)
  • Gateway checks happen before credential delivery: The binding validates the current worker claim around identity and worktree lookup, then returns the token in the launch binding; there is no later Gateway revalidation at child-process GitHub use. (src/gateway/worker-environments/worker-github-binding.ts:20, 25dc4448001c)
  • Documented same-user limitation: The branch explicitly documents that earlier background commands running under the worker OS user can read worker state and that profile rotation limits inherited paths rather than same-user access. Public docs: docs/gateway/cloud-workers.md. (docs/gateway/cloud-workers.md:493, 25dc4448001c)
  • Direct Codex boundary inspection: The sibling Codex checkout was inspected at 5adb68a49933ae446bf11935662c83dba55a0804. Its exec server builds a child environment from request policy and request environment before spawning; OpenClaw documents Codex remote-exec as a separate path, so this PR does not change that implementation boundary. (codex-rs/exec-server/src/local_process.rs:697, 5adb68a49933ae446bf11935662c83dba55a0804)
  • Current-main and release check: The checked-out PR head is not contained by the locally available main ref or a tag. Reading some current-main historical blobs required a promisor fetch, which could not complete because DNS could not resolve github.com; this is a source-context gap, not evidence that the PR is obsolete. (94edd0f0d5fc)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-02T20:47:01.344Z sha 5664f5f :: found issues before merge. :: [P1] Fence retained processes before replacing a turn credential
  • reviewed 2026-09-02T22:26:15.789Z sha 9eb0b24 :: blocked before merge. :: [P1] Isolate later credentials from retained earlier processes

A retained worker reuses its state directory across turns, so a background
process from an earlier turn inherited GH_CONFIG_DIR at the fixed profile path
and could read a later turn's credential once it was rewritten. Each turn now
writes its own profile directory and earlier ones are removed before the next
binding; a retained process keeps only the token it was launched with.
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review's P1 in 9eb0b24.

Fence retained processes before replacing a turn credential. The profile path is now turn-scoped: each turn writes its gh profile under <stateDir>/github-profiles/<runId>/, and the whole github-profiles root is removed before the next binding is written. A process retained from an earlier turn (a background exec that keeps the worker alive) inherited GH_CONFIG_DIR pointing at its own turn's directory, which no longer exists once the next turn binds, so it cannot read the later credential. It keeps only the GH_TOKEN it was launched with, which is the same lifetime it already has on the Gateway host. Terminating earlier exec on renewal was rejected: background servers that outlive a reply are a supported product behavior (#130733), and the filesystem boundary is sufficient because the launcher never hands a process anything beyond its own turn's token.

Regression proof. New worker.runtime.test.ts case drives a managed retained worker through two turns with different bindings; turn 1 starts a background process that records its GH_CONFIG_DIR, waits for a marker, then tries to read hosts.yml from that path after turn 2 has bound. It fails on the pre-fix code (the read returns turn 2's token) and passes on the fix (ENOENT, neither token present, turn-1 directory gone, turn-2 profile contains only its own login). Docs updated in the same commit.

Stored data model (skip, stated): no durable storage schema changed. The detector flagged protocol schema and gateway service files that only lost the worker-side github_publish RPC/feature; there is no SQLite, migration, or protocol-version change in this PR.

@clawsweeper clawsweeper Bot added 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 Sep 2, 2026
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision on the re-review (head 25dc444):

Isolate later credentials from retained earlier processes (P1) / cross-turn exposure / merge risk: skip, with the boundary stated. The finding is accurate about the mechanism: filesystem modes do not isolate processes that share the worker's OS user, so an earlier turn's background command could enumerate github-profiles/ and read the later turn's hosts.yml. It is not a principal crossing. Both turns belong to the same session, run the same agent, and receive the same shared tools.github identity; the "later token" is a refresh of the identity the earlier process was already launched with. This is the same boundary the Gateway host has today (a managed profile is readable by any process the agent starts as that user, see the "not an OS-user security sandbox" paragraph in docs/gateway/config-tools.md), and it is the operator's chosen tradeoff: the worker is given the shared identity so gh/git work directly. A per-turn OS identity or container boundary is not something the worker runtime can mint on a paired device (it runs as the node account), and on cloud workers the provider's throwaway single-session machine already is the boundary. Fencing earlier process trees before each binding would kill background servers that are a supported product behavior (#130733) and would still not revoke a token an earlier process already holds in its environment. The per-turn rotation stays because it closes the inherited-path read at zero cost. The limit is now stated explicitly in the "Turn-bound GitHub identity" security bullet of docs/gateway/cloud-workers.md and in the worker paragraph of docs/gateway/config-tools.md, with the dedicated-account guidance for paired session hosts. Option 2 (keep publication brokered) is rejected as it removes the capability this PR exists to add.

Authority-chain proof (P2): covered to the extent the boundary allows. The retained-worker regression in src/worker/worker.runtime.test.ts proves the inherited path is dead after the next binding and that neither token is readable through it; a same-user enumeration read is by definition permitted by the OS and is documented, not fenced.

Data-model compatibility proof: skip, no data model changed. The flagged protocol schema and gateway service files only lost the worker-side github_publish RPC and its worker-github-publication-v1 feature (deleted, not deprecated: the worker bundle is hash-bound to the Gateway build, so no older worker can present the removed feature to a newer Gateway and vice versa). No SQLite, migration, config, or protocol-version change is in this PR; pnpm protocol:check passed with no generated-client drift.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 2, 2026
@steipete
steipete merged commit 56d4058 into main Sep 3, 2026
360 of 363 checks passed
@steipete
steipete deleted the steipete/cloud-sessions-github-token-480a66 branch September 3, 2026 03:39
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 3, 2026
Keep disposable skill inputs in a private per-turn artifact directory while preserving rejecting worker-state and GitHub credential cleanup after #136583.

Refs #136957.
steipete added a commit that referenced this pull request Sep 3, 2026
* fix(worker): preserve turn outcomes when skill cleanup fails

Make temporary skill artifact deletion advisory across materializer, worker environment, and node skill-session cleanup. Warn on retained files while preserving completed results and original errors.

Closes #136957

* fix(skills): isolate turn artifacts from worker credential state

Keep disposable skill inputs in a private per-turn artifact directory while preserving rejecting worker-state and GitHub credential cleanup after #136583.

Refs #136957.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…stead of github_publish (openclaw#136583)

* feat(cloud-workers): bind the shared GitHub identity into worker turns

OpenClaw worker-turn cloud sessions now receive the Gateway's effective shared
GitHub identity per turn instead of a `github_publish` tool. The launch
envelope carries the verified access token, login, session branch, and HTTPS
origin; the worker writes a private gh profile in its throwaway state dir and
binds it to every exec launch through the existing launch-time credential
resolver, so `gh` and HTTPS `git push` work on the worker with the same
identity ordinary Gateway-host exec uses. The credential launcher ships as a
third sealed artifact in the hash-bound worker bundle.

The worker-side `github_publish` tool, its `worker.github.publish` RPC, and
the `worker-github-publication-v1` protocol feature are removed. The Gateway
publication broker stays for the Control UI Publish PR action and for Codex
remote-exec sessions.

* fix(worker): scope the GitHub profile to one turn on retained workers

A retained worker reuses its state directory across turns, so a background
process from an earlier turn inherited GH_CONFIG_DIR at the fixed profile path
and could read a later turn's credential once it was rewritten. Each turn now
writes its own profile directory and earlier ones are removed before the next
binding; a retained process keeps only the token it was launched with.

* docs(cloud-workers): state the same-OS-user limit of per-turn GitHub profiles
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
…w#136958)

* fix(worker): preserve turn outcomes when skill cleanup fails

Make temporary skill artifact deletion advisory across materializer, worker environment, and node skill-session cleanup. Warn on retained files while preserving completed results and original errors.

Closes openclaw#136957

* fix(skills): isolate turn artifacts from worker credential state

Keep disposable skill inputs in a private per-turn artifact directory while preserving rejecting worker-state and GitHub credential cleanup after openclaw#136583.

Refs openclaw#136957.
steipete added a commit that referenced this pull request Sep 3, 2026
…137035)

Trusted release tooling used its own worker artifact inventory for frozen
release targets. The launcher introduced by #136583 was consequently required
from the older 2026.9.1 target in Full Release Validation run 33714427358.

Read the target's sealed artifact path exports through tsx and pass them to
the existing guard. The target owns its inventory; local guard defaults and
all closure/layout checks remain unchanged. Reject non-string declarations.

Proof: 85 script tests and pnpm check:changed pass. Both new regressions fail
before the repair. Built and packed target 21616f1 and main eea96a3;
fixed release-check passes both full installed-runtime checks. Unfixed main
tooling rejects the frozen tarball, and fixed tooling rejects the main tarball
with its launcher removed. Independent P2 autoreview is scoped-clean.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…penclaw#137035)

Trusted release tooling used its own worker artifact inventory for frozen
release targets. The launcher introduced by openclaw#136583 was consequently required
from the older 2026.9.1 target in Full Release Validation run 33714427358.

Read the target's sealed artifact path exports through tsx and pass them to
the existing guard. The target owns its inventory; local guard defaults and
all closure/layout checks remain unchanged. Reject non-string declarations.

Proof: 85 script tests and pnpm check:changed pass. Both new regressions fail
before the repair. Built and packed target 21616f1 and main 801884b;
fixed release-check passes both full installed-runtime checks. Unfixed main
tooling rejects the frozen tarball, and fixed tooling rejects the main tarball
with its launcher removed. Independent P2 autoreview is scoped-clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant