Repository navigation
refactor(github): move personal connection authority to workers - #168948
Conversation
Preserve existing branch history while carrying reviewed S7 repairs.
…pairs Preserve existing branch history and stage-specific ownership contracts.
Preserve branch history and carry reviewed API, fixture, and static-gate repairs at their owning slice.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR moves personal GitHub connection operations into shared-state workers while retaining released synchronous service adapters. Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this maintainer-owned PR open: the worker migration is useful, but both previously reported correctness findings remain unresolved. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAuthenticated Gateway RPCs prepare profile authority, workers read or update private connection records, and the OAuth lifecycle manages GitHub requests and local CLI credentials. flowchart TD
A[Authenticated Gateway client] --> B[Personal GitHub RPC]
B --> C[Profile authority]
B --> D[OAuth lifecycle]
D --> E[Shared state worker]
E --> F[Private connection records]
D --> G[GitHub and managed credentials]
Technical reviewBest possible solution: Keep the worker migration, preserve credentials through uncertain connect outcomes, and revalidate the live selection immediately before refresh I/O. Do we have a high-confidence way to reproduce the issue? Source inspection establishes both introduced failure paths; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Moving these operations to the existing worker owner is appropriate, provided asynchronous failure handling preserves selected credentials and current authority at external effects. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90f04bfb10df. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The refresh handoff can perform credential-bearing I/O after connection revocation. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +658, Tests +90, Docs +2, Other 0. Total +750 across 31 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 11, 2026, 4:33 AM ET / 08:33 UTC (Revision 3). |
…claw#168948) * refactor(plugin-sdk): share legacy persistence warning budgets * refactor(github): move personal connection authority to workers * fix(github): propagate reviewed connection authority repairs Preserve existing branch history while carrying reviewed S7 repairs. * fix(github): propagate reviewed connections compatibility and gate repairs Preserve existing branch history and stage-specific ownership contracts. * fix(github): propagate reviewed connections gate repairs Preserve branch history and carry reviewed API, fixture, and static-gate repairs at their owning slice. * perf(github): reuse the state worker for role authority * perf(github): reuse state worker for connection reads * perf(github): reuse resident role authority * test(github): align authorization mock with worker policy * test(github): repair integrated connection fixtures * chore(test): prune explained GitHub mock baseline
First-parent upstream c96fac1..d9eba8a (10 PRs: openclaw#168948 GitHub connection authority to workers, openclaw#168975, openclaw#168772 cron receipt custody removal, openclaw#169012, openclaw#169006, openclaw#169009, openclaw#168283 test batch d042, openclaw#168994, openclaw#168964, openclaw#168855 approval/placement state in workers). Conflicts: - docs/reference/database-schemas/worker-access-inventory.md: took upstream, then regenerated (db:worker-inventory:gen, 633 files / 2449 calls) instead of hand-merging. - src/agents/embedded-agent-runner/compact-reasons.test.ts: upstream openclaw#168283 deleted low-value cases; kept upstream's file plus our own additions only (unknown_model, empty reason, closed-union check and the isCompactionSkipCode block). session-reset-service.ts auto-merged: upstream's awaited placement retirement (assertCurrent) is disjoint from our continuation-cancellation cleanup reason. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Personal GitHub sign-in, selection, disconnect, and refresh bookkeeping still perform native database work from the Gateway’s connection owner.
User Impact
Bundled callers now await the shared-state worker, preserving connection ownership checks and settlement of accepted refresh work. RPC shapes, credential storage, and sign-in behavior remain unchanged. This is the connection-authority prerequisite for the GitHub publication migration; publication request and execution paths are not cut over in this PR.
Why This Change Was Made
Typed commands move connection changes and refresh settlement into the existing state writer. OAuth/RPC callers and profile-merge retirement await that owner. Core-only synchronous mutation exports are removed after their bundled callers move.
Role authority reuses the Gateway’s retained canonical profile catalog without another worker request. Standalone callers without that catalog use the existing joined shared-state query. Both paths retain the same profile authority fence and never create absent storage. Connection get/list reads use the owning worker; their duplicate readonly protocol is removed.
Released OAuth
cancelAuthorizationanddisconnectkeep their immediatebooleanandvoidresults through native adapters. Bundled RPCs usecancelAuthorizationAsyncanddisconnectAsync; the old methods name those replacements and the next Plugin SDK major removal window through the shared deprecation helper. No schema, stored-data, retention, or update migration is required.S10 handoff after the complete stack: the parked
w6githublane can use host-mintedGitHubPublicationRequesterV2andPersonalGitHubSessionActionV2, withGitHubPublicationTransitionAuthorityand typed source/transition operations. This slice is a prerequisite; the complete-stack handoff includes canonical receipt installation before observers and does not claim removal of every final synchronous guard.Stack dependency: S7 slice 1/7, head
8fd45413281bfb884722a5c89deb8f0c2d1d137a, basemain. The original connection implementation base is951a75d4bf578a0843fb5497d1602b838827b4d6(dbasync/sw7d-base), including the shared SDK warning helper. This stack reuses that helper; no second helper is introduced.Evidence
Original complete-stack proof source:
f33795fc32205414b436f84f06dcd5e924255704, tree7e949f3b906ebc5e0f70dfa483b22c018c43c3cb. Its tree matches reviewed repairf33795fc32205414b436f84f06dcd5e924255704. post-runtime-repair-deb8cf38/source-relation.json — workerAwaitCorrection: exact twelve unnecessary awaits removed from one worker test; production and every other file equal b6. Actual proof heads retained. Slice1LandingIntegration records the separate remote-verified integrated successor; complete-stack f337 proof remains historical for that successor. Complete-stack results below do not claim a separate execution of this intermediate head.Final f337 worker Node/Bun fixtures pass 11/11 each. Lead accepted cumulative check coverage: 31 successful b6 prefix stages plus 11 native f337 suffix stages, retaining actual heads and original failures. All three user-approved cold exceptions now satisfy the same-flow warm ratio <=1.5 condition (repository 1.007232, shared 1.199175, failed preparation 0.572741). Integrated slice 1 static/tests pass at 5e6 and are reused through the one-line baseline-only 8fd successor. The hosted dispatch failure remains unresolved under the lead’s relaxed-v4 focused-pass disposition; targeted baseline and candidate runs both pass.
Landing addendum: current pushed head
8fd45413281bfb884722a5c89deb8f0c2d1d137a(treebcf921e2c5180abb4cb206507fcab521a396baf4) removes one obsolete mock factory from the generated baseline, 10123 → 10122; isolated review is scoped-clean. Its parent5e6d6038af0a15178e47e4d52c7cc1168aa2644acontains the five-file test/static repair and conflict-free main integration. The five static gates, Gateway 72/72, SDK surface 6/6 and runtime API guardrail 7/7 ran at that parent; no runtime or test source changes in the successor, so those results remain attributed to 5e6. Seventeen other test files reuse their byte-verified prior 59d6 results. The native mock-ratchet check passes at exact 8fd in 16.482 seconds with 10122 grandfathered factories and stable source. Original owner/common measurements retain their original heads.Hosted CI failed
chat.send deletes a session before its pending dashboard title finisheson CI merged26228ab(5e6 merged intobdcbb2d887062a9019f64cf516b7c9dff1f0a6bf). One targeted run per head on the same AWS host passed on baseline50cf629016e248cdea5fac810c8fc6b194155e01and candidate5e6d6038af0a15178e47e4d52c7cc1168aa2644a; the test source hashes match. Source audit found no direct S7 path, but neither an inherited failure nor a root cause is proven. The lead accepts the relaxed-v4 focused-pass route with this CI-only uncertainty retained; these reruns do not establish a fix or claim all hosted CI is green.Original implementation diff at
4c299f5f656f66b565e51e85e3fc8934925e6940relative to951a75d4bf578a0843fb5497d1602b838827b4d6: production +1152/−491 (1643 changed lines); tests +100/−18 (118 changed lines); docs +10/−9 (19 changed lines).The recorded GitHub-style comparison uses observed
mainrevision50cf629016e248cdea5fac810c8fc6b194155e01and merge base50cf629016e248cdea5fac810c8fc6b194155e01: production +1148/−490 (1638 changed lines); tests +149/−59 (208 changed lines); docs +15/−13 (28 changed lines). This is a pinned comparison, not a claim about current main.7a695a0f91db5de010a402c9452527b3623a17cc— 12-query census;14 committed-file hash matches. No escaped legacy caller, runtime alias, mutating read or retired route. Source proof only.8fd45413281bfb884722a5c89deb8f0c2d1d137a— check:test-mock-exports against 50cf; 10122 grandfathered factories. Stable source; exact one-row baseline deletion from tested 5e6, no runtime/test source changes.5e6d6038af0a15178e47e4d52c7cc1168aa2644a— Type-aware core/scripts lint, source contracts/export collisions, Knip export scan and SDK surface pass with native environment and stable source.5e6d6038af0a15178e47e4d52c7cc1168aa2644a— Gateway72/72 across authorization/users-GitHub/device-pairing; surface-report6/6; runtime-api guardrail7/7. Native reports show no failures, pending or todo.59d6ed2de0852030d3e532225f37d3a0b3b0e700— 17 prior test files reused, including connection/publication/authority siblings; every test blob hash independently matches5e6. This is prior-head evidence, not17 new executions.50cf629016e248cdea5fac810c8fc6b194155e01— One filtered run of the exact failing case on the same AWS host as the candidate; identical test source. Does not reproduce the hosted CI failure.5e6d6038af0a15178e47e4d52c7cc1168aa2644a— One filtered run; test source identical to baseline. The actual hosted job used a CI merge commit; this pass does not prove an inherited failure or a fix.59d6ed2de0852030d3e532225f37d3a0b3b0e700— Reviewed one-line mock export rename after conflict-only main integration; 6/6 authorization tests. Historical result; later integrated proof and explicit 17-file reuse are recorded above.4c299f5f656f66b565e51e85e3fc8934925e6940— Three alternating pairs against 951a75d; connected status, missing-pending cancel and disconnect, 18/18 tests across six runs. Existing profile catalog retained before measurement on both sides; accepted by lead. Synthetic transport, not live GitHub proof.f33795fc32205414b436f84f06dcd5e924255704— Node 11/11 and Bun 11/11; zero failed/pending/skipped/todo. Exact final source remained stable. Validates the twelve synchronous-read await removals.7a695a0f91db5de010a402c9452527b3623a17cc— Shared 23/23 and boundary 36/36 passed; includes unbranded legacy writer/callback paths. Both suites and production are unchanged through f337.a7c683b6829e50b595848a8357a6521557cd1e94— 58/58: repository 43 and requester aliases 15 at a7. The repository suite includes the legacy callback that observes the publishing transaction. Later 7a bookkeeping tests are separate.f0b9308c8af2f3211f1c2fe357baed96bc596f0d— 14/14 tests across user-channel-identities and user-profiles-multi-account; native single invocation. Historical exact-f0 result.b6e39b6b5f2c4769ee6ec8d232e02c581eed1ff9— 50/50, zero failed/pending/skipped/todo. Includes executed legacy personal-writer cases; validates the teardown correction. Source remained exact throughout.22b70997d7b0a5f7c85229b51f5a938f48739a32— Bun wrapper 1/1 is type-only; f0 SDK test typecheck 54.002s validates its assertions. Legacy runtime coverage is listed separately; no universal parity or inherited-reader claim.7a695a0f91db5de010a402c9452527b3623a17cc— Core types, SDK declarations, Madge, configured Knip files/dependencies and canonical all-exports passed. SDK declarations match all 298 original f0 path/hash entries without normalization. git diff --check also passed.f0b9308c8af2f3211f1c2fe357baed96bc596f0d— Original 951a→f0 comparison: no entrypoint additions/removals, 7 added exports, 182 reachable changes. Exact 7a declarations equal original f0; b6 is test-only. No new API-diff run.7a695a0f91db5de010a402c9452527b3623a17cc— Common:a0→7a, 3 pairs, accepted under attributed turn noise floor/non-turn tolerance. Failure:2c32→7a, 5 pairs, 40/40 tests; cold worker-turn preparation has a user-approved exception after same-flow warm ratio 0.572741; original cold ratio retained. Actual bases, counts and all timings below.deb8cf386e59daf7c84825a0a1b3fe57d7380842— Original deb8: 131 passed/1 failed. Personal observation failure resolved by 22b7 selected cases (6 passed/44 skipped, 67.978s); full personal suite now passes 50/50 at b6. Original four-file run remains failed.7a695a0f91db5de010a402c9452527b3623a17cc— Original7a run stopped at counted-line cap1002>1000; later steps did not run. The b6 correction passed the line cap, but this original run remains failed.b6e39b6b5f2c4769ee6ec8d232e02c581eed1ff9— Original b6 run:31 stages passed, then exactly12 worker-test await-thenable errors stopped lint; later stages did not run in that invocation. Reviewed f337 removed those awaits; the accepted cumulative row records the successful continuation without relabeling this failure.f33795fc32205414b436f84f06dcd5e924255704— Lead accepted 31 successful prefix stages at b6 plus all11 native suffix stages at f337. Native command environments preserved; core0 errors/19 warnings, extension/script0 errors, cycles0. Production unchanged; neither original failed run is relabeled as passing.CI seconds were not measured. Earlier f0 Gateway verification failed (383 passed/10 failed; 991.429s), leading to requester-abort, pending-recovery and fixture repairs. The deb8 failure and selected 22b7 resolution above retain that history. Executed legacy coverage includes unbranded shared/boundary writer paths at 7a and the repository callback at a7 and the personal writer at b6. The full b6 personal suite executes legacy writer cases with V2 fields stripped; synchronous connection cancel/disconnect fixture shapes were source-inspected. Branded V2 requesters called through old method names are not evidence of legacy behavior. The dedicated SDK fixture is type-only; this evidence does not claim universal writer/callback parity or inherited status-reader compatibility. Full b6 check:changed stopped at twelve await-thenable errors after its preceding type/dead-export stages passed; later checks are now covered by the corrected f337 suffix; the b6 invocation remains failed. Prior7a worker fixture results were Node11/11 in30.596s and Bun11/11 in28.199s; current f337 Node/Bun reruns now pass as listed above. The suffix attempt at
f33795fc32205414b436f84f06dcd5e924255704failed as tooling after 397.502812829s: the external runner dropped native command.env, promoting 19 untouched max-lines warnings to errors. Zero await-thenable errors remained. The corrected runner preserved native plan/environment and all11 suffix steps passed; that tooling failure remains recorded, with no source change. Evidence:renewal-f33795fc/evidence/results/changed/changed.log.Current Gateway-ready owner proof accepted. Three alternating pairs measured
951a75d4bf578a0843fb5497d1602b838827b4d6→4c299f5f656f66b565e51e85e3fc8934925e6940using approved fixturegithub-connections-gateway-ready.template.ts(SHA256062429ca922ac2186fb3caa00ed10bbc5e3b04763db9f8ca6b84e93c56a6b742). All six runs passed 3/3 tests (18/18 total); every native execution succeeded, every SQL median fell, and no duration ratio exceeded 1.5.Both sides retain the existing profile catalog before fixture creation and outside the measured RPC, matching the real Gateway lifetime. Coverage is connected status, missing-pending cancellation and disconnect through synthetic RPC fixtures; OAuth start/poll/install/refresh/expiry and live GitHub transport are not measured. Earlier standalone/no-catalog latency remains historical evidence for that different fixture. No user duration waiver was approved or is needed for this accepted Gateway-path result.
renewal-7914382e/evidence/results/owner1/comparison.jsonandcompletion.jsonretain every sample and exact measured source. Vitest suite-duration samples are base[57.88, 56.57, 55.55]seconds and candidate[56.14, 56.3, 55.79]seconds; these include fixture/build overhead and differ from the measured RPC milliseconds above. GitHub CI seconds were not measured.Common-workload applicability accepted. Current edge
951a75d4bf578a0843fb5497d1602b838827b4d6→4c299f5f656f66b565e51e85e3fc8934925e6940adds resident-catalog reuse. The lead acceptedresident-role-sql-source-bridge-7914382e.md: the common driver does not invoke the role change, all six retained ledgers/stacks exclude it, and all 45 attribution-source blobs remain unchanged. This is source-based reuse of the accepted historical workload, not a new common execution.Historical common workload accepted. Three alternating pairs measured
951a75d4bf578a0843fb5497d1602b838827b4d6→fd8535cdb4dd35d8a82402bf0a5cdf3f345887ab. All common duration windows are valid. Original measured identities, increases and correlation limits remain unchanged.First-turn falls by 56. Warmed mean rises by 4 (+0.3971%) under the noise floor. Its exact median-defining decomposition is
(candidate run 1 − base run 1) / 10; raw warmed samples are base[1007.2, 1008.1, 1005.5], candidate[1011.2, 1023.6, 1006.9].All 45 inspected owner/caller files are unchanged. Positive SQL signatures occur in baseline. Native memory lease
ROLLBACKtotals are 17 in every full workload; the largest positive warmed operation families also retain equal full-workload totals.userGitHubConnectionsdoes not execute in warmed samples;userProfiles.githubAttribution.resolvestays at 70 SQL / 10 requests. Operation and independent SQL-multiset accounting both reconcile exactly.Connect +46 is unchanged device bootstrap +4, cron +11, cleanup/images +22, plugin sweep +6, HTML provenance +3. Adjacent boot+connect sums are base
[3469, 3493, 3500], candidate[3508, 3540, 3539]; median 3493 → 3539, +46 (+1.3169%), duration ratio 1.026517. Second-session +6 (+0.1567%) is auth +6, memory −5, session writes −9, session reads +19, other −5. Both pass the lead’s non-turn disposition; other non-turn medians are flat/lower.Whole-workload SQL samples are base
[22030, 22047, 22011], candidate[22012, 22028, 22049]: median 22030 → 22028 (−2). Requests[3404, 3401, 3402]→[3398, 3398, 3401]: median 3402 → 3398 (−4). These are context, not a substitute for phase gates.Attribution uses source-based operation/caller accounting plus independent SQL multisets. Individual worker-ID/timestamp/stack-to-SQL correlation was not retained; this is not a fully reconstructed event trace.
common1-fd8535cd-owner-audit.mdand its JSON retain samples, source hashes, conservation and limits.The compatibility claim covers released writer/callback forms. Inherited status-reader limitations are recorded in the final stack PR; this slice does not establish whole-family reader compatibility.
Published-driver × candidate update cell: not required (v4). Connection/OAuth RPC authority, profile ownership and receipt changes; no update, Doctor, migration/schema DDL, plugin loading, or Gateway service startup/shutdown change. Moved connection table-existence reads preserve the original read behavior. The inherited shared SDK warning helper adds runtime diagnostics, not plugin loading.