Skip to content

refactor(agents): remove routine trace bookkeeping - #174836

Merged
steipete merged 2 commits into
mainfrom
deslop/r02-2-agent-traces-20261015
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/r02-2-agent-traces-20261015

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agent turns repeatedly build routine trace projections, and ordinary error logs still retain arbitrary provider or media content already available through the intended result channels.

User Impact

Client-visible masked errors, fallback details, lifecycle events, operator warnings and turn behavior remain. Ordinary logs retain classifications, correlation hashes and IDs rather than message/error/path previews. Unread local-service stdout is drained without retaining a diagnostic copy; bounded stderr remains available.

Why This Change Was Made

Recover the agents area of withdrawn runtime/core cleanup (#174363 and #174383) without replaying their unrelated Gateway, channel or reply changes. Remove debug-only observer parameters, maintenance sequence fields, trace formatting and unused stdout retention together. Privacy changes preserve the actual result/error channels and structured diagnostic event consumers.

Best-effort tradeoffs accepted

  • Routine successful auth, tool-start, run/waiter and maintenance trace records disappear; their runtime decisions and visible failures remain unchanged.
  • Local-service stdout had no diagnostic reader; it is now drained directly. Startup errors retain bounded stderr and normal exit/readiness information.
  • Ordinary failure logs omit arbitrary provider error previews and media paths. Client-visible masked failures and returned fallback detail remain; no authorization or sandbox guard is removed.

Evidence

  • 44 files; 349 net production lines removed (+60/-409), excluding tests/support/generated/declarations.
  • Independent isolated review: scoped-clean P0-P2; final source verification completed, no accepted/actionable findings.
  • One-thread formatting: 44/44 pass (1.039s); whitespace checks pass; no added lint suppressions. Critical owner/caller and retired-reference checks completed.
  • Isolated one-worker suppression inventory passed 3/3 on the prepared primary checkout; the agents diff adds no suppression directives. Agent runtime suites are deferred to exact-head CI under the shared-host budget after a Gateway owner preparation exhausted the local budget without assertions. No local agent runtime/type pass is claimed.
  • Broad local builds/graph typechecks are prohibited under the shared-host budget. Exact-head CI supplies broad runtime/types/architecture proof before landing.

CI attribution

Initial exact head a9eb05b completed its applicable runtime, type, build, architecture and security jobs successfully. The sole failing leaf was checks-fast-baseline-ratchets (run 38982414981, job 117246585933): assertion-safety required the tools-start allowance to shrink from 5 to the remaining 2 assertions. This is caused by this cleanup, not inherited. The repair changes that row only; its fresh isolated review completed scoped-clean. Aggregate CI failures derive from that leaf. No CI rerun or unchanged-head push is requested.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 23:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T23:40:13.942429Z a9eb05b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: f15283cf6ce9608278c0358925fc487b174b5bc7
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/effective-oauth.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/external-cli-sync.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/oauth-manager.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/embedded-agent-runner/run/auth-controller.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/embedded-agent-runner/run/auth-plan.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/embedded-agent-runner/run/auth-profile-success.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR removes routine agent trace bookkeeping and excludes provider-error previews and media paths from ordinary logs.

Example: A provider returns HTTP 401 with an HTML error body.

  • Before: Ordinary structured failure logs include a masked HTML preview.
  • After: Logs retain classification and correlation hashes while client error events retain their existing masked details.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, owner-approved cleanup with preserved runtime contracts, but a deterministic baseline failure and stale documentation remain.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is outside the ordinary contributor proof gate; supplied evidence covers source review and static checks, without a changed-path runtime demonstration.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Routine diagnostics duplicate runtime facts and retain arbitrary provider-error or media-path content in ordinary logs.
Reason: The maintainer explicitly accepted the narrower diagnostic output, and the diff removes observer work while retaining operational decisions and client result channels.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored cleanup open; the direction is accepted, but the assertion baseline needs shrinking and the fallback documentation needs updating.

Priority: P3
Reviewed head: a9eb05b6e89f22ad091c05e02e1968beda6294e1

Before merge

  • Shrink the tool-start assertion allowance to two (P2) - Removing traceToolExecutionStart deletes three counted type assertions, leaving two, but this baseline entry remains five. The ratchet explicitly fails whenever current counts are below their recorded allowance, so this cleanup deterministically breaks check:assertion-safety; exact-head CI reports that check failing. Reduce this entry from 5 to 2 without restoring the retired tracer or changing unrelated allowances.
  • Update the documented fallback log fields (P3) - The explicit projection removes fallbackStepFromFailureDetail from ordinary logs, but the existing model-failover guide still promises that field in structured model_fallback_decision records. Operators following that contract will search for details that are intentionally absent. Update the guide to distinguish retained log classifications from details available in returned fallback results.

Findings

  • [P2] Shrink the tool-start assertion allowance to two — config/assertion-safety-baseline.txt:1248
  • [P3] Update the documented fallback log fields — src/agents/model-fallback-observation.ts:249-255

Tests

  • Missing end-to-end proof: The changed privacy assertions have no supplied base-failure/head-pass execution evidence, although ordinary contributor proof is exempt for this maintainer-authored PR.
Agent review details

How this fits together

The agent runtime prepares credentials, executes tools and model requests, and settles turns; these changes reduce diagnostic projections beside those operations while preserving their results and lifecycle events.

flowchart LR
  A[Agent turn] --> B[Auth and harness preparation]
  B --> C[Model and tool execution]
  C --> D[Turn settlement]
  C --> E[Diagnostic classification]
  E --> F[Ordinary logs]
  D --> G[Client results and lifecycle events]
Loading

Technical review

Best possible solution:

Keep the accepted logging cleanup, shrink its assertion allowance, and document which fallback details remain available through returned results.

Do we have a high-confidence way to reproduce the issue?

Source inspection establishes the stale assertion allowance and its deterministic failure branch, consistent with exact-head CI annotations; no target code or tests were executed.

Is this the best way to solve the issue?

Removing observer-only work at its producers is appropriate, and the inspected result, masking, lifecycle, readiness, and authority paths remain intact.

Full review comments:

  • [P2] Shrink the tool-start assertion allowance to two — config/assertion-safety-baseline.txt:1248
    Removing traceToolExecutionStart deletes three counted type assertions, leaving two, but this baseline entry remains five. The ratchet explicitly fails whenever current counts are below their recorded allowance, so this cleanup deterministically breaks check:assertion-safety; exact-head CI reports that check failing. Reduce this entry from 5 to 2 without restoring the retired tracer or changing unrelated allowances.
    Confidence: 1
  • [P3] Update the documented fallback log fields — src/agents/model-fallback-observation.ts:249-255
    The explicit projection removes fallbackStepFromFailureDetail from ordinary logs, but the existing model-failover guide still promises that field in structured model_fallback_decision records. Operators following that contract will search for details that are intentionally absent. Update the guide to distinguish retained log classifications from details available in returned fallback results.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1956ba00b72b.

Provenance checked

  • Embedded and fallback error observations changes intended behavior with a stated reason (87d939b: The original observation work added non-throwing, correlated preview/hash/fingerprint diagnostics; Agents: add embedded error observations #41336 and Agents: add fallback error observations #41337 describe that intent.)
  • Extra-parameter debug preparation changes intended behavior with a stated reason (e0e9935: perf(agents): skip disabled debug preparation #150361 avoided diagnostic preparation when debugging was disabled while preserving enabled-sink output; this PR explicitly retires that output.)
  • Harness selection logging changes intended behavior with a stated reason (137dbc7: [codex] Expose agent harness selection decisions #70760 exposed selection reasons for routing diagnosis without changing routing; this PR removes only the routine log projection.)
  • Maintenance bookkeeping and auth timing keeps the original intent (60adac1: Maintenance history established foreground priority and real writer settlement; auth timing moved with ca9bbf6. The PR removes trace-only fields and callbacks while retaining those owners.)
  • Local-service output retention keeps the original intent (4228ae9: Local-service history added lease management and later stopped retaining runtime output; the current failure formatter consumes stderr only, so draining stdout preserves its diagnostic contract.)
  • Commentary diagnostics keeps the original intent (904f9c0: Completed commentary tracing introduced structured diagnostic events; the PR preserves content-capture policy and event emission while removing the duplicate debug record.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:assertion-safety
  • pnpm docs:check-mdx
  • pnpm docs:check-links
  • git diff --check

What I checked:

  • Pinned scope and accepted tradeoffs: Read the introduced merge-base-to-head diff and the live PR body and comments. The maintainer explicitly accepts removal of routine traces, unused stdout retention, and arbitrary failure previews; no authorization guard is removed. (a9eb05b6e89f)
  • Deterministic assertion-baseline failure: Deleting traceToolExecutionStart removes three counted assertions. Two non-const assertions remain, but the baseline still records five; shrink-ratchet.mts explicitly returns failure for unused allowances. (config/assertion-safety-baseline.txt:1248, a9eb05b6e89f)
  • Exact-head CI: The failing baseline-ratchets job reports assertion-safety failure. Other annotations concern untouched max-lines entries and are not attributed to this patch. Detailed job logs were unavailable because their storage redirect was blocked. (a9eb05b6e89f)
  • Documented log field removed: The fallback guide promises fallbackStepFromFailureDetail in structured logs, but the new explicit log projection omits that field while preserving it in the returned step. Public docs: docs/concepts/model-failover.md. (docs/concepts/model-failover.md:569, a9eb05b6e89f)
  • Current-main behavior: The introduced files match their merge-base versions on fetched main, which still spreads the complete fallback step into logs; the central cleanup is not already implemented there. (src/agents/model-fallback-observation.ts, 1956ba00b72b)
  • Earlier proposals and history: Read the maintainer withdrawal discussions at refactor(runtime): remove routine agent and workspace traces #174363 and refactor: remove routine core agent and reply diagnostics #174383; both were withdrawn rather than merged. Feature-history searches followed earlier pi-embedded names and identified observation, harness, maintenance, and local-service contributors. Some historical git-show parent objects were unavailable; introduction claims below use independently available history.

Likely related people:

  • Peter Steinberger: Raw commit 0e586bb adds src/agents/model-fallback-observation.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0e586bb48a31; files: src/agents/model-fallback-observation.ts)
  • Vincent Koc: Raw commit 4228ae9 adds src/agents/provider-local-service.ts:326 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4228ae93c8cf; files: src/agents/provider-local-service.ts)

PR surface

Source -349, Tests -65. Total -414 across 44 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 36 60 409 -349
Tests 8 69 134 -65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 44 129 543 -414

Labels

Label changes:

  • add P3: This is accepted diagnostic cleanup with focused baseline and documentation repairs, without an identified runtime regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is accepted diagnostic cleanup with focused baseline and documentation repairs, without an identified runtime regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 7:55 PM ET / 23:55 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head landing evidence for f15283c.

The original source review completed independently scoped-clean through P2; the exact shrink-only baseline repair received its own scoped-clean review. Applicable exact-head CI is green. All check runs are enumerated immediately before submission; no failed, cancelled or pending check may remain on this head. The original baseline-ratchet failure on a9eb05b was ours and repaired (tools-start allowance5→2), not labelled inherited.

Fresh pre-submission enumeration:141 check runs across both pages,86 success,54 intentionally skipped,1 neutral; zero failure/cancellation/pending. Effective writer verified as steipete; live PR head matches the reviewed SHA and is MERGEABLE.

Failure Attribution / resolution
Initial checks-fast-baseline-ratchets, job117246585933 PR-caused stale allowance; repaired and independently reviewed, new exact-head CI passed.
Native review-init attempt1 Managed-worktree capacity lease unavailable; bounded twenty-minute attempt ended OPENCLAW_STATE_LEASE_ABORTED. All owned children drained; exact retained lock109c7efdcc290ce92ee89002d1c80a39a4c8ba0d recovered natively.
Native review-init attempt2 Same managed-worktree allocation infrastructure; twenty-minute attempt ended OPENCLAW_STATE_LEASE_ABORTED while acquiring capacity. All initializer children drained; guarded native recovery was invoked for exact retained lock5327d524cc0afded6a6facee091c082e2d3f6923. That recovery only reconciles the local operation lock; no merge intent was ever submitted.

Coordinator-authorized campaign rule10 applies after these two infrastructure failures: submit a squash through the exact-head SHA-guarded merge API. This bypasses broken workflow allocation, not review or CI. Production reduction:349 net lines. Client-visible masked failures, returned fallback detail, security, FIFO, caches and write settlement remain. No CI rerun or unchanged-head push was used to obtain green.

@steipete
steipete merged commit 590cd46 into main Oct 17, 2026
144 checks passed
@steipete
steipete deleted the deslop/r02-2-agent-traces-20261015 branch October 17, 2026 00:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* refactor(agents): remove duplicate diagnostic projections

* chore(agents): shrink retired trace assertion allowance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant