Repository navigation
fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics - #120359
Conversation
2a3bf92 to
ca9460f
Compare
|
Codex review: found issues before merge. Reviewed August 8, 2026, 2:43 AM ET / 06:43 UTC. ClawSweeper reviewWhat this changesThis PR centralizes environment parsing, missing-path classification, realpath fallback, and abortable sleep behavior across core callers. Merge readinessKeep open: the refactor still bypasses its new fs-safe policy boundary in exec-approval code, and it removes a distinct Doctor persistence regression. Likely related people: Josh Avant, who introduced the current shared path-safety foundation (medium confidence). Priority: P2 Review scores
Verification
How this fits togetherShared infrastructure helpers convert environment values, filesystem outcomes, paths, and abort signals into decisions used by agents, plugins, configuration, and gateway code. Those decisions then affect operator setup, command approval, retries, and runtime cleanup. flowchart LR
A[Environment and filesystem inputs] --> B[Shared infrastructure helpers]
B --> C[Agent and configuration flows]
B --> D[Plugin loading]
B --> E[Gateway and command approval]
C --> F[Operator-visible outcomes]
D --> F
E --> F
Before merge
Findings
Agent review detailsSecurityNeeds attention: Exec-approval path canonicalization now bypasses the source-owned fs-safe initialization boundary. PR surfaceSource -202, Tests +157, Generated 0, Other 0. Total -45 across 65 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Route both exec realpath calls through the boundary facade, retain the valid-config Doctor persistence regression, then rebase and obtain an exact-head review. Do we have a high-confidence way to reproduce the issue? Source-reproducible, but not executed in this read-only review: the direct imports bypass the source-owned initializer that configures fs-safe defaults before boundary use. Is this the best way to solve the issue? No: the intended canonical boundary is already present, so the two exec imports should use it and the unrelated Doctor write regression should remain covered. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ea50fe84538e. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What 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 (3 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
ba8e43b to
4a0e92e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1c9f3ce to
80169b0
Compare
80169b0 to
237f96f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…0807 * origin/main: fix(qa): honor Crabbox SSH fallback ports (openclaw#120539) refactor(core): adopt normalization-core leaf helpers across production (openclaw#120350) fix(release): scope upgrade plugin credentials (openclaw#120666) fix(ai): preserve long Responses sessions after server compaction (openclaw#120457) fix(test): keep fork E2E setup builds observable (openclaw#120653) fix(cloud-workers): retain provider operation ownership (openclaw#120661) docs: runners plan — one placement model for sessions, devices, and cloud (openclaw#120657) refactor(cli): inline state migration policy (openclaw#120641) feat(update): scheduled update campaigns with countdown, dev-channel auto-update, and Updates settings page (openclaw#120506) chore(i18n): refresh native locales (openclaw#120614) fix(ci): retry transient artifact API reads (openclaw#120654) fix(clawrouter): honor advertised reasoning efforts (openclaw#120631) fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics (openclaw#120359) fix(maintainers): parse merge comment URL structurally (openclaw#120649) fix(ui): label only operator-pinned runtimes in model picker rows (openclaw#120646) docs(agents): replace exact-head re-review gate with 12-hour review window # Conflicts: # src/agents/payload-redaction.ts
…leep semantics (openclaw#120359) * fix(infra): unify environment truthiness * fix(infra): unify missing path classification * refactor(infra): unify realpath fallbacks * fix(infra): unify abortable sleep errors * docs(infra): clarify path fallback semantics * fix(infra): route realpaths through policy wrapper * fix(infra): ratchet plugin SDK wildcard budget * fix(agents): preserve zero-delay abort precedence * fix(infra): preserve fallback and media recovery contracts * fix(plugins): share quarantine path resolution
What Problem This Solves
Fixes inconsistent classification semantics across environment flags, missing filesystem paths, realpath fallbacks, and abortable sleeps. Before this change, equivalent operator inputs and filesystem/runtime outcomes could be interpreted differently depending on the caller:
onenabled some flags but not telemetry or offline mode, missing ancestors were sometimes treated as hard failures, realpath fallbacks used several subtly different helpers, and cancelled sleeps did not consistently produce an abort-classified error.Why This Change Was Made
The affected decisions now flow through canonical owners: boolean parsing for opt-in environment flags, one errno/fs-safe missing-path classifier, fs-safe realpath helpers plus one named absolute fallback, and
@openclaw/retryfor abortable waits. Connected duplicate helpers were removed. Security and legacy-protocol exceptions remain local and documented where broader normalization would change their contract.Root cause: these classification rules had been independently reimplemented across agents, config, diagnostics, plugins, Gateway, and retry callers. Their truth tables and fallback/error identities drifted over time.
Architectural owners and canonical fixes:
src/infra/env.tsdelegates to the shared boolean parser.src/infra/errno.ts, re-exported throughsrc/infra/errors.ts, owns exactENOENT,ENOTDIR, and fs-safenot-foundclassification without requiringErroridentity.@openclaw/fs-safe/pathowns nullable realpath resolution;src/infra/boundary-path.tsowns canonical-or-absolute fallback.@openclaw/retryowns timer cleanup and abort error shape.Removed paths include per-caller env truth tables, 18 pure missing-path classifiers, 12 safe realpath wrappers, the provider-local sleeper, the ingress retry sleeper, and the agent sleep implementation.
Intentional behavior fixes
onwas false and surrounding whitespace was not normalized; after,1,on,true, andyesare accepted case-insensitively after trimming.onwas false and surrounding whitespace was not normalized; after, it uses the same canonical opt-in truth table.ENOTDIRor fs-safenot-foundas failures; after, 18 migrated classification sites consistently recognize those three exact codes as absent. Media directory recreation intentionally remains exact-ENOENT, because recursive mkdir cannot repairENOTDIRor generic fs-safe absence; nestedENOENTcauses remain recoverable.(path not found)text; after, the boundary producer preserves exactENOENT/ENOTDIRcodes.Errorvalues or the raw signal reason; after, they rejectAbortErrorwith messageabortedand preserve the signal reason ascause, soisAbortErrorrecognizes cancellation.Preserved exceptions:
0/falsedisables fallback, including empty or noncanonical text.src/plugins/bundled-dir.tsandsrc/gateway/hooks-mapping.tsretain native realpath canonicalization because their containment checks rely on native platform semantics.User Impact
Operators get predictable env flag handling and fewer false filesystem failures during cleanup, diagnostics, config mutation, skill discovery, and agent lifecycle operations. Cancellation now propagates through a stable abort shape, improving shutdown and retry behavior without keeping idle processes alive.
Plugin API surface counts are unchanged. The deprecated broad infra barrel was pinned to its pre-existing exports so the new internal missing-path helper does not become a plugin contract.
Scope and sibling coverage:
ENOENTrecovery. The research list named 18 current sites and omitted the verified Gateway classification site.Premise mismatches: several research paths had moved into their current owners, the missing-path list omitted the Gateway site, the realpath scan found the doctor-state sibling, and
scripts/committeris absent in this checkout, so exact-file conventional commits used the authorized no-verify fallback.Evidence
+182/-390(net-208)+78/-4+1/-270 passed,1 skipped) and boundary-path suite (5 passed).12/12clauses passed across three independent source-blind runs using the executable module-level harness.node scripts/check-changed.mjs: clean local fallback for core, core tests, extensions, extension tests, docs, tooling, and bundled-channel metadata lanes; typechecks, lint shards, guards, import-cycle check, and database-first checks passed.pnpm plugin-sdk:surface:check: clean; public surface counts unchanged.pnpm plugin-sdk:api:genplus API contract check: clean; only the intentional infra-runtime module hash changed after pinning explicit exports.git diff --check: clean.daaf7fc9849c76c029e6d1e9f78a005d059b7ade. Exact-head CI then exposed five direct fs-safe imports outside the policy wrapper;2a3bf9287e285b69963390d94a33aa35245ee3a0routes them throughsrc/infra/boundary-path.ts, with 111 focused tests and the import-boundary guard passing locally.blacksmithexecutable was absent. A routed Daytona fallback failed before command execution while writing sync manifests; leasecbx_9aa5d2f6e5b1was confirmed released. Per repository policy, trusted-source proof fell back locally and completed cleanly.31221913538: 61 jobs succeeded and all attributable product/boundary checks passed.security-fastremains red on the same nanoid 3.3.16 advisory that independently fails current main CI.checks-node-compact-small-1reported 81 Plugin SDK wildcard reexports twice, while fresh branch and exact merge-tree scans both pass at 80; its single allowed rerun reproduced the stale runner state. The aggregate CI gate is red only downstream of those two blockers.No live provider/channel claim is made: this change does not add an external API integration or modify a live channel protocol. The operator-visible contracts were exercised through focused owner/caller tests and the source-blind module harness.
{"errorName":"AbortError","isAbortError":true,"causePreserved":true,"followOnRan":false,"zeroNonAbortedResolved":true}. Independent source-blind validation passed all 6 contract clauses across three identical runs. The direct wrapper harness models the computer wait's follow-on screenshot boundary with an explicit sentinel; it does not claim a live full-computer-path execution.@openclaw/retryso pre-aborted signals win over its zero-duration fast path. That package has wider blast radius and its current contract (sleepWithAbort(0, abortedSignal)resolves) is explicitly unchanged here; this repair restores abort precedence only at the agent wrapper, using the same canonicalAbortErrorshape as positive-duration retry sleeps.src/plugin-sdk/channel-entry-contract.test.tspassed 14/14 andsrc/media/store.test.tspassed 52/52. The media matrix proves direct and nested-causeENOENTrecovery while standaloneENOTDIRand fs-safenot-foundsurface after one write attempt.{"truthTable":{"undefined":true,"enabled":false,"empty":false,"whitespace":false,"off":false,"no":false,"arbitrary":false,"zero":true,"false":true,"false-trimmed-case":true},"cacheSeparated":true,"mediaStructuralCode":"ENOTDIR"}.