Repository navigation
feat(cloud-workers): cloud sessions use the shared GitHub identity instead of github_publish - #136583
Conversation
|
🦞👀 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.
3167fa3 to
5664f5f
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 7:28 PM ET / 23:28 UTC. ClawSweeper reviewWhat this changesThe branch gives cloud worker exec commands a per-turn shared GitHub identity for direct Regression provenancePossible 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 Review scores
Verification
How this fits togetherThe 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]
Decision needed
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
Findings
Agent review detailsSecurityNeeds attention: The direct bearer-token path crosses the worker turn boundary and remains available to retained same-user processes after that boundary closes. PR surfaceSource +208, Tests +507, Docs +13, Other +23. Total +751 across 66 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 94edd0f0d5fc. LabelsLabel justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
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.
|
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 Regression proof. New 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 |
|
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 Authority-chain proof (P2): covered to the extent the boundary allows. The retained-worker regression in Data-model compatibility proof: skip, no data model changed. The flagged protocol schema and gateway service files only lost the worker-side |
|
Merged via squash.
|
* 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.
…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
…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.
…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.
…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.
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
originand a syntheticopenclaw-workerbranch, and the only publication path was agithub_publishtool that recorded a request for the Gateway to commit, push, and open a draft PR after the turn ended. The model could not rungh pr createorgit pushand see the result, and every publication detoured through the broker.Why This Change Was Made
Each OpenClaw
worker-turnnow receives the Gateway's effective shared GitHub identity (the sametools.githubselection ordinary Gateway-host exec uses) as a turn-bound binding in the private launch envelope: access token, verified login, session branch, canonical HTTPSoriginfor GitHub repositories, and any configured Git author. The worker writes the token into a privateghprofile inside its throwaway state directory and binds it to everyexeclaunch through the existing launch-time credential resolver, soGH_TOKENexists only in the child process,GITHUB_TOKENis cleared, and HTTPS Git authenticates throughgh auth git-credentialwith inherited helpers reset. The checkout is renamed to the session branch and gets an HTTPSoriginat turn start.The credential resolver is shipped as a third sealed artifact (
github-exec-launcher.mjs) in the hash-bound worker bundle next toworker.mjsand 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-sidegithub_publishtool, itsworker.github.publishRPC, and theworker-github-publication-v1protocol feature are deleted. The Gateway publication broker stays for the Control UI Publish PR action and for Codexremote-execsessions, which still see the localgithub_publishtool. 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,
ghis authenticated as the Gateway's shared GitHub identity andgit pushto 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.ghmust be installed on the worker host (Crabbox developer images include it; the docs show asettings.setupexample). Reconciliation still copies file contents, not commit history, back to the Gateway worktree, so pushed work lands on GitHub first. Cloud workers no longer offergithub_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_DIRin a scratch dir, port 19821, nativeghidentity = the Gateway host's keyring login), a paired node run withopenclaw connect --session-host, a session with a managed worktree on a private scratch repo,sessions.dispatchto the device, then onechat.sendasking the agent to run a fixed shell script throughexec. Sanitized tool output fromchat.history:gh auth statusshows the bound token as the active account viaGH_TOKEN; the node account's own keyring login is present but inactive.gh auth tokenon the Gateway host (f0c43122c1ff9334), so the worker used exactly the Gateway's effective identity, not a device credential.GH_CONFIG_DIRpoints at the private profile inside the worker's throwaway state dir;GITHUB_TOKENis empty; the effective credential helper list is reset and ends with!gh auth git-credential.origin;git ls-remote,git push -u origin HEAD, andgh pr create --draftall succeeded from the worker (draft PR created on the private proof repo, then closed and its branch deleted).sessions.reclaimafterwards reconciled the pushedPROOF.mdback 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
workspaceDirexceed the 256-character identifier limit and every turn failed withinvalid worker launch descriptorbefore any GitHub logic ran; a short state dir fixed it. That limit predates this change.Sealed launcher artifact
pnpm buildproducesdist/worker/github-exec-launcher.mjs(287 KB, all deps bundled) next toworker.mjsandworkspace-rsync-receiver.mjs; the paired node installed bundle3956de0a…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 / 0600hosts.yml, exits 1 with the "credential is unavailable or insecure" line for a 0755 dir or 0644 file.Local gates
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", expectedfailedgotinterrupted) 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.pnpm build(isolated copy-install checkout, so siblingpnpm installruns 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 onBoundary input changed during compilation: ../../../node_modules/@types/events/index.d.tswhenever another worktree runspnpm 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-existingno-shadowintest/scripts/changed-lanes.test.tsthat the test-root lint lane surfaces because this PR touches the file.Follow-up (not in this PR)
Tracked in #136584.
OpenClaw
worker-turncloud 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-sidegithub_publishtool was removed. Codexremote-execplacements still run their shell on the box without any GitHub credential and keep the Gateway publication broker (github_publishdynamic tool) as their only publication path.What a parity change needs (plugin-owned,
extensions/codex):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,sanitizeEnvVarsblocksGH_TOKEN/GITHUB_TOKEN). A deliberate OpenClaw-owned credential channel is needed rather than smuggling the token through the Codex-requested env.GH_CONFIG_DIRat it (Codex-native shells already use the profile-overlay contract locally, seedocs/gateway/config-tools.md"Codex-native shell is a separate boundary").codex.exec-server.stdio.v1invocation params (approval-visible, journaled); deliver it over the authenticated exec-server channel or through the placement's node workspace transfer.prepareWorkerGitHubBinding(src/gateway/worker-environments/worker-github-binding.ts).../codex/codex-rs/exec-server/src/local_process.rs(child env construction) andcodex-rs/core/src/exec_env.rsbefore changing env routing.Until then, remote-exec keeps
github_publishand the Control UI Publish PR broker.