Repository navigation
feat(gateway): broker GitHub publication - #126306
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 1:44 PM ET / 17:44 UTC. ClawSweeper reviewWhat this changesAdds a Gateway-owned broker that lets local and cloud session worktrees publish a reconciled branch and draft GitHub pull request through the selected GitHub identity. Merge readinessKeep open for maintainer review: this is a substantial new Gateway-owned GitHub write boundary, not work already on current main. The earlier recovery, authority, UI fallback, and title findings are covered on the current head; the remaining decision is whether to require a disposable end-to-end GitHub write before landing. Priority: P1 Review scores
Verification
How this fits togetherAgent tools and the Control UI submit bounded publication intent to the Gateway, which owns session worktrees, identity selection, recovery state, Git operations, and pull-request creation. Cloud workers remain credential-free and receive the final publication outcome through the session flow. flowchart LR
A[Control UI or agent tool] --> B[Gateway publication request]
B --> C[Session and identity validation]
C --> D[Durable publication record]
D --> E[Reconciled session worktree]
E --> F[GitHub branch push]
F --> G[Draft pull request outcome]
Decision needed
Why: The code intentionally handles effective GitHub credentials and mutates user worktrees; accepting the remaining live-proof gap is a maintainer security and release decision. Before merge
Agent review detailsSecurityNone. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use a disposable repository and correctly scoped temporary identity to prove request, reconciliation, push, draft-PR creation, and redacted recovery on the exact head before accepting this new write boundary. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds a new publication capability rather than repairing an established behavior. Is this the best way to solve the issue? Unclear: the Gateway-owned design is the appropriate owner boundary for credential-free workers, but a disposable end-to-end publish is still needed to establish that this is safe to ship. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e474d23e653c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
d46634d to
66e09cb
Compare
|
Land-ready evidence for exact head Exact-head CI is green: run 32282723563. The latest ClawSweeper review is on this head, reports no findings or security concerns, and confirms the earlier recovery, authority, browser fallback, bounded-title, and repeat-publication findings are addressed. Local proof completed:
Visual proof:
ClawSweeper remaining-item disposition:
The broker keeps the effective RoboClaw/agent GitHub user as commit and PR actor, deterministic verified humans as co-authors, and all forge credentials out of cloud workers. |
|
Merged via squash.
|
* feat(gateway): broker GitHub publication * refactor(gateway): split publication owners * fix(gateway): enforce publication branch authority * fix(gateway): bind publication to remote identity * fix(gateway): bind publication recovery to remote state * fix(gateway): preserve publication git state * fix(gateway): retain publication recovery authority * fix(gateway): commit publication index atomically * fix(gateway): narrow publication index errors * refactor(gateway): keep publication CAS errors private * fix(gateway): recover publication index transactions * fix(agents): describe GitHub publication tool * fix(gateway): harden publication base fetch * fix(gateway): reject publication filter semantics * fix(gateway): verify publication creation base * refactor(agents): align publication tool options * fix(gateway): isolate publication object lineage * refactor(gateway): use shared table probe * test(gateway): keep publication helpers in routed suite * perf(ui): lazy-load GitHub publication request * fix(gateway): preserve publication support contracts * fix(gateway): recover publication before authority checks * fix(gateway): fence local publication snapshots * fix(android): format generated protocol models * fix(gateway): harden publication recovery * fix(gateway): fence publication recovery * fix(ui): reset completed publication cycles
Related: #125157
Prior phases: #125158, #125199
What Problem This Solves
Cloud and managed-worktree agents can finish repository work but cannot safely publish it: workers intentionally receive no standing forge credential, while ambient host credentials may belong to the wrong GitHub principal or lack write scope. Operators are left with reconciled work that must be pushed manually, and the Control UI cannot show a trustworthy publication outcome.
Why This Change Was Made
This adds a durable Gateway-owned publication broker. The Gateway waits for authoritative workspace reconciliation, revalidates the exact session/worktree/branch and effective GitHub identity, creates a deterministic attributed marker commit, compares and swaps the local branch and index with restart-safe recovery, pushes the exact commit over HTTPS, and creates or reuses a draft pull request.
The effective RoboClaw/agent GitHub user is the commit and pull-request actor. Verified human participants are deterministic
Co-authored-bytrailers. Cloud workers receive no forge credential; they can request publication only through their live turn authority. OAuth/device authorization remains the next separate phase (PR4) and is intentionally not implemented here.User Impact
Operators can publish reconciled local or cloud-session work from the Control UI and see a pending, published, actionable failure, or cloud-idle guidance state. Publication survives Gateway restart and ambiguous Git/index outcomes without silently switching identities or overwriting concurrent staged work.
Evidence
Visual proof
Before current
main— the branch row has no publication state:Pending publication:
Published with an Open PR action:
Typed failure with a concrete retry action:
Cloud-idle guidance:
Pending-to-published recording:
[email protected]
Local proof on
36b56840a6d913d937c6c74868c4cdabc070ba41git diff --checkpnpm tsgopnpm check:test-typespnpm db:kysely:checkpnpm protocol:check: registry, schema, Swift/Kotlin generation, and protocol-since guards passed without drift.:app,:benchmark,:wear, and:wear-sharedktlint checks passed after fixing the generator-owned import ordering and generated round-trip test formatting caught by exact-head CI.extensions.worktreeConfig, Git safety and authority validation before recovery mutations, closed-PR recovery, browser Create PR fallback, bounded UI requests, idempotency-key reuse after an unknown outcome, and same-session repeat publication after merge/close.swift test --package-path apps/shared/OpenClawKit --filter GatewayProtocolGeneratedModelsTests: six generated-model round-trip tests passed.node scripts/check-changed.mjs -- <affected core/UI paths>: passed all scoped gates.pnpm build: passed after the recovery/fallback repairs, including runtime postbuild and production Control UI build/performance checks; the final lifecycle-only follow-up passed UI typecheck/E2E and is covered by exact-head CI.origin/main: clean, no accepted/actionable findings.LOC
+4524/-244(net+4280)+4061/-106(net+3955)+219/-0+81/-16(net+65)+9/-3(net+6)CHANGELOG.mdis untouched as required for this maintainer-authored phase.The production growth is the new capability and its owner boundaries: protocol/API contracts, durable SQLite coordination, Git/GitHub transport and recovery, worker authority plumbing, and Control UI state. The implementation removes duplicate publication policy from workers and does not forward credentials.
Known proof gaps
node scripts/check-changed.mjspassed every branch-specific gate through apps lint, then the unrelated macOS packaging/tooling shard reproduced its known fixed-timeout stall with no output for 150 seconds and was interrupted. It was not weakened; exact-head CI/Testbox owns that remaining gate.