Skip to content

refactor: remove routine core agent and reply diagnostics - #174383

Closed
steipete wants to merge 0 commit into
mainfrom
deslop/z22-20-core-callsite-traces-20261015
Closed

steipete wants to merge 0 commit into
mainfrom
deslop/z22-20-core-callsite-traces-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Core agent/reply call sites format routine stage traces and carry private heartbeat-log bookkeeping through execution, accounting, and payload preparation. Provider/media failure logs also copy arbitrary message-derived error/path content into ordinary diagnostics.

User Impact

Routine core/reply logs become quieter and omit message-derived error and media-path content. Reply delivery, returned errors, heartbeat stripping, security and settlement behavior remain unchanged; no configuration or migration action is needed.

Why This Change Was Made

Remove routine success/intermediate traces, their sole-reader counters/projections, and private heartbeat logging state across all local callers. Keep heartbeat stripping, reply/media transformation, delivery receipts, dedupe, FIFO, security/currentness checks, settlement, actionable warnings, client-facing error details, and diagnostic/OTel consumers. Failure logs retain category/status/correlation without provider body or prompt-media path content. Existing privacy tests now protect the logger boundary while retaining returned/client results.

The buildReplyPayloads test seam is local-only: scripts/lib/plugin-sdk-entries.mts classifies reply-payload-testing non-production, and package.json excludes both its JavaScript and declarations. Public silentReplyContext and onHeartbeatStrip contracts remain unchanged. A live consumer query had zero observed references but incomplete coverage (2026 complete/378 partial/1 failed of2405;625 unresolved), not ecosystem assurance.

Best-effort tradeoffs accepted

  • Successful/intermediate stage reconstruction and suppressed-final summaries no longer appear in verbose logs; authoritative results, receipts, lifecycle outcomes and real failure warnings remain. Source lineage and retained incident-related guards are recorded in the lane ledger/report; no concurrency, durability, security, or settlement guard is removed.
  • Arbitrary provider-error prose and prompt-media paths are not copied into routine logs. Operators retain failure category/status/correlation; authorized returned/client error details keep their existing owner and masking.
  • Private heartbeat logging booleans are removed rather than retained as meaningless compatibility fields. The local-only testing facade is explicitly omitted from packaged builds; supported public callbacks/types remain.

Size

290 net production lines removed (44 files,+70/-360), plus32 net test/support lines removed (33 files,+65/-97).77 source/test paths. This is the linked core AREA split under campaign rule11, not another residue branch.

Evidence

Canonical independent complete-candidate P0-P2 review: terminal scoped-clean, confidence0.94, final source verification complete; reviewed source patch SHA256 61a10350329cd2cbd3395b17bbb0d3713ce8da999a301f5993dac6f2d50ce1a1. Targeted formatting and git diff --check pass. Retired private fields/selectors have no remaining affected core callers; the separate WhatsApp inbound trace flag is independent.

Isolated changed-source assertion syntax scan:44 governed files,0 allowance deltas. No assertion baseline changes. This is not a full ratchet or typecheck.

No runtime tests, targeted types, lint/suppression/cycle gates, builds, E2E or live-channel runs are claimed locally. Local host limits and unqualified dependencies leave those proof gaps for exact-head hosted CI; test wall time/CI seconds unavailable. Phase E standalone memory, audit, cron, schema/config/protocol/dependency and SDK-export surfaces remain untouched.

@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 channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 15:55
@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-16T16:35:07.144575Z 07667dc New commits
ℹ️ 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

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: f0ae806a900f960d8d433af9d692bdae9e1019ad
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • 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-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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 and reply logs, private heartbeat logging state, and provider-error or media-path content from diagnostics.

Example: A provider error contains synthetic-private-tool-output and HTTP status 401.

  • Before: Routine fallback diagnostics can include error-message previews.
  • After: Diagnostics retain status and correlation fields while returned fallback details remain available.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The direction and source changes are coherent, but a directly attributable dispatch test failure leaves validation incomplete.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored logging cleanup is outside the ordinary contributor proof gate; the supplied evidence makes no shipped-entry-point runtime claim.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Routine logs are noisy and can retain message-derived provider-error prose or media paths.
Reason: The maintainer explicitly accepts reduced stage reconstruction and diagnostic detail while preserving delivery and client-facing contracts.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-directed cleanup preserves runtime behavior, but an unchanged dispatch test still requires a deliberately removed log and fails exact-head CI.

Priority: P3
Reviewed head: f0ae806a900f960d8d433af9d692bdae9e1019ad

Before merge

  • Update the privacy test for the retired suppression log (P2) - Removing the suppression log makes suppressedLog undefined for the sendPolicy=deny case, but this unchanged test still requires its metadata. Exact-head CI reports this assertion failing in checks-node-changed-compact-large-21-1. Replace the log-presence assertion with a check that captured logs contain no PRIVATE_REPLY_123 or textPreview, retaining the no-delivery assertion; restoring the retired log would contradict the accepted change.

Findings

  • [P2] Update the privacy test for the retired suppression log — src/auto-reply/reply/dispatch-from-config.hooks-and-send-policy.test-utils.ts:435-439

Provenance

  • Remaining routine stage traces and heartbeat logging state: original intent not found (unknown: Commit history identifies later owner refactors, but git log -S searches encountered unavailable historical blobs before establishing every original logging rationale.)
Agent review details

How this fits together

Inbound messages enter reply dispatch, execute through the agent runtime, and produce channel payloads, lifecycle events, and diagnostic logs.

flowchart LR
  A[Inbound message] --> B[Reply dispatch]
  B --> C[Agent runtime]
  C --> D[Reply preparation]
  D --> E[Channel delivery]
  C --> F[Diagnostic logs]
  C --> G[Client lifecycle events]
Loading

Technical review

Best possible solution:

Preserve the accepted logging cleanup and update the dispatch privacy test to check all captured logs without requiring the retired message.

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

No product defect needs reproduction for this refactor; exact-head CI confirms the stale test assertion, and source inspection establishes its cause.

Is this the best way to solve the issue?

Removing logs at their producers and deleting their private bookkeeping fits the accepted direction, provided the remaining privacy test follows the new contract.

Full review comments:

  • [P2] Update the privacy test for the retired suppression log — src/auto-reply/reply/dispatch-from-config.hooks-and-send-policy.test-utils.ts:435-439
    Removing the suppression log makes suppressedLog undefined for the sendPolicy=deny case, but this unchanged test still requires its metadata. Exact-head CI reports this assertion failing in checks-node-changed-compact-large-21-1. Replace the log-presence assertion with a check that captured logs contain no PRIVATE_REPLY_123 or textPreview, retaining the no-delivery assertion; restoring the retired log would contradict the accepted change.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Embedded lifecycle and failover observations changes intended behavior with a stated reason (87d939b: The original observation work added structured lifecycle/failover events with sanitized previews, hashes, and fingerprints for diagnosis.)
  • Suppressed-final reply metadata changes intended behavior with a stated reason (refactor: deslop infra and reply/agent paths; stop logging private reply text (wave-4 bundle) #172669: Earlier privacy work retained suppressed-reply metadata while removing private reply text; this PR explicitly accepts removing the summary itself.)
  • Dispatcher silent-reply context keeps the original intent (1303b03: Conversation-specific silence policy originally required context; current dispatcher normalization no longer consumes it for policy, and its remaining log consumer is removed.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/auto-reply/reply/dispatch-from-config.delivery.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Patch-caused CI failure: The exact-head checks-node-changed-compact-large-21-1 job reports the suppressed-reply metadata test failing at line 438 because the expected log is undefined. (src/auto-reply/reply/dispatch-from-config.hooks-and-send-policy.test-utils.ts:438, f0ae806a900f)
  • Introduced removal causes the stale assertion: The introduced diff removes the final-reply suppression log; the unchanged test searches for that log before asserting its metadata. (src/auto-reply/reply/dispatch-from-config.finalize.ts:133, f0ae806a900f)
  • Accepted diagnostic tradeoff: The maintainer-authored body explicitly accepts losing intermediate traces, suppressed-final summaries, and arbitrary provider-error prose while retaining outcomes, receipts, warnings, and client details. (f0ae806a900f)
  • Supported contracts retained: Client error projection remains separate from reduced logger metadata; silentReplyContext and onHeartbeatStrip remain declared, and reply-payload-testing is explicitly excluded from packaged JavaScript and declarations. (src/agents/embedded-agent-subscribe.handlers.lifecycle.ts:201, f0ae806a900f)
  • Current main still contains the diagnostics: Fetched main retains raw error previews in lifecycle logging and the suppressed-final metadata log, so the central cleanup is not already implemented there. (src/agents/embedded-agent-subscribe.handlers.lifecycle.ts:228, e396923879c3)
  • CI attribution and history limits: Other failed jobs have annotations but insufficient causal detail; downloading job logs was blocked at GitHub's Azure artifact host. Content-history searches also encountered unavailable promisor blobs, while commit history and targeted blame remained usable. (f0ae806a900f)

Likely related people:

  • Altay: Raw commit 87d939b adds src/agents/pi-embedded-error-observation.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 87d939be7936; files: src/agents/pi-embedded-error-observation.ts)

PR surface

Source -290, Tests -32. Total -322 across 77 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 44 70 360 -290
Tests 33 65 97 -32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 77 135 457 -322

Review metrics

Metric Value Why it matters
Production versus test/support LOC Production +70/-360; tests/support +65/-97 The production reduction removes logging and its private bookkeeping; added test assertions protect privacy and retained returned details.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is bounded diagnostic cleanup with a focused test repair, rather than an urgent runtime regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • 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, 12:13 PM ET / 16:13 UTC.

@steipete steipete closed this Oct 16, 2026
@steipete
steipete force-pushed the deslop/z22-20-core-callsite-traces-20261015 branch from f0ae806 to 07667dc Compare October 16, 2026 16:33
@steipete

Copy link
Copy Markdown
Contributor Author

Core logging AREA CI disposition

Exact published head: f0ae806a900f960d8d433af9d692bdae9e1019ad.
Run: https://github.com/openclaw/openclaw/actions/runs/38927810946

The original cleanup is not approved for an inherited-failure exception. Two
failures remain unattributed: Bun retirement capture retention and the Discord
integration fixture's missing plugin-runtime proxy. The isolated baseline replay
could not load tests because the independently owned checkout has no dependencies;
no install, relink, broad local run, retry, timeout increase or skip was used.

Failed job Attribution and disposition
check-guards / 117064641632 Inherited: unrelated doctor run38926989391/job117061670784 has the exact missing cli-parent-lifetime.mjs coverage finding and all52 ordered clone occurrences/28unique endpoints. No finding path intersects this cut.
checks-fast-baseline-ratchets / 117064641713 Inherited: main38925734601/job117058576715 has the same closed doctor mock at doctor-plugin-source-captures.test.ts:32; relevant test and allowance blobs match CI base.
checks-node-changed-compact-small-5 / 117064643590 UNKNOWN: Bun cache retirement child retains callback capture. Node baseline passes are not Bun evidence.
checks-node-changed-compact-large-21-1 / 117064643801 Ours: obsolete positive suppressed-log expectation, repaired while preserving no-delivery/private-text exclusion.
checks-node-compact-small-3 / 117064644075 UNKNOWN: Discord ingress proxy failure. Main#174322 removed fixture seams, but source diagnosis alone is not a second observed runtime witness.
check-lint-core-2 / 117065199471 Ours: unused logging import and orphan test helper; repaired.
check-test-types-core-1 / 117065199550 Ours: existing logger privacy assertions needed vi.mocked; repaired without casts.
check-test-types-core-2 / 117065199907 Ours: unused logging import; same repair.
check-test-types-core-3 / 117065199545 Ours: unused logging import; same repair.
check-test-types-core-4 / 117065200106 Ours: unused logging import; same repair.
check-test-types-core-5 / 117065199719 Ours: unused logging import; same repair.
check-prod-types / 117065199610 Ours: unused logging import; same repair.
check-test-types / 117065199637 Ours: unused logging import; same repair.
openclaw/ci-gate / 117073028748 Aggregate failure of the leaves above; no independent product finding.

Rule8 requires restoring the changed owners reached by unattributed failures.
The pinned per-file import graph positively reaches43of44 production candidates,
including the type-only companion and explicit subprocess/Discord facade edges.
This is not a blanket family rollback. The one presently unreached file is
openrouter-model-capabilities.ts: three ordinary cache-success debug lines, with
all fetch/cache/error behavior unchanged. It must stay preserved separately in
the lane's sole residue rather than be dropped with unrelated reached owners.

The complete repaired proposal is preserved on pushed branch
deslop/z22-parked-core20-ci-20261015, signed commit
e04241caa753c66cf5d72f67216d12888862205a (291 net production lines removed).
The separate three-line OpenRouter patch exactly matches its previously reviewed
bytes and is committed in the single unpushed residue branch,
deslop/z22-residue-20261015 at 91d806ef91bca791f57d2af01243993a4cbd88d2.
No second tiny residue branch was created. The 43 reached production owners and
34 coupled tests/support changes are restored on the publication branch.

With every proposal hunk either graph-qualified for restoration or transferred
to the single residue, the publication branch has no remaining candidate: it is
restored to fresh main 07667dcc8f4df3aa40be463415304623726b58c2. The resulting
empty PR is withdrawn, not merged. No merge or production-removal credit is
claimed. Reconsidering the parked 288-net reached slice needs attributable Bun
retention and Discord proxy integration proof; repaired lint/types/log
expectations alone do not supply that proof. No CI reruns or unchanged-head
pushes were used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: XS 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