Skip to content

perf(agents): skip disabled debug preparation - #150361

Merged
vincentkoc merged 3 commits into
mainfrom
perf/disabled-debug-model-serialization-20260917
Sep 18, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
perf/disabled-debug-model-serialization-20260917

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Current qualification head: 7f8f144472c003291d8e262e9c24aa13ad5928e3. Integrated current main and corrected the inherited planner-test assumptions about job-level two-worker caps. Production scheduling is unchanged. Four focused cases and all 81 planner tests passed; fresh scoped P0–P2 review is clean. Prior CPU proof remains source-bound; fresh integrated-head CI and native qualification are pending.

What Problem This Solves

Agent stream setup resolves cache retention and serializes parameter diagnostics even when debug logging is disabled.

User Impact

Disabled-debug requests avoid that diagnostic work. Stream options, per-call cache retention, and debug output when either logging sink is enabled stay unchanged. No configuration or data migration is required.

Why This Change Was Made

Gate diagnostic preparation with the existing logger enablement check. The regression uses the actual wrapper and logging configuration, verifies every stream completes, and checks file and console sinks across logging changes. Production line count is unchanged; the remaining changes are regression coverage and two logger fixtures.

The follow-up simplifies diagnostic object construction while preserving JSON output and the existing logging guard. This removes the two-line growth rejected by CI without changing tests or weakening the line-cap check.

Evidence

  • Native Linux proof on Node 24.19: the original candidate passed 99 tests across the regression, cache-retention, sampling, lifecycle, and logging suites. It eliminated 1,000 diagnostic retention resolutions and 1,000 serializations while all 1,000 stream calls completed. This remains historical proof for that source.
  • All 19 canonical core-test type graphs passed for the earlier combined CPU overlay, including retained, source-bound checks from this run. Only successful surfaces are retained from partially successful batches.
  • The corrected production source separately passed both debug regressions, typed lint, formatting and the line-cap check. Scoped formal and independent source reviews found no actionable issues. The three committed test files are unchanged; the correction is committed as 49808d12e106994cdb7911424ec75a2543017c5c.
  • Matched Linux timing used warmups followed by six ABBAAB cells on Node 24.19, identical inputs, and separate operation-count instrumentation. The accepted archive is SHA-256 84660e59bc09a3496b387cc0235a745febe6c027ae037149d1a2886dfbc2fecd.
Measurement Before After
First wrapper construction 0.000989048 s 0.001156422 s
1,000 primed constructions 0.021806250 s 0.004304614 s
Worker lifetime peak RSS through timing 401,796 KiB 390,644 KiB
Worker lifetime peak RSS through cleanup 475,692 KiB 477,840 KiB

Primed construction improved; first-call latency and full-lifetime peak RSS did not. Measurements exclude imports/setup and cover wrapper construction with synthetic streams. RSS is a worker process lifetime peak, not phase allocation or process-tree memory. These results establish no end-to-end Gateway or hosting speedup. New-head hosted CI and native landing gates remain pending.

Punchcard-Session: clear-workshop-brook-w2
Punchcard-Session: ember-river-harbor-t4

Punchcard-Session: clear-workshop-brook-w2
@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 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: M maintainer Maintainer-authored PR labels Sep 16, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 22:52
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 12:34 AM ET / 04:34 UTC (Revision 3).

ClawSweeper review

What this changes

The PR skips agent-stream diagnostic preparation when debug logging is disabled, adds logging and stream-option regression coverage, and updates planner tests to recognize inherited worker limits.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: current main and the latest release still prepare disabled diagnostics. No actionable correctness or security findings were identified, and the prior review contains no outstanding concrete findings.

Priority: P2
Reviewed head: 7f8f144472c003291d8e262e9c24aa13ad5928e3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with meaningful regression coverage and no identified blocking defect; runtime checks were not rerun in this read-only review.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its supplied evidence covers wrapper construction with synthetic streams and logging sinks, not a live Gateway or provider run; no changed authority boundary requires additional proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its supplied evidence covers wrapper construction with synthetic streams and logging sinks, not a live Gateway or provider run; no changed authority boundary requires additional proof.
Evidence reviewed 9 items Introduced production change: The pinned base-to-head diff gates only diagnostic retention resolution and serialization. Per-call retention resolution and request-option precedence remain outside the guard.
Existing logging owner covers both sinks: isEnabled defaults to the union of console and file enablement, using the same current settings as log emission. The PR reuses this owner without adding configuration or another logging policy.
Current main still performs the work: Fetched main resolves initial cache retention and serializes diagnostic parameters before calling debug, without an enablement guard.
Findings None None.
Security None None.

How this fits together

The embedded agent runner combines configured model parameters with per-request options before invoking a provider stream. Its subsystem logger independently controls file and console diagnostics.

flowchart TD
  A[Configured model parameters] --> B[Prepare stream wrapper]
  B --> C{Debug enabled in either sink?}
  C -->|Yes| D[Prepare and emit diagnostics]
  C -->|No| E[Skip diagnostic work]
  B --> F[Resolve retention for each request]
  F --> G[Provider stream with request options]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +251. Total +251 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 13 0
Tests 4 256 5 +251
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 269 18 +251

Review metrics

None.

Technical review

Best possible solution:

Keep diagnostic preparation behind the existing logger enablement check while preserving per-request retention resolution and option precedence.

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

Yes, from source: constructing a wrapper with recognized parameters on current main performs diagnostic retention resolution and serialization even when both debug sinks are disabled; this review did not execute that path.

Is this the best way to solve the issue?

Yes. Reusing the existing sink-aware logger guard removes the unnecessary work without changing provider invocation or creating another policy owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded agent-setup performance improvement with no demonstrated urgent user-facing failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Its supplied evidence covers wrapper construction with synthetic streams and logging sinks, not a live Gateway or provider run; no changed authority boundary requires additional proof.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T22:58:30.375Z sha 9bd8c43 :: blocked before merge. :: none
  • reviewed 2026-09-18T04:06:57.825Z sha 49808d1 :: needs maintainer review before merge. :: none

Integrate current main while retaining the CPU debug serialization fix. Preserve explicit cap validation for serial jobs that inherit a job-level two-worker limit.

Punchcard-Session: ember-river-harbor-t4
@vincentkoc
vincentkoc merged commit e0e9935 into main Sep 18, 2026
210 checks passed
@vincentkoc
vincentkoc deleted the perf/disabled-debug-model-serialization-20260917 branch September 18, 2026 04:54
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 18, 2026
Recognize the two-worker ceiling retained by a promoted job after #151339
finalizes Gateway admission before placement. Keep every other group field
strictly equal and preserve the landed controls from #150361.

Reject missing or raised job caps in the existing promoted-recipient fixture
alongside its unchanged group-cap controls.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
* perf(agents): skip disabled debug preparation

Punchcard-Session: clear-workshop-brook-w2

* fix(agents): keep disabled-debug optimization within line budget

Punchcard-Session: ember-river-harbor-t4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant