Repository navigation
refactor(infra): consolidate service paths and usage rollups - #119433
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 11:22 PM ET / August 5, 2026, 03:22 UTC. ClawSweeper reviewWhat this changesThis PR consolidates daemon service-path and node-service setup plus session usage-rollup accumulation while preserving platform service identities and cost-reporting behavior. Merge readinessKeep open. This remains a distinct, behavior-preserving refactor with no actionable correctness finding; its protected Priority: P3 Review scores
Verification
How this fits togetherManaged daemon setup converts CLI install and control requests into platform service definitions with a minimal PATH and node-specific identity. Session transcript parsing feeds incremental usage rollups, which produce bounded and all-time cost reports. flowchart LR
A[Daemon CLI request] --> B[Node service adapter]
B --> C[Platform service definition]
D[Session transcript] --> E[Usage rollup]
E --> F[Cost and usage report]
Decision needed
Why: The patch is behavior-preserving and clean, but the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource -120. Total -120 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single canonical service-path and rollup flows, then land only if a current-base review preserves the inspected platform and reporting invariants. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR claims behavior preservation rather than a bug fix; its exact-head runtime artifact exercises the changed service and rollup paths. Is this the best way to solve the issue? Yes. Consolidating the duplicated logic at the existing service-environment and rollup owners is the narrowest maintainable approach, and the sibling platform/reporting paths were checked. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8caab5c3d3c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Daemon startup and usage accounting independently repeated platform PATH assembly, service identity selection, and timestamped versus untimestamped rollup projection. This is part of a maintainer-requested project-wide production LOC reduction campaign.
Why This Change Was Made
Consolidate equivalent platform/service path and usage accumulation owners while preserving Nix/workspace ordering, service identity, and all model/tool/cost accounting.
User Impact
No service-startup or usage-reporting behavior changes; removes 120 production lines.
Evidence
gpt-5.6-solwithxhighreasoning; no accepted or actionable findings.git diff --check, scoped formatting, and direct before/after behavioral equivalence checks passed.Exact-head service setup and usage-rollup runtime proof
The actual committed daemon service environment, node service, and usage-rollup production modules were executed through a TypeScript-stripping Node VM. Their source bytes were verified against the exact Git blobs; an in-memory native service-manager fixture avoided all operator state, service mutation, and network access.
{ "head":"9a5c08677fe38139b619f3d54ef3bffff044d866", "sourceBlobs":{"src/daemon/node-service.ts":"fff737bc75ae3ba97b38fe2e08a7e8a7e886805a","src/daemon/service-env.ts":"89ce13f04490fb3282461234715d9ca4257da713","src/infra/session-cost-usage-rollup.ts":"1914833be0904d54d7e9f2ad91b4e4f74e2b7019","src/infra/session-cost-usage.types.ts":"ec67a3015419324d358fa3714c71c71b395c4e16"}, "serviceSetup":{"linuxPathPrefix":["/usr/local/bin","/usr/bin","/bin"],"pnpmRoots":["/fixtures/home/.local/share/pnpm","/fixtures/home/.local/share/pnpm/bin"],"workspacePathRejected":true,"nixProfilePrecedence":["/fixtures/home/.nix-profile/bin","/nix/default/bin"],"macosLaunchAgentPath":"/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin","windowsPersistsInstallTimePath":false,"nodeInstall":{"programArguments":["/fixtures/runtime/bin/node","node-host"],"launchdLabel":"ai.openclaw.node","systemdUnit":"openclaw-node","windowsTaskName":"OpenClaw Node","windowsTaskScript":"node.cmd","serviceKind":"node","serviceMarker":"openclaw","pathFirst":"/fixtures/runtime/bin","credentials":"[REDACTED]"},"statusProbeTimeoutMs":1234}, "usageRollup":{"timestamps":[1785931200000,1785931202000],"lastUserTimestamp":1785931200000,"bounded":{"totalTokens":55,"totalCost":0.125,"messageCounts":{"total":2,"user":1,"assistant":1,"toolCalls":2,"toolResults":1,"errors":2},"toolUsage":{"totalCalls":2,"uniqueTools":1,"tools":[{"name":"weather","count":2}]},"models":[{"provider":"fixture-provider","model":"fixture-model","count":1}],"latency":{"count":1,"avgMs":2000,"p95Ms":2000,"minMs":2000,"maxMs":2000},"missingCostByModel":{"fixture-provider/fixture-model":1}},"includingUntimestamped":{"totalTokens":62,"totalCost":0.132,"messageCounts":{"total":3,"user":1,"assistant":2,"toolCalls":3,"toolResults":2,"errors":2},"untimestampedTokens":7,"latencySamples":1}}, "assertions":"PASS" }This observed runtime artifact fulfills the requested service-setup and usage-rollup evidence. The reviewed Git head remains unchanged; root policy explicitly does not require another bot review after a body-only evidence update.