Skip to content

fix(workers): retain admitted GitHub operator authority - #192540

Merged
roboclaw-bot merged 5 commits into
mainfrom
roboclaw/native-github-authority-20261104
Nov 4, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
roboclaw/native-github-authority-20261104

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: worker GitHub access can lose the operator authority from its admitted run when later grant preparation no longer has the original caller context.

User Impact

Admitted worker runs retain their original operator authority for GitHub access. Revocation still stops launch or refresh, and existing cleanup releases the retained authority. Missing authority is not promoted to synthetic authorization.

Why This Change Was Made

Pass original admitted authority into the existing GitHub grant owner, which retains and revalidates it and composes its abort signal with the current turn. Keep grant lifecycle and cleanup with that owner.

Evidence

Retained authority and refresh

  • Existing committed worker-github-binding.authority-wire.test.ts covers real admitted-request capture/release/retention, SQLite exact-turn binding, worker credential installation, production refresh dispatch and WorkerConnection delivery.
  • Removing retention produces 2/2 failures after request completion; the repaired combined suite passes 34/34, with 2/2 passing through the registered runner. Real operator-role revocation and turn reassignment suppress subsequent credential delivery.
  • The canonical test-inventory ordering is repaired; its affected selection suite passed 10/10.

Actual initial launch after public request completion

New committed runtime test passes 3/3 against a real built Gateway, public authenticated admission, production node invoke/workspace/bundle/supervisor owners, real WorkerConnection, and a real worker child:

  1. Allowed: public chat.send ACK completes before the held noncredential preparation request resumes. executeWorkerTurn and the production launch deliver the initial credential; the worker creates its real hosts.yml profile and reaches the provider. The profile disappears after settlement.
  2. Original operator revoked: a separate administrator uses public users.setRole while preparation is held. No credential-bearing launch, worker credential profile or provider request occurs for the original turn.
  3. Cancelled predecessor / legitimate successor: public chat.abort settles the old turn without credential delivery; a legitimate successor receives its own binding, runs and cleans up.

There are no manufactured grants, admission mocks, manual token-frame sends, direct credential-installer calls or direct pairing-store writes. QA password plumbing uses the existing GatewayClient password contract, allowing documented trusted-proxy admission plus authenticated local administration without changing core auth or disabling guards.

Source qualification and local gates

  • The runtime executed base 8bc44540c46d8d1e3d80800c7ea1b11277c2db02 plus this PR's existing production delta and the eight new proof files, under the supported network-none runner. Exact source digest and complete assertion/output receipt appear below.
  • All ten relevant runtime source hashes match the PR's composition with main b6287c8675cf14ef42e7385130fc4f8fff32fc2d (composition tree 676dbdbd53221852a942383f498cb98528a83ff0). The runtime receipt retains its actual executing source; it is not relabeled as a head-alone replay.
  • QA password selection is red on its exact base and green after correction. Integrated QA RPC 10/10 and child lifecycle 19/19 pass.
  • The broad preparation run initially had two capture-only Gateway fixture timeouts. Both were reproduced. Their helper incorrectly drained the inherited Gateway lifeline even though the tests require natural exit before listening. Stdin draining is now restricted to the real paste-api-key bootstrap command; no timeout or cleanup assertion was weakened. Both formerly failing cases pass (718ms / 229ms) while auth bootstrap still drains its input.
  • Actual changed-test-leaf typechecks, typed lint, formatting, diff checks and the full-PR test-line ratchet pass. The separate initial-launch allocation is 496; the shared scalar is unchanged. The earlier one-line deficit on the proof checkout's older baseline does not persist against this PR's actual publication base.
  • Fresh independent installed P0–P2 review is scoped-clean for the eight-file proof change with all 33 coupled source modules supplied. The later capture-helper correction has its own fresh scoped-clean review with complete fixture/caller/command/lifecycle context.
  • The earlier CI native-PID observation defect was repaired and qualified in merged #192539. Current-head CI remains the separate broad landing gate.

Limits

External GitHub HTTPS and model/provider responses are synthetic. The node test host executes production owners but is not a separately launched node CLI. This does not claim live GitHub, external model, cloud-worker or publication qualification. The preparation hold is before grant construction, not a prepared-retained-grant pre-send race; the existing retention/heartbeat tests provide that complementary authority-lifetime coverage.

Reproduction

npm_execpath="$(pnpm exec node -p process.env.npm_execpath)" node scripts/run-vitest.mjs --isolated-image sha256:847f71bbb3f17fc1032d50d75bf6fb3fdcf188b16dff81f24667fe9ae9409e01 run --config test/vitest/vitest.e2e.config.ts --configLoader runner test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts --maxWorkers=1
pnpm test extensions/qa-lab/src/gateway-rpc-client.test.ts extensions/qa-lab/src/gateway-child-lifecycle.test.ts --maxWorkers=1
Sanitized runtime receipt and source hashes
PR192540 initial GitHub launch proof
Base: 8bc44540c46d8d1e3d80800c7ea1b11277c2db02
Existing production context: fc26f4ad15692236107b258cff9b6616fe7d4bed (binding/turn changes only).
Runner: supported source-bound network-none isolated Vitest; actual built dist/index.js Gateway.
Paired node: production invoke/workspace/bundle/supervisor owners, real WorkerConnection and real worker child; not a separately launched node CLI.
External data: synthetic HTTPS GitHub API and synthetic model/provider HTTP responses. No live GitHub/cloud/model claim.

Passing source assertions: initial chat.send ACK precedes noncredential quiescence release; production launch carries expected credential; real worker-created hosts.yml contains fixture token; zero installed profiles after settlement. Original-user revocation prevents target launch/provider effect. Public cancellation prevents old-run delivery and a legitimate successor receives its own initial binding. No manual grant or credential installer calls.
Gate is before grant construction, not a prepared-retained-grant pre-send race. Existing heartbeat/retention proof remains complementary.

Exact runtime receipt:
[vitest:isolated] image sha256:847f71bbb3f17fc1032d50d75bf6fb3fdcf188b16dff81f24667fe9ae9409e01 (image environment and entrypoint overridden)
[vitest:isolated] source sha256:0809c9e665a963a3cf32852b23723e1dc1abae06009cae84f1c0814dfc109486; 63743 working-tree files; network=none; container=openclaw-vitest-d47cd3bc-ddc6-41aa-b5a7-1542fe0eb62d
[vitest:isolated] preflight Node v26.12.1, pnpm 12.15.0, Chromium OK
[build-all] tsdown done in 2m 47.5s
[build-all] runtime-postbuild done in 4.11s
[build-all] build-stamp done in 7ms
[build-all] runtime-postbuild-stamp done in 7ms
 ✓ test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts > shipped worker initial GitHub launch after request completion: allowed 29831ms
 ✓ test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts > shipped worker initial GitHub launch after request completion: original-operator-revoked 21637ms
 ✓ test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts > shipped worker initial GitHub launch after request completion: cancelled-before-successor 24143ms
[vitest:isolated] exit=0; container absence confirmed

      Tests  3 passed (3)
   Duration  125.23s (tests 61%, transform 36%, import 3%)
      Tests  3 passed (3)
   Duration  125.24s (tests 61%, transform 36%, import 3%)

Exact source SHA-256 stamps:
fc826382e5a182e58f63441b7eefc9390c992b9ef0b8b3835fc3b8d48a39a30f  config/test-lines-allocations/github-worker-initial-launch.txt
bfc1e7f1b1f0ffce5880a4be6b6d547a7ad35a3fef8105d2a37af1ed8cd4c7b1  extensions/qa-lab/src/gateway-child-setup.ts
ba0ad682a895e8730c9578968726aa5ac582e2d1514bd5317e4779fe2f9fb930  extensions/qa-lab/src/gateway-child.ts
fe4f851589d610de22ff12cbc687baa6fed2cc4f027e492924b8144ff3148c34  extensions/qa-lab/src/gateway-rpc-client.ts
fdfaf3e835307c53b2dff7477d3440bddf49f039e518331b4867098a1406c226  extensions/qa-lab/src/gateway-rpc-client.test.ts
d2f77fad7f55a3a57e2c17358a8e6fd0df95aa66a08d575ec5fd696aad320edd  test/e2e/qa-lab/runtime/paired-node-worker-wire-fixture.ts
5b893b6045be5299be911122970c9d038420b97cc5e57b40bbf2e40469277c31  test/e2e/qa-lab/runtime/worker-github-api-preload.mjs
6f58631379046325910e51412547375bddd4dc59edca359a145771d6352f481c  test/e2e/qa-lab/runtime/worker-github-initial-launch.e2e.test.ts
626a609cf0c10783849c8830b124d486465a037317d3e88fbebab9c67154bb11  src/gateway/worker-environments/worker-github-binding.ts
26ec7eee520b575473c0a2978d8c189628b17a55931dad2d3b89eccf02df0ce2  src/gateway/worker-environments/worker-turn-execution.ts

Exact-head CI attribution (run 41817860361)

CI remains failed, not green. The completed 92-job attempt has two non-aggregate failures; security-fast passed. CI tested merge ddc77ed2d8af7c9b78d7400e122296211372244e, with exact base 490aff93f1073897caff7c6db6909375c1b4ea00 and this PR head a46198f6a0b32b19e18b78945b6a43ca62d9a7b4.

  • Killed-run job: gateway-kill-restart-send.e2e.test.ts:137:88 expects no provider requests after restart but receives two. Supported isolated qaRuntime/pinned-Bun replays on both the exact base and merge reproduce the same assertion. The PR delta is not needed to produce it; the underlying original cause is not repaired here.
  • Provider-wire job: the unchanged P6 fixture reports Crabbox0.80.0 while the unchanged managed-binary owner requires0.81.0. CI explicitly rejects the fixture, selects managed0.81.0, and never reaches its warmup sentinel (0 != 1). Both local snapshots reproduce that assertion and source incompatibility. The isolated network-none run fails acquisition with EAI_AGAIN rather than CI's later AWS-credential error; full network-bearing replay is not claimed.

Both local runs used exact-lock dependencies, qaRuntime and CI's pinned Bun; build/launcher Node26.12.1 differs from CI24.22.1, and local selection was serial rather than a whole CI shard. All owned test containers were removed. These limits are retained in the inherited-failure admission evidence; no assertion, timeout, baseline, credential, review, or security gate was changed to make CI green.

@clawsweeper

clawsweeper Bot commented Nov 4, 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 4, 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR retains the admitted operator authority in the existing worker GitHub grant and revalidates it before credential delivery.

Example: An operator sends a repository-bound worker turn, and chat.send finishes before worker preparation.

  • Before: Later GitHub grant preparation can lose the original caller authority.
  • After: The grant retains that authority through launch and refresh, while revocation or cancellation prevents further credential delivery.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported repair with sufficient runtime authority proof; unresolved exact-head CI failures prevent a clean landing assessment.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied source-qualified Linux receipt exercises public authenticated admission through a built Gateway and real worker child, observing initial credential installation and cleanup while original-operator revocation and cancellation prevent launch; complementary real-transport refresh coverage rejects revoked and reassigned owners. GitHub and provider responses are synthetic, and the node host uses production owners inside the harness.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An admitted repository-worker run can lose GitHub access when later preparation no longer has the initiating caller context.
Reason: The maintainer-authored repair restores an existing credential-lifetime contract while preserving revocation and repository-only scope.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current worker authority-lifetime defect without introducing a verified correctness or security regression; required CI remains red with unresolved failure attribution.

Priority: P2
Reviewed head: a46198f6a0b32b19e18b78945b6a43ca62d9a7b4

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway converts an admitted run and its selected GitHub identity into a turn-bound credential grant, delivers credentials to the worker, and releases the grant during settlement.

flowchart TD
  A[Authenticated operator request] --> B[Admitted run authority]
  B --> C[Worker GitHub grant]
  D[Live operator and turn checks] --> C
  C --> E[Worker launch and heartbeat]
  E --> F[Private worker GitHub profile]
  C --> G[Settlement and release]
Loading

Technical review

Best possible solution:

Retain the original source in the existing grant owner, preserve final-effect revocation checks, and land after required CI is resolved.

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

Current main omits original-operator retention at the grant boundary; supplied negative controls and runtime receipts support the failure path, though this read-only review ran no reproduction.

Is this the best way to solve the issue?

The repair uses the existing grant's lifetime, cancellation, validation, and cleanup owners without adding parallel authorization machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Worker GitHub grant lifecycle keeps the original intent (824fde2: Keep repository-worker GitHub credentials renewable only while the original caller, writer, workspace, and account remain current.)
  • QA RPC authentication keeps the original intent (f312d6c: Preserve selected Gateway authentication in the no-fork RPC path; explicit password selection retains token behavior for existing callers.)
  • Capture fixture stdin lifetime changes intended behavior with a stated reason (6c9dbe3: Drain auth bootstrap input to avoid EPIPE; this PR explains and narrows draining to paste-api-key so capture-only Gateways can terminate naturally.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 56d4058 adds src/gateway/worker-environments/worker-github-binding.ts:63 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 56d40589c699; files: src/gateway/worker-environments/worker-github-binding.ts)
  • RoboClaw: Raw commit 824fde2 adds src/gateway/worker-environments/worker-github-binding.ts:130 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 824fde2bfab6; files: src/gateway/worker-environments/worker-github-binding.ts)

PR surface

Source +23, Tests +887, Other +7. Total +917 across 15 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 5 25 2 +23
Tests 8 890 3 +887
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 7 0 +7
Total 15 922 5 +917

Review metrics

Metric Value Why it matters
Production versus test growth Production +25/-2; tests and test support +889/-3 The small lifecycle repair is supported by distinct initial-launch, refresh, revocation, cancellation, successor, cleanup, and QA authentication boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The defect affects GitHub credential availability for admitted repository-worker turns, with a focused repair and limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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.

Rank-up moves

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

  • Attribute the killed-run restart and cloud-profile CI failures against a baseline, repairing only failures caused by this PR.

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 (3 earlier review cycles)
  • reviewed 2026-11-04T04:49:15.378Z sha 2f5e35a :: needs real behavior proof before merge. :: [P2] Remove the unsupported role property from the authority fixture
  • reviewed 2026-11-04T06:35:03.922Z sha 513ba67 :: needs real behavior proof before merge. :: [P2] Place the new test in canonical manifest order
  • reviewed 2026-11-04T11:12:58.396Z sha a46198f :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 6:22 AM ET / 11:22 UTC (Revision 4).

Address hosted review with production-owner proof and preserve current authority and lifecycle ownership.

Co-authored-by: galiniliev <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 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. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 4, 2026
roboclaw-bot and others added 3 commits November 4, 2026 06:38
Repair the exact PR-caused CI bookkeeping failure; production and behavior-proof code remain unchanged.

Co-authored-by: galiniliev <[email protected]>
Exercise real Gateway and worker launch/profile effects after the original request completes, revocation, cancellation, and a legitimate successor. Preserve explicit QA password selection for trusted-proxy fixtures.

Co-authored-by: galiniliev <[email protected]>
Retain auth bootstrap input draining while allowing capture-only Gateway fixtures to terminate before readiness. Preserve environment and lifetime assertions.

Co-authored-by: galiniliev <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 4, 2026
@roboclaw-bot
roboclaw-bot merged commit e0a67d8 into main Nov 4, 2026
204 of 208 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/native-github-authority-20261104 branch November 4, 2026 12:23
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Nov 4, 2026
Keep distinct route, ordering, trigger, publication, custody, and fixture-lifecycle contracts from #192769, #192540, #192250, #192812, #191643, #192584, #192588, and #192083. Raise only the scalar by the exact measured inherited deficit; production and test LOC remain unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
)

* fix(workers): retain admitted GitHub operator authority

Co-authored-by: galiniliev <[email protected]>

* test(workers): exercise retained GitHub authority through token delivery

Address hosted review with production-owner proof and preserve current authority and lifecycle ownership.

Co-authored-by: galiniliev <[email protected]>

* test(workers): preserve canonical Gateway test ordering

Repair the exact PR-caused CI bookkeeping failure; production and behavior-proof code remain unchanged.

Co-authored-by: galiniliev <[email protected]>

* test(github): prove initial worker credential delivery

Exercise real Gateway and worker launch/profile effects after the original request completes, revocation, cancellation, and a legitimate successor. Preserve explicit QA password selection for trusted-proxy fixtures.

Co-authored-by: galiniliev <[email protected]>

* test(qa): bound stdin draining to auth capture commands

Retain auth bootstrap input draining while allowing capture-only Gateway fixtures to terminate before readiness. Preserve environment and lifetime assertions.

Co-authored-by: galiniliev <[email protected]>

---------

Co-authored-by: galiniliev <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
Keep distinct route, ordering, trigger, publication, custody, and fixture-lifecycle contracts from openclaw#192769, openclaw#192540, openclaw#192250, openclaw#192812, openclaw#191643, openclaw#192584, openclaw#192588, and openclaw#192083. Raise only the scalar by the exact measured inherited deficit; production and test LOC remain unchanged.
RomneyDa added a commit that referenced this pull request Nov 16, 2026
Port only the applicable test-fixture correction from #192540. Keep capture-only Gateway fixtures from waiting on their inherited lifeline while preserving auth bootstrap input draining. The second source-root helper does not exist on this baseline; unrelated worker-authority changes are not included.

Proof: the unchanged capture fixture timed out at 120s; after the correction all 48 gateway-child consumers pass. Scoped format, lint and diff checks pass.

(cherry picked from commit e0a67d8)

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

extensions: qa-lab gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant