Repository navigation
refactor(agents): remove redundant preparation and bookkeeping guards - #174632
Conversation
Trust canonical typed producers and existing effect owners instead of repeating snapshots, validation, and speculative historical interleaving checks. Preserve security admission, durable writes, FIFO and ordinary settlement. Optional mid-turn Decision setting changes are best effort; uncapped response read failures now propagate.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR removes repeated agent preparation, validation, copying, and lifecycle bookkeeping while retaining existing effect owners. Example: Decision assistance classifies a conversational turn, then the operator changes the selected Decision model before primary-model dispatch.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this maintainer-authored PR open: the four earlier findings are addressed in source, and no additional concrete defect was established. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherAgent preparation consumes configuration, plugin capabilities, credentials, and session facts; runtime owners then dispatch provider requests, deliver completions, and settle cancellation and persistence. flowchart TD
A[Configuration and session facts] --> B[Prepared agent runtime]
B --> C[Prompt and tool policy]
C --> D[Provider dispatch]
B --> E[Subagent registry]
E --> F[Cancellation and completion owners]
F --> G[Authorized effects and durable state]
Technical reviewBest possible solution: Keep the simpler producer-owned preparation while demonstrating that cancellation effects remain bound to current authorized run and session owners. Do we have a high-confidence way to reproduce the issue? This is a refactor rather than a single bug report; source inspection verifies the earlier repairs, but no target code was run during this review. Is this the best way to solve the issue? Consolidating work at typed producers and existing effect owners matches repository policy, and the maintainer has explicitly accepted the bounded behavior changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38314adc3a4d. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete privilege bypass was established; cancellation authority still requires final-effect evidence. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -544, Tests -775, Docs -2, Other -1. Total -1322 across 68 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (1 earlier review cycle)
Reviewed October 16, 2026, 6:27 PM ET / 22:27 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Exact reviewed head: CI run https://github.com/openclaw/openclaw/actions/runs/38974967458 completed successfully at this exact head. The full exact-head check-run enumeration contains no failing test/build/lint/type job. Required Canceled jobs are superseded bookkeeping, not uncovered suites. PR-context job117222072251/run38974963485 completed its actual context/evidence step successfully and is replaced by successful same-head job117222107137. ClawSweeper dispatch117222081937/run38974963734 completed its exact-review dispatch successfully; same-head dispatch117222107692 and review117222145942 succeed. No CI rerun or green-only push was requested. Initial-head failures were attributable to this PR, not inherited. The repair withdraws the Tool Search freezer change rather than casting around the type error, shrinks the two assertion baseline entries, preserves injected canonical registry receipt installation and legacy Stop selection, and updates only expectations for explicitly removed synthetic guards. Exact-head CI now proves those repairs broadly. The repair's independent P0–P2 review was scoped-clean before mechanical formatting. Targeted type-aware lint, formatting, and diff checks passed. Earlier unchanged Code Mode8/8 and web15/15 proof remain valid. Local worker-heavy replays were interrupted after prolonged preparation/import silence under shared load; they are not passing or failing product evidence. Local suppression audit had two passing content checks and one unchanged Git-list timeout; no timeout, skip, retry, or suppression was added. Net production removal:544 lines, +307/-851 across44 production files. The Phase E standalone memory backend and its factory/registry/expiry/federation/tests are untouched. Security effect authority, normal durability, FIFO, and ordinary shutdown settlement remain; accepted recoverable interleavings are named in the PR body. Campaign rule10 recovery: native PR1 initialization failed twice on shared origin/main compare-and-swap contention before any merge intent. Recorded operation groups stopped and emitted exact-OID locks were recovered through their owner. The coordinator-authorized exact-head guarded REST fallback bypasses this broken infrastructure, not the successful GitHub gates. No inherited-failure or prior-head-CI exception is claimed. |
…openclaw#174632) * refactor(agents): remove redundant preparation and bookkeeping guards Trust canonical typed producers and existing effect owners instead of repeating snapshots, validation, and speculative historical interleaving checks. Preserve security admission, durable writes, FIFO and ordinary settlement. Optional mid-turn Decision setting changes are best effort; uncapped response read failures now propagate. * fix(agents): preserve canonical registration and legacy stop semantics
Synchronize startup fixtures on actual entry and preserve stable module mock identities. Retire only the stale-WHAM historical-order expectation explicitly superseded by the accepted best-effort contract in #174632; retained recovery and current-credential security cases stay unchanged.
* refactor(auth): remove private external profile test resolver * refactor(gateway): bind startup leaf operations at their owners * refactor(gateway): call the real post-attach sidecar owner * refactor(doctor): remove constant migration environment supplier * refactor(plugin-sdk): narrow private transcript projection capability * refactor(sessions): call startup maintenance owners directly * refactor(tools): call native gateway owners directly * refactor(auth): remove the private refresh queue reset * refactor(agents): use the real payload logger environment and writer * refactor(cli): read cron input from the real stdin boundary * test: preserve fixture initialization while resolving lint diagnostics * test: align operation-owner fixtures with their module boundaries Synchronize startup fixtures on actual entry and preserve stable module mock identities. Retire only the stale-WHAM historical-order expectation explicitly superseded by the accepted best-effort contract in #174632; retained recovery and current-credential security cases stay unchanged. * chore: shrink obsolete core seam baselines * test: retain core fixtures while parking unproved runtime cuts
…75989) * refactor(auth): remove private external profile test resolver * refactor(gateway): bind startup leaf operations at their owners * refactor(gateway): call the real post-attach sidecar owner * refactor(doctor): remove constant migration environment supplier * refactor(plugin-sdk): narrow private transcript projection capability * refactor(sessions): call startup maintenance owners directly * refactor(tools): call native gateway owners directly * refactor(auth): remove the private refresh queue reset * refactor(agents): use the real payload logger environment and writer * refactor(cli): read cron input from the real stdin boundary * test: preserve fixture initialization while resolving lint diagnostics * test: align operation-owner fixtures with their module boundaries Synchronize startup fixtures on actual entry and preserve stable module mock identities. Retire only the stale-WHAM historical-order expectation explicitly superseded by the accepted best-effort contract in openclaw#174632; retained recovery and current-credential security cases stay unchanged. * chore: shrink obsolete core seam baselines * test: retain core fixtures while parking unproved runtime cuts
What Problem This Solves
Agent preparation, completion, and usage bookkeeping repeat work already owned by their producers: copying internal facts, decoding typed worker results again, and remembering speculative historical interleavings.
User Impact
This keeps security and approval effect checks, durable transcript/state writes, FIFO queues, shared immutable snapshots, and ordinary shutdown settlement. Optional Decision tool pruning now keeps its admitted result until the next evaluation rather than rebuilding the prompt when its model setting changes mid-turn; the documentation describes that best-effort behavior. Uncapped web response read failures now propagate instead of appearing as successful empty responses.
Why This Change Was Made
Use the existing registry build/resource owner instead of an overlapping media-source claim; carry typed worker and hook results to their consumers; let the actual transaction compare current credentials; and check current registry rows instead of maintaining registration/retirement observer collections. Remove private copies and validators only where the producer already owns the typed facts. Shared borrowed-fact freezing remains. The attempted Tool Search freezer consolidation was withdrawn entirely after CI exposed its incompatible generic assertion.
The larger attempted auth health-projection rewrite was withdrawn during review: credential ownership cannot establish whether child-local selection and health state override inherited facts. That complete owner cut is not part of this PR.
Best-effort tradeoffs accepted
Evidence
Net production reduction after CI repairs and formatting: 544 lines (+307/-851), excluding tests, test support, declarations, and documentation. No path overlaps the z04 exclusion inventory.
Initial-head Code Mode inbox proof passed 8/8. Runtime value and static import cycles: 0. Targeted type-aware lint passed on all initial changed TypeScript paths with one thread; formatting and
git diff --checkpassed. The web reader regression failed before the fix as intended (14 passed, one failed), then the fixed-head web suite passed 15/15. The initial lint-suppression gate passed 3/3. Both initial independent reviews completed; dispositions follow.Initial independent review prompted withdrawal of the credential-publication rewrite; the duplicate reload release finding was disproved by the unchanged outer
finally, while completion reread and quota-generation concerns are the explicit tradeoffs above. Final-source review raised four P2 findings: sandbox-name/workspace-content changes are accepted tradeoffs; the placement result is only an optionalopenclawharness preference (current-provider execution still acquires a fresh claim); and the alleged first-hook normalization bypass is disproved byrunModifyingHookmerging every handler, including the first. The existing canonical producer test starts with an empty first retry and retains later valid trimmed candidates. These are reviewed dispositions, not a scoped-clean verdict.Focused subscriber, prompt-policy, and final hook-producer attempts were interrupted after compiled-worker preparation consumed their useful local window without reaching selected tests on the saturated host. They are neither product failures nor passing evidence. Unrun worker/registry/runner siblings, core types, builds, and broad suites remain exact-head PR CI proof; no full local typecheck, broad suite, build, or E2E was run. The separately split shared worker-runtime typing family is not part of this PR.
CI run 38962172806 at initial head exposed attributable failures, not inherited reds: Tool Search TS2352 (whole hunk withdrawn), assertion-baseline shrink (updated), legacy exact-run Stop selection (one captured preexisting-owner baseline), and queued registration using an injected map (remove the redundant global-map reread after canonical receipt installation). Raw-entry and queued-registration tests remain unchanged. Sandbox exact-ID retirement, optional provider preference, and Decision accounting fixtures now exercise the intended producer/effect boundaries rather than removed guards. Fresh independent P0–P2 review of the complete repair delta is scoped-clean. Targeted type-aware lint passed all five repaired TypeScript paths; formatting-only corrections followed. The required suppression audit passed both suppression-content cases; its unchanged Git-listing case timed out at 147 seconds under shared-host load (two passed, one timed out; 394 seconds wrapper wall time). No suppressions were added and no timeout was raised. The seven-file focused repair replay completed worker preparation in 634 seconds, then reached no test case during more than ten minutes of quiet import/collection on the saturated host. Its task-owned worker was interrupted and the wrapper joined with exit 130; no passing or failing product case is claimed. Exact-head hosted CI must prove the repair.