Repository navigation
refactor: own GitHub runtime state per command - #1898
Conversation
|
🦞👀 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 replaces the GitHub runtime factory with direct operations and command-scoped budgets, credential reservations, and retained ETag responses. Example: An asynchronous command resumes inside a 20,000 ms runtime budget.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: the command-state refactor is useful, the prior P2 is resolved, and inspection found no new actionable defect. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI wraps command dispatch in a GitHub data scope; runtime operations consume request arguments, credentials, and deadlines and return responses or typed failures through the existing transport. flowchart TD
A[CLI command] --> B[Command data scope]
B --> C[GitHub execution]
C --> D[Runtime operations]
B --> D
D --> E[GitHub transport]
D --> F[ETag broker]
E --> G[Response or typed error]
Technical reviewBest possible solution: Retain this focused command-state cutover and handle the dependent execution/context simplification separately. Do we have a high-confidence way to reproduce the issue? Main's synchronous try/finally budget wrapper loses the scoped budget after an async callback returns its promise; the supplied baseline output also shows both new isolation scenarios failing before this change. Is this the best way to solve the issue? AsyncLocalStorage holds only command data, removes the previous factory owner, and preserves existing request classification, transport, retries, and durable broker contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c2753fb49e25. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
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 HistoryReviewed October 10, 2026, 11:18 AM ET / 15:18 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
40f30d5 to
6f8ca66
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Summary
Row 3 slice 4a removes
createGitHubRuntimeanduntrustedCodexEnvForTest; the shipped CLI imports runtime operations directly. Budgets, credential inspection/fallback reservations, and retained ETag responses live in one command-lifetimewithGitHubRundata scope. Async continuations retain their own budget; nested budgets do not reset command caches. No collaborator registry or process-global response cache is introduced.The lead approved AsyncLocalStorage for data only rather than threading unrelated owner state through every existing read. Execution/context factories remain for the dependent slice: #1905. All current runtime-factory callers migrate, including executable-gh tests and frozen proof drivers. Historical factory adapters exist only in explicit old-source proof paths.
Current head:
6f8ca6631af750e9fbac3c7b2f9782778743e510, rebased onorigin/mainc2753fb49e2542716365a167b055aac6709f9040, including the typed review-record reader migration. This revision changes only the hydration proof driver after the rebase.Hosted finding disposition
The P2 is fixed at the observed boundary. The proof now catches the result of
ghJson/ghWithRetry, which normalizes an expired request toGitHubOperationDeadlineError, not the raw subprocessETIMEDOUT. Its recorder storesnameanddeadlineAt, and the assertion compares the exact deadline admitted for that metadata request. It does not manufacture a subprocess error code.Cancellation remains independently required: one bounded child, no metadata response or completed delay, observed
SIGTERM, a matching child exit, no surviving exact PID/start-time identity, no fetches, and all originally missing blobs still missing. No assertion was skipped or weakened.Fresh local review also identified that archived source roots still export the removed factory. The driver now adapts only those old source roots with their historical factory; current code still uses plain imports. Both historical baseline and current candidate modes were exercised successfully (pueue 1644). Exact-head Linux cancellation proof and
codex review --base origin/mainpassed in 1646, with no actionable findings.Base-failure evidence for the new isolation tests
Built unchanged
maincode atc2753fb49e2542716365a167b055aac6709f9040and ran the two new tests' unchanged bodies against it (pueue 1638). Only test imports were mechanically redirected through a historical API adapter: one realcreateGitHubRuntimeinstance usesrunText/runTextConcurrently; the new scope call maps to main's unscoped command entry. No production code, assertions, transport, or result classification was replaced.Command:
node --test --test-name-pattern='run state and runtime budgets stay isolated|runtime ETags revalidate through gh and keep retained bodies scoped to one run' test/apply-runtime-budget.test.1898.ts test/github-etag-read-broker.test.1898.tsObserved baseline output:
The same two tests pass on this branch within the 266/266 focused run (pueue 1637). This is behavior failure on main, not a missing-export or import-error demonstration. Reproduction files are retained in
/tmp/clawsweeper-1898-main/test/*1898.tsanddist/runtime-isolation-adapter.js; the command and complete output are in the pueue receipt.Shipped-CLI before/after proof
Claim: command scoping preserves repository routing, JSON responses, transient and malformed-JSON retries, and terminal throttling. Surface: actual
node dist/clawsweeper.js reserve-review-leasechildren against executable gh fixtures, with isolated environment and request logs. Baseline is the main SHA above; candidate is the rebased branch's identical production source (the final follow-up changes only the proof driver). Pueue 1642 passed all 8/8 comparisons. The first replay used macOS's noncanonical/tmppath and did not enter the CLI; the successful replay uses/private/tmpand observes all requests.Inline comparison output, derived from both arms' retained JSON/stdout/request traces:
[ { "scenario": "closed", "repo": "openclaw/openclaw", "before": { "exit": 0, "requests": 1, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 1, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "closed", "repo": "openclaw/clawhub", "before": { "exit": 0, "requests": 1, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 1, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "transient", "repo": "openclaw/openclaw", "before": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "transient", "repo": "openclaw/clawhub", "before": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "malformed", "repo": "openclaw/openclaw", "before": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "malformed", "repo": "openclaw/clawhub", "before": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "after": { "exit": 0, "requests": 2, "stdout": "{\"status\":\"superseded\",\"reason\":\"item_not_open\",\"state\":\"closed\"}", "errorClass": null }, "requestTraceIdentical": true }, { "scenario": "throttle", "repo": "openclaw/openclaw", "before": { "exit": 1, "requests": 1, "stdout": "", "errorClass": "GitHubRateLimitError" }, "after": { "exit": 1, "requests": 1, "stdout": "", "errorClass": "GitHubRateLimitError" }, "requestTraceIdentical": true }, { "scenario": "throttle", "repo": "openclaw/clawhub", "before": { "exit": 1, "requests": 1, "stdout": "", "errorClass": "GitHubRateLimitError" }, "after": { "exit": 1, "requests": 1, "stdout": "", "errorClass": "GitHubRateLimitError" }, "requestTraceIdentical": true } ]Every trace uses only the synthetic
row3-fixture-not-a-secretcredential andapi repos/<target>/issues/42, including the repeated retry attempts. Artifacts and executable driver:~/Developer/.agents/handoffs/clawsweeper-row3/slice4a-revision-proof-replay/andgithub-cli-revision-proof.mjs.Validation and limits
build:all, 266/266 focused tests (including hydration, deadline, ETag, credential, egress, circuit, apply budget, action-ledger, close-reasons, and batch-workflow files), lint, andformat:check: pueue 1637 passed.codex review --base origin/main: the historical-driver finding from 1637 was fixed; fresh review 1644 and exact committed-head review 1646 found no actionable defects.node:24.21.0-bookworm, network disabled: old hydration baseline at16505cfand current candidate passed in 1644; exact current head passed again in 1646. Receipts:hydration-1898-history-baseline/,hydration-1898-history-candidate/,hydration-1898-head/under the same handoff directory.No merge or deployment is requested.