Repository navigation
refactor(agents): consolidate reads and remove payload logging - #172992
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 changes before merge. What this changesThis PR consolidates agent read handling, simplifies passive caches and bookkeeping, and removes tool payload previews from logs. Example: An edit call supplies path="private-notes.txt" but omits required edits.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored PR provides useful runtime simplification and removes remaining tool-payload logging; one documentation correction remains. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe agent runtime prepares credentials, model metadata, filesystem tools, worktree suggestions, and subagent lifecycle operations, producing tool results and operational logs. flowchart TD
A[Agent request] --> B[Runtime preparation]
B --> C[Credential and model owners]
B --> D[Filesystem and worktree tools]
D --> E[Native structured results]
E --> F[Tool adapter]
F --> G[Model result]
F --> H[Operational logs]
Technical reviewBest possible solution: Retain the consolidated owners and payload omission, with the managed-worktree documentation updated to describe bounded suggestion freshness. Do we have a high-confidence way to reproduce the issue? Current-main source directly shows supplied tool parameters reaching failure logs; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Removing payload logging at its sink and carrying native read details through existing wrappers is simpler and more reliable than maintaining serializers and reconstructing already-owned results. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf90074c33e2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -546, Tests -76, Other 0. Total -622 across 53 files. Added test files: 0. View PR surface stats
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 Reviewed October 15, 2026, 5:44 AM ET / 09:44 UTC. |
242eed9 to
975d3dc
Compare
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. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3828e1b58f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Suggestions may lag repository changes until the next bounded refresh. | ||
| // Creation still validates the selected ref through Git before changing any checkout. |
There was a problem hiding this comment.
Update docs for bounded branch refresh
When a ref, HEAD, Git configuration, or object changes during the cache window, this code can now return the previous inventory for up to 30 seconds, but docs/concepts/managed-worktrees.md:361 and :741 still say metadata is checked on every request and changed metadata refreshes the inventory. Update those paragraphs in the same cutover so operators and UI consumers are not promised freshness the implementation no longer provides.
AGENTS.md reference: AGENTS.md:L50-L53
Useful? React with 👍 / 👎.
|
Inherited-only CI exception evidence for exact head All exact-head check runs were enumerated. The current CI attempt has one failed test job and its downstream aggregate:
Actual CI checkout Two cancelled advisory jobs are superseded, not called main-red: PR context job The earlier PR-caused closed-mock ratchet miss was repaired in the current signed head: two obsolete mocks and their exact inventory entries were deleted. The ratchet now passes, both focused files pass all 5 tests with cleanup joined, and incremental P0-P2 review is clean. Production remains the reviewed 546-line net reduction. Local lint-suppression inventory failure independently reproduces on pinned main; no allowlist was grown. Full main-test attempts stopped in sparse worker-build setup and are not represented as a completed main test replay. Proceeding under the standing inherited-only landing exception, subject to native live authority, review, security and policy verification. CI remains red; no CI rerun or green-seeking repush was used. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…law#172992) * refactor(agents): consolidate reads and remove payload logging * test(agents): remove obsolete lifecycle log mocks
Complete the consumer migrations from openclaw#172887, openclaw#172992, openclaw#172771 and openclaw#172989. Keep local schemas and callback types private and remove redundant barrel exports. Session sharing authority remains in its policy owner and is still enforced by production callers.
Related: #85049
What Problem This Solves
Agent runtime paths repeat already-owned work, maintain speculative cache-freshness machinery, and still write tool argument previews to logs despite the credential-exposure report in #85049.
User Impact
The affected tool-failure, malformed-read and elevated-exec log messages no longer include supplied payload previews or command text. Errors, operator hints, execution results, authorization, approvals and settlement remain intact. Display-only Git suggestions may lag external changes by up to their existing 30-second refresh window; actual worktree creation still validates the selected ref.
Why This Change Was Made
Keep one owner for auth-reader cleanup, synchronous/asynchronous local-update policy, and native read-result details. Carry the reader's existing discriminated result through wrappers instead of erasing and reconstructing it. Retain image resizing/omission diagnostics, line/cursor continuation, optional misses, input validation and model budgets.
Keep bounded performance caches but remove repeated model projection, recursive Git metadata fingerprints and display watchers. The standalone session-memory backend is untouched. No config, protocol, dependency, SQLite schema, durability, retention or permission change.
Net production delta: 383 added / 929 removed = 546 lines removed, including the new cleanup helper; tests, fixtures, test support, generated files and declarations excluded.
Best-effort tradeoffs accepted
a764b8f8cd3,399f5bc9935) is test-import/reload machinery; caches are now process-global. Explicit lifecycle refresh/reset and request-provided limits remain authoritative.99e8cf22a8econtains only those synthetic controls, with no associated human report. Numeric expiry comparison now owns freshness; positive-safe TTL checks and the 100-entry bound remain.Structural-only cuts retain the canonical public-boundary credential clones, cleanup/error classification and native read schemas; they accept no additional edge case. The read adapter predates the canonical producer (#110395 versus #126262/#140689), and only obsolete legacy-result fixtures are removed.
Evidence
Confirmed-conflict rebase
GitHub reported the original published head as conflicting. The branch was rebased only for that conflict, onto main
72422c4007bff81a5d0b55b56e8439d7f83892e3; current signed head is975d3dc40e113fb0201cc4b24d57fcb6773eac6c. The sole textual conflict was in the impossible-clock tests: main had already deleted one. Main's web-response consolidation, new same-source auth catalog path and Code Mode regressions were retained. Range-diff confirms every production hunk is unchanged, so the existing clean independent review is reused.Rebased-head proof passed: core production types, agents-tools test types, the SDK consumer type graph, runtime cycles 0, madge cycles 0, all 15 web-shared tests, formatting, and the canonical SDK export inventory check (no files changed). The rebased lint-suppression test failed only on untouched UI rows: the panel-hosted-tabs entry is stale and two cold-load helper files contribute three unlisted rule entries. Those UI files and the test are byte-identical to the pinned main base; this diff adds no suppression directives. A separate isolated replay of
node scripts/run-vitest.mjs test/scripts/lint-suppressions.test.tson mainea7a17310184df1c3d9de9534240375d280a2d53reproduced all four UI row differences (and an additional unrelatedextensions/oc-path/src/oc-path/emit.tssuppression mismatch): 1 failed, 2 passed. Two initial replay setup failures (missing UI dependency link and omitted sparse config directory) were corrected before this actual assertion reproduction. No allowlist growth or suppression was added to hide the failure.CI repair and baseline attribution
CI run
38715767016completed the planned jobs on head975d3dc40e113fb0201cc4b24d57fcb6773eac6c. Two non-aggregate jobs failed:checks-fast-baseline-ratchets(job116358804666) caught two modified closed-mock fingerprints, andchecks-node-changed-compact-small-19-1(job116358806391) failed the untouched auth reader assertion atsrc/agents/auth-profiles.sqlite-read-pool.test.ts:91. The aggregate gate failed downstream. All other planned jobs passed; intentionally unplanned jobs were skipped.Signed repair head
3828e1b58f69614297a1c4c318466d4b4772d20adeletes the two obsolete lifecycle-log mocks entirely and shrinks their exact inventory entries. Tests now use the real pure error-metadata helper; no assertion, timeout, skip, suppression, or production code changed. The mock ratchet passes (9,581 factories), formatting/diff checks pass, and independent P0-P2 review is scoped-clean. The two focused subagent files passed all 5 tests, including final settlement and worker cleanup. Production proof above is reused because this repair changes tests/inventory only. Required lint-suppression replay again reproduced the same UI-only mismatch (1 failed, 2 passed).The auth assertion passed in the local head replay (1 selected test). A direct probe reproducing the exact writer/schema registration, write, close, and capture sequence under CI's Node
24.19.0passes on the PR head but fails on pinned mainea7a17310184df1c3d9de9534240375d280a2d53, returning the same{ userVersion: 0, store: "table", state: "missing" }rather thanundefined. This establishes the main-only schema-close regression; the PR does not modify the admission/schema owners. The full main test replay did not reach assertions: missing workspace dependency views, then an omitted sparse workflow input stopped its worker build. Those setup failures are not counted as main reproduction or passing tests. Exact repair-head hosted CI remains the broad gate.Repair-head CI run
38719147562is complete. Its only non-aggregate failure is the same schema-close assertion in job116369913087; gate116375168829fails downstream. All other planned jobs, including baseline ratchets and independent security-fast, passed. Landing uses the authorized inherited-only CI exception, not a claim of green CI. Actual checkoutd85d0161ca13ce462765206c08334c6bfec8673ehas ordered parents mainef3de8bcd99f59dde41eb143cee7a1bc5a132b56and this PR head; its tree matches their derived merge. All ten recorded failure-input files match both the reproduced-main revision and the CI baseline, and are unchanged by the PR merge. Cancelled advisory jobs have successful replacement runs on the same head. No CI rerun or green-seeking push was made.Coverage log
Discovery started with the last three days of additions, then fourteen-day history, then largest owners, with independent second passes. Kept mechanisms were evaluated alongside removal candidates:
Prior-head local proof: core production types; agents-root, agents-other, agents-tools and agents-sessions test type graphs; scoped typed lint of all 52 candidate TypeScript files; formatting and diff-check; runtime value cycles 0 and madge cycles 0. The four initial root-graph errors were the same test helper annotated as read-only while wrapping write/edit tools; making that helper generic resolved them without changing fixtures, assertions or runtime code. Final combined independent P0-P2 review completed scoped-clean with no actionable findings. The focused runner passed unit-fast (2 files / 20 tests), lint-suppressions (1 file / 3 tests), and managed-worktree Gateway coverage (1 file / 7 tests). The later selected invocation recorded passing assembled-read, authority and worktree-settlement cases, then was interrupted (143) for the confirmed-conflict rebase before a final config verdict. These are partial results, not a full selected-suite pass; hosted CI remains the broad proof.
The actual tool-definition adapter negative control logs the synthetic payload on the unmodified base and fails the no-payload assertion; the candidate omits that payload and passes while preserving the same tool failure result. Elevated-command and malformed-read payload-omission regressions remain in the focused suite. No claim is made that arbitrary exception messages cannot contain third-party content.
The full frozen-revision Plugin SDK API comparison was interrupted (143) for the confirmed-conflict rebase and produced no verdict. Current-head SDK proof uses the canonical export inventory check plus the SDK consumer type graph; no full-surface comparison pass is claimed.
createReadToolretains its existing structured result type, andAnyAgentTooladds a defaulted details parameter; runtime result shapes, input schemas and exported names are unchanged.The staged changed-check ran for 31 minutes, then its owned process tree was stopped (143) after the whole-core SQLite analysis alone consumed 1,128.85 seconds without a verdict. Conflict markers and line-cap passed; its coupled environment count failed inherited as detailed below, and assertion safety correctly requested the shrink from 8 to 4. That exact inventory shrink is included and its canonical replay passed (2,695 files / 6,295 grandfathered assertions). Later checker stages are unrun, not passing; focused proof and exact-head PR CI remain the gates. No timeout, retry, skip, suppression or budget was relaxed.
All local runtime checks use task-owned HOME/OpenClaw/XDG paths. No remote lease or live Gateway/state access. Final test/type/inventory results and hosted head proof will replace these pending notes before landing.
The staged changed-check invocation found an inherited environment-name budget mismatch: clean base
9e3e16c224697b9a5cb24e7ede12ac4992a97a87has 455 names against 454. This diff adds no environment names. Upstream #172887 (9d5724ca724) already fixes it; fresh maina8a67b01e4ff9e03935baac8f029256c6dc7ad01counts 454/454 with the same canonical source-path filter. No budget was raised and no main update/rebase was requested merely to obtain local green.Component benchmarks on the saturated host (not production/Gateway latency or memory claims):
lstatcalls each; after 0.036/0.300/0.286 seconds and zerolstatcalls. RSS was 229,539,840 versus 229,818,368 bytes. Real native Git commands were used, but this does not measure Gateway/worker transport. An earlier unadmitted direct-reader run did not enable caching and is not used as comparison evidence.The existing managed-worktree documentation at
docs/concepts/managed-worktrees.md:361,741describes the former immediate-fingerprint behavior. Documentation is outside this lane's write scope; the coordinator follow-up is to describe bounded suggestion refresh without changing creation authority.