Repository navigation
feat(github): expose observational publication readiness - #187152
Conversation
OpenClaw-Publication: b09aa616-cedd-4ca3-992f-0851db275b29
|
🦞👀 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 maintainer review before merge. What this changesThis PR adds a read-only GitHub publication-readiness action reporting session custody, target support, shared receipts, and remedies. Example: Caller A requests readiness for its persisted child session C.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored feature provides useful publication observation, and the prior actionable findings are resolved. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe agent tool calls a registered Gateway method that checks current session access, reads existing session and publication state through workers, and returns a bounded observation. flowchart TD
A[Agent publication tool] --> B[Gateway readiness method]
B --> C[Current access and lineage checks]
C --> D[Session and workspace readers]
C --> E[Shared receipt reader]
D --> F[Readiness response]
E --> F
Technical reviewBest possible solution: Retain one shared target qualifier and the existing authority owners while exposing readiness through existing-only readers. Do we have a high-confidence way to reproduce the issue? This is an additive feature: inspected main exposes options/status but lacks the readiness action; no target code was executed during this read-only review. Is this the best way to solve the issue? The implementation preserves existing publication ownership and separates observation from credential discovery and effects; the worker changes support artifact-preserving reads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 90a5029e4278. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1424, Tests +1417, Docs +25, Other 0. Total +2866 across 68 files. Added test files: 4. View PR surface stats
Review metrics
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 (3 earlier review cycles)
Reviewed October 29, 2026, 1:31 PM ET / 17:31 UTC (Revision 4). |
OpenClaw-Publication: 4aeaf6ce-789d-48a7-bc21-53088e2ff7a4
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
OpenClaw-Publication: 912befb3-3e3b-47f4-ab5a-5d7f9d28f333
OpenClaw-Publication: 73f640e8-910a-4177-ba41-4dd3e10ef7ef
OpenClaw-Publication: 5fbeadc2-e8ae-40e9-8257-06efe69cb913
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
#188025) ## What Problem This Solves Since `sessions.github.readiness` shipped (e242709), every readiness read on a busy Gateway froze the whole Gateway for minutes. The agent `github_publish` tool calls readiness. The Gateway ran that request inside `withArtifactPreservingStateReads({ agentDatabases: true })`. That scope exists for offline Doctor inspection: it turns every agent-database read into a private whole-file copy. With a live 35 GB agent database, each readiness call: - copied the full database (about 9 minutes at about 1.6 GB/s; disk queue saturated); - held up writers. Session patches waited 400–600 s, session creates about 480 s, and simple reads (`users.prefs.get`, `board.get`) hit their 30 s timeouts; - left the copy behind. About 30 copies (about 640 GB) built up in the snapshot cache in 4 hours. Production trace on the team Gateway: each `github_publish` failure line has a matching 34 GB snapshot directory with the same timestamp, to the second (for example 21:18:22, 22:08:35, 22:16:07, 22:27:52). At each of those instants every stalled `board.get` completed at once. The copies started at the first readiness call after the build containing e242709 went live. Before that, only occasional state-database snapshots existed. ## Why This Change Was Made The Gateway owns its live databases. A Gateway request reads them through that owner, as `sessions.github.options` and `status` already do. Private copies are for outside, offline readers. - `sessions.github.readiness` dispatch keeps the shared observation scope. That scope gives the existing guarantee that readiness never starts a login refresh, and a test covers it. The `agentDatabases: true` option is removed. - The duplicate scope inside `readGitHubPublicationReadiness` is removed; dispatch already provides it. - `qualifyGitHubPublicationSource` keeps the source-retirement watch: a registry witness plus the native retirement signal for the selected agent database. It now applies to every observational (artifact-preserving) read rather than only to copied readers. The watch copies nothing. If the source is closed, unregistered or replaced while readiness is pending, the request is refused before any response, so a replacement database cannot leave an obsolete visibility decision in place. So that this does not happen again: - A boundary test fails if any production file under `src/gateway/` requests `agentDatabases: true`. - `withArtifactPreservingStateReads` documents that the option is for offline inspection only. - `src/gateway/AGENTS.md` states the rule for Gateway code. The old scope did two jobs: it checked session-store paths in discovery workers, and it copied agent databases. This change keeps the first and drops the second: - In session discovery (`session-utils-store-worker.ts`, `session-sharing-preparation.ts`, `session-entry-read-runtime.ts`, `session-store-read-candidates.ts`), any artifact-preserving read now checks paths in a worker. Readiness keeps that scope. - Only the Doctor-only `agentDatabases` scope adds `preserveSourceArtifacts` or reads a private copy. - Discovery workers no longer force `preserveSourceArtifacts` on every prepared inventory. Callers add it under that scope. Doctor and update inspection keep the copy scope, with unchanged results. @fuller-stack-dev this changes one readiness guarantee from #187152. Readiness no longer promises byte-identical `-wal`/`-shm` sidecars for a cold agent database. SQLite creates those files when the owner opens the database for a normal read. Stored database bytes stay unchanged, and readiness now creates no snapshot copies; both are still tested. The alternative is a whole-database copy on every call, which stalls a production Gateway. ## User Impact On Gateways with large agent databases, agents calling `github_publish` no longer freeze chat, session updates and the Control UI for minutes, and no longer fill the disk with snapshot copies. ## Evidence - **Regression, red then green.** In `src/gateway/server-methods/sessions-github-readiness.test.ts`, the configured-locator test drives real readiness reads through the registered Gateway method and instruments native SQLite opens in the read workers. It previously asserted "readiness must open private images, not the source". It now asserts that readiness reads the source through its owner. - Against `main`'s production code: 3/3 variants **fail** (`expected 0 to be greater than 0`). - With this change: **pass**. - **Path checks stay off the Gateway thread, red then green.** The same configured-locator test now spies on Gateway-thread session-store path checks (`prepareSessionStoreTargetInventory`, `captureSessionStoreReadCandidates`, `captureSessionStoreReadCandidate`) during cold and warm readiness reads. - Without the split above, it fails with `[4, 4, 16]` calls. - With it: zero. - Remaining Gateway-thread `stat`/`realpath` calls on the source are the per-read admission identity checks that every live Gateway session read makes (`sessions.github.options`, chat). Avoiding those would require reading a private copy, which is the bug. - **Guard, red then green.** `src/state/artifact-preserving-state-reads.boundary.test.ts`: - with `main`'s `server-methods.ts`: fails, naming `server-methods.ts`; - now: passes (3 s wall). - **Custody tests:** - "Preserves cold DB…" and "keeps an absent shared database absent" now compare the stored database files and the count of private snapshot copies; both pass. - The login-refresh, connection, profile, grant, session, visibility and session-metadata post-await checks are unchanged and pass. - The `source`, `registry-remove`, `published-replacement` and `registry-same` post-await cases are kept and run against live reads; each now also asserts zero agent snapshot copies. Without the source-retirement watch, the first three fail (the request is not refused); with it they pass. - **Suites:** - `pnpm test src/gateway/server-methods/sessions-github-readiness.test.ts --maxWorkers=1`: 33 passed, 55 s wall. - Related publication, session-access, availability, store-lookup and `github_publish` tool suites: 193 passed. - Session discovery, entry-read, sharing, store-worker and Doctor lint/database-inspection suites: 342 passed across 35 files. - `pnpm check:changed` passes typecheck, lint and guards. The wrapper-shadowing check fails on `src/agents/skill-workshop-prompt.ts` / `src/plugin-sdk/agent-harness-runtime.ts`. This PR does not touch those files, and the failure is already on `main` (from #187661). No overlap with Pash/Sarah changes. **Merge danger:** two-way door. No schema, config or stored-state change; a revert restores the copy scope. **Blast radius:** only `sessions.github.readiness` (the `github_publish` readiness action). If this change were wrong, readiness would report from the live database, as `options` and `status` already do. **Follow-up:** with no Gateway caller left, the `preserveSourceArtifacts` plumbing that e242709 added to session discovery (`session-store-target-inventory.ts` and related readers) runs only under Doctor scopes. It can be reviewed for removal separately. Co-authored-by: Ayaan Zaidi <[email protected]>
openclaw#188025) ## What Problem This Solves Since `sessions.github.readiness` shipped (f345b6d), every readiness read on a busy Gateway froze the whole Gateway for minutes. The agent `github_publish` tool calls readiness. The Gateway ran that request inside `withArtifactPreservingStateReads({ agentDatabases: true })`. That scope exists for offline Doctor inspection: it turns every agent-database read into a private whole-file copy. With a live 35 GB agent database, each readiness call: - copied the full database (about 9 minutes at about 1.6 GB/s; disk queue saturated); - held up writers. Session patches waited 400–600 s, session creates about 480 s, and simple reads (`users.prefs.get`, `board.get`) hit their 30 s timeouts; - left the copy behind. About 30 copies (about 640 GB) built up in the snapshot cache in 4 hours. Production trace on the team Gateway: each `github_publish` failure line has a matching 34 GB snapshot directory with the same timestamp, to the second (for example 21:18:22, 22:08:35, 22:16:07, 22:27:52). At each of those instants every stalled `board.get` completed at once. The copies started at the first readiness call after the build containing f345b6d went live. Before that, only occasional state-database snapshots existed. ## Why This Change Was Made The Gateway owns its live databases. A Gateway request reads them through that owner, as `sessions.github.options` and `status` already do. Private copies are for outside, offline readers. - `sessions.github.readiness` dispatch keeps the shared observation scope. That scope gives the existing guarantee that readiness never starts a login refresh, and a test covers it. The `agentDatabases: true` option is removed. - The duplicate scope inside `readGitHubPublicationReadiness` is removed; dispatch already provides it. - `qualifyGitHubPublicationSource` keeps the source-retirement watch: a registry witness plus the native retirement signal for the selected agent database. It now applies to every observational (artifact-preserving) read rather than only to copied readers. The watch copies nothing. If the source is closed, unregistered or replaced while readiness is pending, the request is refused before any response, so a replacement database cannot leave an obsolete visibility decision in place. So that this does not happen again: - A boundary test fails if any production file under `src/gateway/` requests `agentDatabases: true`. - `withArtifactPreservingStateReads` documents that the option is for offline inspection only. - `src/gateway/AGENTS.md` states the rule for Gateway code. The old scope did two jobs: it checked session-store paths in discovery workers, and it copied agent databases. This change keeps the first and drops the second: - In session discovery (`session-utils-store-worker.ts`, `session-sharing-preparation.ts`, `session-entry-read-runtime.ts`, `session-store-read-candidates.ts`), any artifact-preserving read now checks paths in a worker. Readiness keeps that scope. - Only the Doctor-only `agentDatabases` scope adds `preserveSourceArtifacts` or reads a private copy. - Discovery workers no longer force `preserveSourceArtifacts` on every prepared inventory. Callers add it under that scope. Doctor and update inspection keep the copy scope, with unchanged results. @fuller-stack-dev this changes one readiness guarantee from openclaw#187152. Readiness no longer promises byte-identical `-wal`/`-shm` sidecars for a cold agent database. SQLite creates those files when the owner opens the database for a normal read. Stored database bytes stay unchanged, and readiness now creates no snapshot copies; both are still tested. The alternative is a whole-database copy on every call, which stalls a production Gateway. ## User Impact On Gateways with large agent databases, agents calling `github_publish` no longer freeze chat, session updates and the Control UI for minutes, and no longer fill the disk with snapshot copies. ## Evidence - **Regression, red then green.** In `src/gateway/server-methods/sessions-github-readiness.test.ts`, the configured-locator test drives real readiness reads through the registered Gateway method and instruments native SQLite opens in the read workers. It previously asserted "readiness must open private images, not the source". It now asserts that readiness reads the source through its owner. - Against `main`'s production code: 3/3 variants **fail** (`expected 0 to be greater than 0`). - With this change: **pass**. - **Path checks stay off the Gateway thread, red then green.** The same configured-locator test now spies on Gateway-thread session-store path checks (`prepareSessionStoreTargetInventory`, `captureSessionStoreReadCandidates`, `captureSessionStoreReadCandidate`) during cold and warm readiness reads. - Without the split above, it fails with `[4, 4, 16]` calls. - With it: zero. - Remaining Gateway-thread `stat`/`realpath` calls on the source are the per-read admission identity checks that every live Gateway session read makes (`sessions.github.options`, chat). Avoiding those would require reading a private copy, which is the bug. - **Guard, red then green.** `src/state/artifact-preserving-state-reads.boundary.test.ts`: - with `main`'s `server-methods.ts`: fails, naming `server-methods.ts`; - now: passes (3 s wall). - **Custody tests:** - "Preserves cold DB…" and "keeps an absent shared database absent" now compare the stored database files and the count of private snapshot copies; both pass. - The login-refresh, connection, profile, grant, session, visibility and session-metadata post-await checks are unchanged and pass. - The `source`, `registry-remove`, `published-replacement` and `registry-same` post-await cases are kept and run against live reads; each now also asserts zero agent snapshot copies. Without the source-retirement watch, the first three fail (the request is not refused); with it they pass. - **Suites:** - `pnpm test src/gateway/server-methods/sessions-github-readiness.test.ts --maxWorkers=1`: 33 passed, 55 s wall. - Related publication, session-access, availability, store-lookup and `github_publish` tool suites: 193 passed. - Session discovery, entry-read, sharing, store-worker and Doctor lint/database-inspection suites: 342 passed across 35 files. - `pnpm check:changed` passes typecheck, lint and guards. The wrapper-shadowing check fails on `src/agents/skill-workshop-prompt.ts` / `src/plugin-sdk/agent-harness-runtime.ts`. This PR does not touch those files, and the failure is already on `main` (from openclaw#187661). No overlap with Pash/Sarah changes. **Merge danger:** two-way door. No schema, config or stored-state change; a revert restores the copy scope. **Blast radius:** only `sessions.github.readiness` (the `github_publish` readiness action). If this change were wrong, readiness would report from the live database, as `options` and `status` already do. **Follow-up:** with no Gateway caller left, the `preserveSourceArtifacts` plumbing that f345b6d added to session discovery (`session-store-target-inventory.ts` and related readers) runs only under Doctor scopes. It can be reviewed for removal separately. Co-authored-by: Ayaan Zaidi <[email protected]>
Summary
Verification
All runtime evidence below ran on source
3a731751(tree1a514e06, integrated with main at50bb9ed9). The PR head7af9f26fis the publication commit for that source, with the identical tree. The aliases A, B and C are synthetic fixture sessions. Proof record SHA-256:63788dbd22fa62763ab3ce37b2be3fa1741ca067c262dadc23ba23cba634a1ba.Changes since the first published revision
PublicationSessionIdentitytype import to the neutral leaf file.scripts/perf/github-options-measure-preload.tsnow tracks the renamedqualifyGitHubPublicationSourceexport (+1/−1). Before the fix the preloader failed on the missing old name; after it, the hook resolves all of its owners and boundaries. This is not a performance measurement.Session access through
github_publishand the registeredsessions.github.readinessmethodCaller A reads its own session, its persisted child C, and an unrelated session B (public-safe excerpt):
{"caller":"A","selected":"A","toolReturns":1,"toolThrows":0,"rpcResponseCount":1,"rpc":[{"ok":true,"payloadPresent":true,"receiptPresent":false}],"facets":{"policy":{"read":"admitted","write":"unknown"},"custody":{"kind":"unbound_workspace"},"target":{"kind":"unknown","reason":"not-qualified"},"request":{"kind":"none","selection":"current"},"remedies":[{"kind":"select_bound_session"}]},"foreignReads":0} {"caller":"A","selected":"C","toolReturns":1,"toolThrows":0,"rpcResponseCount":1,"rpc":[{"ok":true,"payloadPresent":true,"receiptPresent":false}],"facets":{"policy":{"read":"admitted","write":"unknown"},"custody":{"kind":"unbound_workspace"},"target":{"kind":"unknown","reason":"not-qualified"},"request":{"kind":"none","selection":"current"},"remedies":[{"kind":"select_bound_session"}]},"foreignReads":0} {"caller":"A","selected":"B","toolReturns":0,"toolThrows":1,"error":"The publishing session is not a child of this conversation.","rpcResponseCount":1,"rpc":[{"ok":false,"payloadPresent":false,"errorCode":"FORBIDDEN","receiptPresent":false}],"facets":null,"sharedPoolTasks":0,"latestReceiptCalls":0,"exactReceiptCalls":0,"foreignReads":0}Session B's stored receipt sentinel was present and was never read.
Revocation after a completed read
A human reader with
operator.sessions.readcompleted one shared read. Their access to the session was then changed from view to none through the supported sessions update, and their next readiness request was refused. The scopes and the connection were unchanged. Public-safe excerpt; the session key is omitted:{"case":"human-view-to-none","surface":"handleGatewayRequest -> registered sessions.github.readiness","readCompletedBeforeMutation":true,"roleBefore":"view","roleAfter":"none","scopes":["operator.sessions.read"],"connectedThroughout":true,"responseCount":1,"ok":false,"error":{"code":"FORBIDDEN","message":"GitHub publication session access changed; select the session again."},"payloadPresent":false,"receiptPresent":false,"returns":1,"throws":0,"sharedObservationTasks":1}That run exited 0 (1 test passed, 7.4 s; 137 s total). All ten fail-if-called effect guards recorded zero calls. The human agent database, the shared database and their WAL and journal files were unchanged; shared-memory lock bytes are excluded from that comparison.
Review and local checks
Limitations
No live deployment, OAuth refresh, account selection or publication is performed by the readiness action.