Skip to content

refactor(gateway): finish GitHub publication worker cutover - #169581

Merged
steipete merged 11 commits into
mainfrom
dbasync/t1cut-ghpub
Oct 12, 2026
Merged

steipete merged 11 commits into
mainfrom
dbasync/t1cut-ghpub

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

GitHub publication still opened SQLite on the Gateway main thread through synchronous stores and coordinator APIs, despite having worker-owned replacements. Shared, personal, and repository publication now use the existing worker owner throughout; bundled callers await the async/V2 APIs. The worker owns durable changes and returns receipts; the coordinator retains active execution and workspace exclusion.

All 42 assigned T1 call sites are removed: personal store 9, shared store 12, repository store 14, coordinator methods 5, coordinator 1, repository kernel 1. SQL implementations live in explicit .worker.ts modules. The superseded internal stores are deleted. Ten public synchronous coordinator methods retain deprecated signatures and emit the existing SDK warning before directing callers to their async/V2 replacement; no synchronous fallback remains. The migration guide lists the replacements. First-use lazy schema creation remains worker-owned.

Credential, requester, session disclosure, and external-effect authority checks remain. No schema version, stored format, retention, update, or durability contract changes. Native incognito paths remain outside this cutover.

Removed checks and accepted edges

  • Repeated personal/repository execution-row reads: coordinator ownership and workspace exclusion govern the active execution; a stale durable update fails the existing CAS.
  • Repeated existence and terminal-status reads: consume the row returned by the worker; concurrent settlement can leave a transient stale status until the next read.
  • Workspace owner recapture before snapshot and publication-branch reread before materialization: use the prepared owner and revision; an overlapping internal settlement can require a retry.
  • Reads before execution claim/effect updates: put the predicate in the conditional write; CAS failure remains visible.
  • Deferred same-key admission reread after identity preparation: rejection details describe this invocation; an overlapping request can commit while this invocation returns a selection rejection. The earlier durable receipt and external effect remain protected by idempotency.

Tests tied only to the removed rereads are removed. Credential-revocation proof remains at the actual external-effect boundaries.

SQL measurement

Shared live Gateway workload, isolated synthetic state and ports; baseline 943da4fc9366, candidate cc5ae26e9c6f / test-only successor 72f25a88d018. Final head adds the obsolete-test deletion and a conflict-free main merge. Only the copied harness output directory was relocated; the shared harness was not edited.

Values are all-thread per-turn averages over each run's ten warmed turns; MAIN is shown separately. Two alternating pairs were run because the first pair's request delta was ambiguous.

Run Warm statements M → C Warm requests M → C MAIN M → C Whole-workload statements M → C Whole-workload requests M → C
Initial 361.7 → 356.4 112.2 → 113.6 0.2 → 0.2 10,174 → 10,267 2,159 → 2,215
Extra 318.2 → 320.5 99.7 → 100.6 0 → 0 9,417 → 9,496 1,892 → 1,919

Across run averages, warmed median [min–max]: statements 339.95 [318.2–361.7] → 338.45 [320.5–356.4]; requests 105.95 [99.7–112.2] → 107.10 [100.6–113.6]; MAIN 0.1 [0–0.2] → 0.1 [0–0.2]. Warm duration ratios were 1.125 and 1.284.

No warmed query saving is claimed. The completed extra pair had identical publication operation totals and no publication operations in its warmed windows. Its small global rise comes from untouched session/domain-publication, plugin-state, and maintenance work. The initial pair ran one additional existing publication-poll round on the candidate (same statements per operation). The measured result of this PR is the T1 cutover, with no demonstrated increase in publication operation cost.

Publication operation, completed pair Requests (each side) Statements (each side)
personal 1 2
shared 2 6
repositoryList 6 0
sharedList 4 4
unreported 2 0
receipt-deletion preparation + deletion 2 0

The extra pair passed the full harness, calibration, and SQL/request census reconciliation. The initial candidate passed all 13 turns, cron, compaction, and shutdown, but the wrapper failed on an unrelated mentions.dismiss returning UNAVAILABLE in the control-plane phase; its counts are disclosed above, not represented as a full harness pass.

Evidence

  • Local v6 proof: changed-file oxfmt, plain oxlint, and git diff --check.
  • Real-worker regression suite passed 12/12 before the v6 process change, including lazy schema creation, receipt readback, and stale execution CAS rejection: pnpm test src/state/github-publication.worker.test.ts --maxWorkers=1, 44.27 seconds wall time. Subsequent test and static validation runs in PR CI.
  • Codex autoreview: two attempts total; the first was invalidated by edits, and the second found a missed fixture import, now fixed. No additional broad review rounds.
  • CI worker ratchet: T1 raw 607 → 565, forwarding-normalized 605 → 563; changed-scope dialect groups 0 → 0. Final-head CI 38215804828 passed at 386ac1a9fb6b: production/test types, lint, Knip/source contracts, Madge/architecture, SDK/runtime guards, T1/dialect ratchets, and all scheduled test shards.
  • Earlier focused SDK API diff found no removed public top-level entrypoints; removed declarations were internal transitive exports. SDK surface, export collisions, Knip, and Madge are also covered by the required checks.
  • The published-driver update cell is not applicable: this changes no update, Doctor, schema migration, plugin loading, or service lifecycle behavior.

LOC against main: production +1,149 / −2,084 (net −935); tests/support +932 / −776; docs +31 / −33. CI previously identified stale fixture imports/authority setup and two obsolete reread assertions; those are fixed. The final-head run is green, including the build-artifact smoke that had failed in the prior run.

@clawsweeper

clawsweeper Bot commented Oct 12, 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 docs Improvements or additions to documentation gateway Gateway runtime size: XL labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR moves remaining GitHub publication persistence into state workers and makes legacy coordinator methods reject with async or V2 migration guidance.

Example: A plugin calls githubPublicationService.requestForSession to publish session work.

  • Before: The deprecated method executes through the native compatibility path.
  • After: The method rejects and directs the plugin to requestForSessionV2 with a host-prepared requester.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-directed consolidation with passing final-head test CI and preserved storage contracts, but one compatibility diagnostic finding remains.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal cutover is outside the ordinary contributor proof gate; the supplied live Gateway census and real-worker CI support persistence behavior but do not demonstrate a shipped publication flow.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Synchronous publication persistence can block other Gateway work despite existing worker-owned replacements.
Reason: The established feature owner directs the cutover and explicitly accepts legacy fail-fast behavior and recoverable bookkeeping edges.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this PR open: the owner-directed worker cutover remains useful, but the previously reported compatibility diagnostic defect is still unresolved.

Priority: P2
Reviewed head: 386ac1a9fb6b8ede1ae6b5d66f012239510b39b5

Before merge

  • Correct legacy publication compatibility diagnostics (P3) - A plugin calling requestForSession receives the warning helper's default promise that the legacy contract remains supported in the current SDK major, then immediately receives rejection. The same contradiction affects the other retired publication methods, and the compatibility registry still promises native ordering and synchronous completion. Supply accurate compatibility text at retired publication calls and update the publication registry guidance while preserving the separate OAuth compatibility guarantee. This previously reported finding remains unresolved.

Findings

  • [P3] Correct legacy publication compatibility diagnostics — src/gateway/github-publication.ts:490-492

Tests

  • Missing end-to-end proof: The supplied Gateway census does not demonstrate a shipped Publish PR and restart-recovery flow; the ordinary contributor proof gate does not apply to this maintainer-authored internal refactor.
Agent review details

How this fits together

Gateway coordinators accept authorized publication requests, persist receipts through state workers, execute guarded GitHub operations, and return publication outcomes.

flowchart LR
  A[Session publication request] --> B[Gateway coordinator]
  B --> C[Requester and workspace authority]
  B --> D[State worker]
  D --> E[SQLite receipts]
  C --> F[GitHub executor]
  F --> G[Push and pull request]
  F --> D
Loading

Technical review

Best possible solution:

Complete the worker cutover with accurate legacy compatibility warnings and registry guidance while preserving the retained effect guards.

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

Calling a retired publication method reaches the shared helper's continued-support warning and then rejection; source establishes this contradiction without executing target code.

Is this the best way to solve the issue?

The existing state worker is the appropriate persistence owner, and the remaining repair should correct diagnostics without restoring native execution or redundant rereads.

Full review comments:

  • [P3] Correct legacy publication compatibility diagnostics — src/gateway/github-publication.ts:490-492
    A plugin calling requestForSession receives the warning helper's default promise that the legacy contract remains supported in the current SDK major, then immediately receives rejection. The same contradiction affects the other retired publication methods, and the compatibility registry still promises native ordering and synchronous completion. Supply accurate compatibility text at retired publication calls and update the publication registry guidance while preserving the separate OAuth compatibility guarantee. This previously reported finding remains unresolved.
    Confidence: 1

Overall correctness: patch is correct
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Worker-owned publication persistence keeps the original intent (c2e1f0f: Provide transaction-local publication commands and committed receipts for subsequent coordinator migration.)
  • Legacy SDK publication execution changes intended behavior with a stated reason (aec8993: Preserve released native execution contracts during the staged migration; this PR explicitly retires that execution and documents replacements.)
  • Repeated execution and receipt observations changes intended behavior with a stated reason (c5ccf14: Retain execution custody during staged migration; this PR replaces bookkeeping rereads with workspace exclusion and conditional writes.)
  • Saved requester authority and accepted-effect recovery keeps the original intent (65e49fa: Bind queued publication to its original requester and grant while preserving recovery of accepted effects after access ends.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/plugins/sdk-deprecation.test.ts src/plugins/compat/registry.test.ts src/plugin-sdk/gateway-placement-compat.test.ts --maxWorkers=1
  • pnpm test src/gateway/github-publication.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Accepted cutover direction: The complete PR body explicitly retires native publication execution, accepts recoverable bookkeeping races, and retains external-effect authority checks; the supplied repository state identifies the author as MEMBER. (386ac1a9fb6b)
  • Remaining compatibility defect: Retired publication methods omit the warning helper's compatibility override. Its default promises continued support immediately before those methods reject; the compatibility registry also promises native ordering and synchronous completion. (src/gateway/github-publication.ts:487, 386ac1a9fb6b)
  • Prior findings reconciled: The obsolete final-worktree-read revocation scenario and deferred concurrent-admission assertion were removed consistently with the recorded cutover contract; the compatibility warning code remains unchanged from the earlier reviewed head. (src/gateway/github-publication-admission.test.ts:273, 386ac1a9fb6b)
  • Final-head test workflow passed: The completed workflow https://github.com/openclaw/openclaw/actions/runs/38215804828 reports success for the reviewed head, resolving the earlier test and build-artifact failures. (386ac1a9fb6b)
  • Separate body-validation failures: The failing PR context check reports missing authored problem/evidence sections, rather than a production or test failure; the complete current body contains both sections. This does not establish a diff-caused defect. (386ac1a9fb6b)
  • Stored-format compatibility: Comparing the original stores with their worker replacements shows preserved receipt formats and digest definitions, retained execution CAS predicates, and the existing lazy schema installer moved to shared worker insertion; no data migration is required. (src/state/github-publication-request.worker.ts:132, 386ac1a9fb6b)

Likely related people:

  • Peter Steinberger: Raw commit aec8993 adds src/gateway/github-publication.ts:517 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aec89935b8f4; files: src/gateway/github-publication.ts)
  • Shakker: Raw commit 65e49fa adds src/state/github-publication-requester.ts:3 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 65e49fa2008c; files: src/state/github-publication-requester.ts)

PR surface

Source -935, Tests +156, Docs -2. Total -781 across 61 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 28 1149 2084 -935
Tests 31 932 776 +156
Docs 2 31 33 -2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 61 2112 2893 -781

Review metrics

Metric Value Why it matters
Production versus tests Production +1,149 / −2,084; tests/support +932 / −776 Production shrinks by 935 lines as native adapters are retired; test growth migrates existing contracts and covers first-use worker schema creation.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority publication storage refactor with a bounded remaining diagnostic repair.
  • merge-risk: 🚨 compatibility: Previously executable SDK coordinator methods now reject; the feature owner explicitly accepts that change and documents async/V2 replacements.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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-10-12T03:51:06.028Z sha 4c15a58 :: needs changes before merge. :: [P2] Import the database opener used by the migrated lifecycle reads | [P2] Migrate the remaining history-budget consumer of removed store exports | [P2] Persist matching source facts for the migrated boundary scenarios | [P2] Align the private-source test with the durable-only V2 contract | [P3] Update compatibility diagnostics for legacy methods that now fail
  • reviewed 2026-10-12T04:43:48.082Z sha f366a54 :: needs changes before merge. :: [P2] Preserve typed requester denial when classifying invocation loss | [P2] Use the absence-safe worker API for shared receipt reads | [P2] Finish seeding canonical worktree facts for V2 scenarios | [P3] Make legacy warnings match the fail-fast compatibility contract
  • reviewed 2026-10-12T05:41:51.822Z sha cc5ae26 :: needs changes before merge. :: [P2] Inject publisher revocation at a retained admission boundary | [P2] Align concurrent admission coverage with the accepted V2 contract | [P3] Make legacy warnings match the fail-fast compatibility contract

Reviewed October 12, 2026, 3:23 AM ET / 07:23 UTC (Revision 4).

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 12, 2026
@steipete
steipete merged commit 5b24226 into main Oct 12, 2026
154 of 156 checks passed
@steipete
steipete deleted the dbasync/t1cut-ghpub branch October 12, 2026 07:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Landed under the relaxed landing policy with final-head CI green. Remaining P3 follow-up from review: give retired publication methods accurate compatibility-warning text and update the publication compatibility registry guidance, while preserving the separate OAuth compatibility guarantee. The methods already fail explicitly with their async/V2 replacement names, and the migration guide documents that behavior; this is a diagnostic inconsistency, not an additional execution path.

steipete added a commit that referenced this pull request Oct 12, 2026
Retired GitHub publication methods warned that their legacy contract remained supported immediately before failing. Supply accurate migration diagnostics at all retired entry points and align compatibility registry and policy text, preserving the separate personal OAuth synchronous guarantee.

Adds a coordinator regression for the failure, replacement warning, and per-plugin warning budget. SQL, worker ownership, authority, and API signatures are unchanged. Follow-up to #169581; triage of the 70 merged campaign PRs is recorded in #169750.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…#169581)

* refactor(gateway): finish GitHub publication worker cutover

* fix(gateway): retain lazy publication schema in worker

* test(gateway): complete publication worktree fixture

* fix(gateway): preserve publication recovery through async cutover

* fix(gateway): align publication fixtures and revocation results

* test(gateway): remove retired publication reread assertions
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…9750)

Retired GitHub publication methods warned that their legacy contract remained supported immediately before failing. Supply accurate migration diagnostics at all retired entry points and align compatibility registry and policy text, preserving the separate personal OAuth synchronous guarantee.

Adds a coordinator regression for the failure, replacement warning, and per-plugin warning budget. SQL, worker ownership, authority, and API signatures are unchanged. Follow-up to openclaw#169581; triage of the 70 merged campaign PRs is recorded in openclaw#169750.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant