Repository navigation
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 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: 31347d0b7b
ℹ️ 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".
| !input.some( | ||
| (item) => | ||
| item?.type === "reasoning" && | ||
| typeof item.encrypted_content === "string" && | ||
| item.encrypted_content.length === 16 * 1024, | ||
| ) |
There was a problem hiding this comment.
Match replay to the immediately preceding reasoning signature
In the attempt-retention recovery request, the input can contain the reasoning signature from the initial tool-call response as well as the newer signature from the output-limit response. This predicate accepts any 16 KiB reasoning item, so dropping the newer signature while retaining the older one still increments reasoningReplayRequests and lets the benchmark report successful recovery replay. Track each generated signature by turn/response and require the continuation to contain the signature from the immediately preceding response.
AGENTS.md reference: AGENTS.md:L38-L38
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Tightened the driver to match the exact completed-response signature per tool-call continuation and reject replay of the incomplete reasoning-only signature. Requiring the immediately preceding output-limit signature failed on unchanged baseline: the replay owner intentionally drops reasoning-only length stops (src/agents/embedded-agent-runner/replay-history.ts, introduced in #88656). The diagnostic run confirmed completed signatures were preserved exactly while incomplete signatures were omitted in all five sessions. The corrected assertion passed the real Gateway workload, lint, and independent review.
31347d0 to
d00920d
Compare
0feeeda to
717ebe1
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR releases completed attempt snapshots, successful recovery groups, and prepared-registry caller context. Example: A Gateway completes tool-heavy turns while harness callbacks remain reachable.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes concrete memory-retention paths still present on main, with no introduced correctness or security defect found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded runner processes harness results into retries or final replies; startup recovery and prepared-registry owners retain resources until their work settles. flowchart TD
A[Gateway turn] --> B[Embedded runner]
B --> C[Harness callbacks]
B --> D[Attempt results]
D --> E[Retry or final reply]
F[Startup recovery groups] --> G[Release completed references]
H[Prepared registry resources] --> G
E --> G
Technical reviewBest possible solution: Remove completed references at the existing lifecycle owners while preserving active retries, finalization inputs, resource claims, and close errors. Do we have a high-confidence way to reproduce the issue? Current main contains the retaining callback scope, successful-activation group references, and pending registry observer; the PR supplies corresponding baseline-versus-candidate GC results, but this read-only review ran no target code. Is this the best way to solve the issue? The patch addresses reference ownership directly with the existing lifecycle mechanisms, and the added tests exercise distinct collection failures without new production scaffolding. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c82110895d71. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +119, Docs +8, Other +71. Total +200 across 9 files. Added test files: 0. View PR surface stats
Review metrics
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 19, 2026, 6:37 PM ET / 22:37 UTC. |
717ebe1 to
c0f4bde
Compare
|
Merged as 10049a6 under the scoped unrelated-CI exception. The only non-aggregate CI failure was job 118352535436 in run 39337840363: The completed hour processed 4,010 turns per side. Delayed idle retained zero raw attempts, message snapshots, SessionManagers, AgentSessions, and settled-turn callbacks. Active forced-GC heap stayed within −1.28% to +4.89% of the first active sample. Two fresh symmetric timing pairs passed 200 turns per side each, with CPU differences −1.45% and −0.43% and confidence intervals spanning zero. Full measurements, the initial-idle comparison, and the one-sided heap-snapshot timing confounder are recorded in the PR body. Production confirmation remains for the next already-planned batched restart; this task did not request or perform a production restart. |
* fix(agents): release settled attempt and recovery snapshots * fix(agents): release prepared registry caller context * test(perf): verify exact completed reasoning replay * test(agents): preserve recovery mock exports * fix(perf): narrow benchmark responses and remove stale mock debt
Upstream provenance: PR openclaw#177763, exact upstream commit 10049a6; adapted, not cherry-picked. Adaptation: scope attempt-local dispatch, recovery, prepared-runtime, and terminal snapshots to one reclaimable block; remove completed prepared-registry views immediately after successful close. The upstream onSettledTurn WeakRef test and callback-specific changes are omitted because that callback contract is absent on 10.5. Regression coverage: embedded run cleanup/custody, prepared-runtime startup registry, subagent queued recovery, guarded tsgo:core, oxlint, and oxfmt. Rollback: revert this commit only.
Record openclaw#177763 exact provenance, ownership adaptation, contract deviation, focused gates, and rollback commit.
What Problem This Solves
Completed agent attempts could keep their transcripts alive through retained harness callbacks. Successful startup recovery also kept obsolete run records, while a pending prepared-registry completion observer retained the acquiring turn’s async context for the lifetime of a cached registry.
User Impact
Completed turns and successful recovery release their object graphs. Active work, finalization, transcript writes, resource claims, close errors, and failed-activation retry state keep their existing behavior. No configuration, storage-format, or retention-policy change.
Why This Change Was Made
Binding owners are per-object identity slots, including retained historical run records, not a separate global registry. Bounded terminal replies remain canonical delivery-retry evidence. AgentSession and SessionManager are attempt-owned; no idle-session LRU or competing owner is introduced.
Evidence and Measurement
Synthetic real-Gateway workloads used 5,000 sessions, 6,000 retained runs, ten traffic sessions, real read tools, inline images, output-limit recovery, and 16 KiB reasoning signatures. Concurrent A/B pairs held the exclusive measurement lock on separate 16-core halves (96–111 and 112–127), then swapped placement. Setup/analysis used cores 64–95; writes remained sequential and Dirty stayed below 2 GiB. No Testbox/Crabbox leases or production restart were used.
Two short pairs each completed 100 measured turns plus warmup:
The short-pair CPU increase is reported rather than called neutral. Cohort-paired mean CPU differences were +80.39/+79.62 ms (SD 86.20/179.86 ms). Baseline idle census retained 18 raw attempts and 18 snapshot arrays containing 126 entries; candidate retained zero. Immediate SessionManager/AgentSession counts were 30/30 versus 11/11.
Completed 60-minute soak
The paced soak completed 4,010 measured turns per side in approximately 60 minutes, with four clients, ten sessions, nine-second cohorts, and session resets every twenty cohorts. Every tool/replay assertion passed: 4,010 tool calls/results and 4,010 exact completed-signature replay checks per side. This is approximately 66.7 turns/minute, not model requests/minute.
The delayed capture began 42.96 seconds after the last turn, 30.01 seconds after the settled capture ended. Remaining objects named Agent are HTTP/HTTPS/Undici objects or prototypes, with no LLM mutableState/messages.
All 58 active forced-GC samples stayed between 577.661 and 613.721 MiB (−1.28% to +4.89% relative to the first active sample); final active growth was +4.58%. Same-reset-phase drift ranged from −1.93% to +4.01%, over up to 42 minutes. Final forced-GC heap was 612.810 MiB baseline / 611.943 MiB candidate. The idle-start to active-end comparison is +11.71% (547.815 → 611.943 MiB), so it is not presented as equivalent load. Initial/delayed-idle snapshot object self-size decreased 0.83% (640,560,120 → 635,249,218 bytes); this is distinct from process heapUsed.
Of the final 7,213 binding owners, 7,200 belong to the fixed fixture: 6,000 unique retained-run records plus 1,200 failed-activation retry duplicates. The large fixture intentionally exceeds startup worker capacity and must preserve those retry records. A separate successful-activation Gateway fixture proves cleanup: with twenty unique retained run IDs, obsolete duplicates fell from five to zero and total binding owners from 128 to 114. Both startup logs reported success.
Timing qualification
The hour’s timing is instrumented asymmetrically: only the candidate took an initial full heap snapshot. Its 334 unprofiled paired cohorts show CPU +11.51% (moving-block bootstrap 95% interval +10.67% to +12.35%) and wall +10.88%. Separately, 66 profiled cohorts, excluding the first boundary cohort, show CPU +10.51% and wall +9.77%. These increases are preserved, not called noise or attributed to the patch.
Node 26.8.2 provides a concrete confounder: taking a snapshot enables object-move tracking, but deleting it only removes the snapshot. Later GC moves incur a profiler mutex and object-ID map update. The benchmark preload does not clear that tracking. Candidate recorded 53.029 seconds of GC versus 16.738 seconds on baseline during the profiled interval, despite fewer GC events and 8.49% less retained sampled allocation.
Two fresh, swapped timing pairs with symmetric instrumentation completed successfully: no heap snapshots or retained sampling on either side, five-minute warmup, and three minutes / 200 measured turns per side in each pair.
These paired differences show no regression beyond noise under the tested workload; they are not a CPU-speedup claim. The approximately 11% penalty did not recur without the one-sided snapshot. Both pairs matched 200 tool calls/results/replays, 400 reasoning responses, 214 recap requests, and 618 streams per side. The second pair also matched all 240 list polls; the first pair’s nineteen equal-poll-count cohorts had CPU −1.71%. Both started and ended at reset phase fourteen after 34 warmup cohorts. Starts differed by 2 ms and 86 ms; CPU assignment and outside-load records were verified. The hour is memory/lifetime evidence; these short symmetric pairs qualify timing, not an uninstrumented 60-minute latency result.
Validation
Regression proof is red on baseline and green with the fixes: twelve retained settled callbacks keep twelve snapshots on baseline and zero on candidate; superseded recovery rows collect after successful retry; acquiring async context collects while an independent registry claim remains open. Focused runner/settlement/harness/recovery tests passed 124 tests, startup registry eight, and donor resources five, including rollback and close-error handling. After the closed-mock repair, all 24 focused recovery tests passed again. Changed-file format/lint and diff checks passed. One local native-tsrs core lane passed; final production/test type checks passed in PR CI. Independent Codex review and current-head automated review are clean through P2.
The driver verifies the exact completed-response signature and rejects the incomplete reasoning-only signature. An initial assertion requiring the newest incomplete signature failed on unchanged baseline: replay intentionally omits reasoning-only length stops (#88656). The corrected assertion passed the second short pair and every soak turn. No provider replay policy changed. The first soak launch failed before traffic because the minimal runtime capsules lacked the enabled diagnostics plugin entrypoint; identical plugin assets were built for both sides and both configs validated before measurement.
Current-head CI run 39337840363 has one non-aggregate failure:
checks-node-changed-compact-small-4, insrc/agents/decision-inference.openai.integration.test.ts, “prepares the registered OpenAI image Decision route before auth (platform)”. It returnedunavailableinstead ofok; the assertion omitted its reason. The other seven cases passed. CI tested mergefa43770cccbe2d318f123643d8fce0e6f81f0817, whose tree equals the PR head tree and whose parents are the recorded main baseline and PR head. Five focused file runs on exact main parent713ca224c42e67ada372cf53e3abd12c3868ee51and five on PR head each passed all eight cases:Source inspection confirms no changed status-determining behavior during evaluation: the outer prepared lease prevents final disposal, the moved set deletion only affects shutdown enumeration, and the removed observer registered cleanup before the timed request. Run-loop and recovery are outside this path. This supports unrelated intermittent-failure attribution under the scoped landing exception; a cold five-second deadline is a hypothesis, not an established CI cause. No CI rerun was requested. All other applicable current-head checks passed, including source/architecture guards, lint, security review, types, and changed-test shards.
Earlier CI found an obsolete mock-baseline row and an undefined-response narrowing error in the synthetic driver; both were repaired and independently reviewed. An earlier unlimited-maintenance assertion passed its focused replay and did not recur on this head; no speculative fix is claimed.
Runtime delta: +2 lines (249 added / 247 removed), principally the child scope and ownership comment, required to release completed results without clearing data still needed by finalization and retry. The non-test/non-docs diff is +78 lines including the driver (+72), README (+5), and obsolete mock allowance removal (−1). No new production state, helper, API, or compatibility path.
Measured runtime base:
08e32fdb4df002c9d4eea158b855d6521dd1e916, plus the exact three production changes. All three files match PR headc0f4bde747da4af8d3ea978dcd529dbc475a66a4, based on713ca224c42e67ada372cf53e3abd12c3868ee51. The pinned measurement driver predates only the equivalent defined-response guard. This is not claimed to be a full build of the newer PR base; PR CI validates that head. Production confirmation remains for the next already-planned batched restart.