Skip to content

fix(tasks): throttle unchanged attempt activity - #155745

Merged
vincentkoc merged 4 commits into
mainfrom
perf-gateway-baseline-tools-6bb-20260921
Sep 22, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
perf-gateway-baseline-tools-6bb-20260921

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Finishing an agent attempt can write unchanged task metadata immediately, bypassing the documented one-minute throttle for activity-only updates.

User Impact

Tasks retain the existing activity heartbeat without redundant writes between real transitions. Changed timestamps, starts, errors, tools, and terminal outcomes still persist immediately. No configuration or migration is required.

Release-note context: avoid unnecessary task-state writes when an attempt reports unchanged activity.

Why This Change Was Made

The shared event reducer previously copied the existing start timestamp into otherwise empty lifecycle updates. Remove that synthetic fact and discard equal timestamps only after coalescing and an authoritative row read. Both Worker writes and synchronous consumption retain queued timestamp corrections. Production code is one line smaller; no cache or phase-specific filter is added.

A separate test-only commit repairs the memory candidate fixture that blocked both CI attempts after candidate reads moved to a Worker. It replaces elapsed-time polling with the existing retrieval queue and provider-entry signals. The fixture keeps its existing timeout and real repair gate; native cancellation releases the gate. Memory production code is unchanged.

A second test-only commit restores typecheck headroom after a new test on main pushed gateway-server to 701 roots. It moves the complete worker-environment test subtree into the existing gateway-other graph and updates ownership assertions and documentation. The 25 graphs, stripe assignments, compiler concurrency, 700-root headroom guard, and 720-root hard cap stay unchanged.

Evidence

  • The original Task implementation failed the omitted/equal timestamp regressions while seven controls passed. All 13 final regressions pass, covering the exact 60-second boundary, changed finite timestamps including zero, current-row replacement, queued timestamp precedence, synchronous consumption, publication, and accepted-event read fences. Existing event, lineage, and transition suites also passed: 81 cases including the new cases before their relocation.
  • Task test cost: node scripts/run-vitest.mjs src/tasks/task-registry-agent-events.liveness.test.ts passed 13 cases in 44.38 seconds through the repository wrapper (37.89 seconds in Vitest), using the existing compiled-worker cache. Those test bytes are unchanged. CI per-file time cannot be attributed from the available compact-job metadata; no whole-job duration is presented as this file's cost. This addresses the review's test-cost request using the prescribed local wrapper.
  • Memory fixture proof: deliberately restoring the blocking repair await makes both startup modes fail at the completed-candidate assertion after the retrieval barrier, with successful cleanup. Restoring exact production bytes passes all three cases in 52.36 seconds through the wrapper (48.18 seconds in Vitest), plus targeted lint. This proves completion-before-repair ordering, not a cold-start latency guarantee.
  • Allocation proof: 23 focused ownership, partition, and changed-selection cases pass in 2.39 seconds through the wrapper (1.54 seconds in Vitest); canonical root-test type-aware lint also passes. Parsing immutable main 092cc29d5e0a9da56c507e567a6a5edaedf3be4d reproduces 701 Gateway server roots. The paired allocation change gives 479 server / 318 other roots with every canonical root assigned once across all 25 graphs. The branch itself has 478 / 318 roots.
  • Seven standalone static guards passed and carry forward on unchanged relevant inputs. Targeted formatting and whitespace checks pass. Final complete-branch autoreview is clean. New-head hosted CI and exact-head ClawSweeper review are pending.
  • Embedded finishing omits the timestamp; the Codex runtime repeats its attempt timestamp. The upstream contract was checked directly at openai/codex 414782450952a196bbb64b1605a458c2531c47b6, including codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:188–206, codex-rs/app-server-protocol/src/protocol/v2/turn.rs:377–394, and codex-rs/app-server/src/bespoke_event_handling.rs:1523–1573.

This proves durable-write suppression and preserved lifecycle behavior. It does not claim a measured CPU or latency improvement.

@vincentkoc vincentkoc self-assigned this Sep 22, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 22, 2026 13:19
@clawsweeper

clawsweeper Bot commented Sep 22, 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 size: M maintainer Maintainer-authored PR labels Sep 22, 2026
@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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 10:47 AM ET / 14:47 UTC (Revision 3).

ClawSweeper review

What this changes

The PR suppresses redundant task activity writes, adds persistence regressions, synchronizes a memory repair fixture, and redistributes Gateway typecheck coverage.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. No introduced correctness or security defects were found; the previous review’s empty finding list remains appropriate.

Priority: P2
Reviewed head: 1905be666b2151547206a99b39d1ca5f7b7ad2f0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful boundary regressions and bounded supporting test fixes; no actionable defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external contributor proof gate. Its reported event-to-SQLite regressions directly cover the changed reducer, while memory and allocation checks support the accompanying test changes; no live performance improvement is established. No stored-data model changes require migration 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 reported event-to-SQLite regressions directly cover the changed reducer, while memory and allocation checks support the accompanying test changes; no live performance improvement is established. No stored-data model changes require migration proof.
Evidence reviewed 9 items Introduced change and review continuity: Reviewed the pinned merge-base-to-head patch. The latest commit changes only typecheck allocation, its ownership assertions, and documentation; task production code and the memory fixture are unchanged since the previous reviewed head. The supplied stale test merge was not used to infer removals or regressions.
Current main still bypasses the throttle: Current main copies the existing start timestamp into otherwise empty lifecycle patches and retains explicitly repeated timestamps. Either makes the patch nonempty, bypassing the activity-only throttle. The documented contract limits activity-only durable updates to once per minute while preserving immediate transitions, errors, and tool counters.
Shared persistence decision preserves meaningful updates: Equal start timestamps are removed after coalescing and current-row selection. Changed timestamps, status transitions, errors, and tool counts remain eligible for immediate persistence. Worker and synchronous consumers reuse this decision; identity checks, admission, publication fencing, schema, and serialized record shape remain unchanged.
Findings None None.
Security None None.

How this fits together

The task registry receives agent lifecycle and tool events and maintains durable task status. Its shared reducer determines whether queued activity needs a SQLite write and subsequent publication.

flowchart TD
  A[Agent lifecycle and tool events] --> B[Task event queue]
  B --> C[Combine pending updates]
  C --> D[Compare with current task row]
  D --> E{Changed facts or heartbeat due?}
  E -->|Yes| F[Persist and publish task]
  E -->|No| G[Settle without writing]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +319, Docs 0. Total +318 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 5 -1
Tests 6 353 34 +319
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 358 40 +318

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net −1 line; tests net +322 lines The added code protects persistence and fixture behavior without adding a runtime owner or cache.

Technical review

Best possible solution:

Keep timestamp normalization in the shared reducer so worker and synchronous consumers enforce the same heartbeat while preserving real transitions.

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

Yes, from source: a recent finishing event with an omitted or equal start timestamp produces a nonempty patch on current main and bypasses the documented throttle. This review did not execute tests.

Is this the best way to solve the issue?

Yes. Comparing after coalescing against the authoritative row repairs the existing owner without losing queued corrections or introducing a competing cache.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs redundant task-state writes with bounded operational impact and no demonstrated user-facing outage.
  • 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 reported event-to-SQLite regressions directly cover the changed reducer, while memory and allocation checks support the accompanying test changes; no live performance improvement is established. No stored-data model changes require migration proof.

Evidence

What I checked:

  • Introduced change and review continuity: Reviewed the pinned merge-base-to-head patch. The latest commit changes only typecheck allocation, its ownership assertions, and documentation; task production code and the memory fixture are unchanged since the previous reviewed head. The supplied stale test merge was not used to infer removals or regressions. (1905be666b21)
  • Current main still bypasses the throttle: Current main copies the existing start timestamp into otherwise empty lifecycle patches and retains explicitly repeated timestamps. Either makes the patch nonempty, bypassing the activity-only throttle. The documented contract limits activity-only durable updates to once per minute while preserving immediate transitions, errors, and tool counters. (src/tasks/task-registry-agent-event.operation.ts:109, 50ea1795fc80)
  • Shared persistence decision preserves meaningful updates: Equal start timestamps are removed after coalescing and current-row selection. Changed timestamps, status transitions, errors, and tool counts remain eligible for immediate persistence. Worker and synchronous consumers reuse this decision; identity checks, admission, publication fencing, schema, and serialized record shape remain unchanged. (src/tasks/task-registry-agent-event.operation.ts:101, 1905be666b21)
  • Boundary regression coverage: The 13 added cases exercise event ingestion, actual persistence delegation, publication, read fences, the exact 60-second boundary, changed timestamps including zero, durable-row replacement, and queued timestamp precedence. The supplied body reports before-fix failures and after-fix passes, with 44.38 seconds wrapper wall time and 37.89 seconds Vitest time. These runs were not independently executed during this read-only review. (src/tasks/task-registry-agent-events.liveness.test.ts:32, 1905be666b21)
  • Memory fixture retains its observable ordering contract: The fixture queues an index-state read behind candidate lookups on the existing single retrieval worker, checks candidate completion while repair remains gated, and releases rendezvous on native cancellation. The body reports that restoring the blocking production await fails both startup variants, while restored production passes all three cases. (extensions/memory-core/src/memory/manager-candidate-repair.test.ts:100, 1905be666b21)
  • Typecheck coverage remains allocated: The complete worker-environments subtree moves from gateway-server to gateway-other, which already includes nested Gateway tests. Ownership assertions and docs move with it; the 700-root headroom guard, 720-root hard cap, canonical graph registry, and compiler concurrency are unchanged. The supplied body reports 23 focused checks passing. (test/tsconfig/tsconfig.core.test.gateway-other.json:6, 1905be666b21)

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-22T13:26:25.711Z sha 226304e :: needs changes before merge. :: none
  • reviewed 2026-09-22T14:27:48.117Z sha 87f3914 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Sep 22, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) September 22, 2026 14:52
@vincentkoc
vincentkoc merged commit 5c9d100 into main Sep 22, 2026
208 checks passed
@vincentkoc
vincentkoc deleted the perf-gateway-baseline-tools-6bb-20260921 branch September 22, 2026 15:04
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Sep 22, 2026
Merge current main with the memory candidate synchronization fix from #155745 and archive lifecycle request settlement from 94b9c47. Preserve the reviewed six-file SQLite exit cleanup and checkout fixture delta without further source changes.
steipete added a commit that referenced this pull request Sep 22, 2026
Include the canonical memory candidate fixture repair from #155745.
Preserve the reviewed five-file diagnostic change exactly.
steipete added a commit that referenced this pull request Sep 22, 2026
* fix(sessions): stop repeated failed worker exit cleanup

Use one-shot process-exit cleanup for retained reclamation workers and the
canonical validation pool. A rejected asynchronous close previously kept its
beforeExit listener, so each drained event loop repeated the same cleanup and
could prevent CLI and QA commands from exiting.

Keep failed database resource ownership and explicit close retries intact.
The existing native-worker tests cover failed idle memory-pressure cleanup,
repeated pressure, one exit cleanup attempt, and explicit receipt recovery.
Exit simulations dispatch only still-registered handlers.

Validation: 51 focused worker tests pass on current main, including pressure
and custody composition. Both exit-event regressions fail with the original
listeners. Independent autoreview found no actionable issues.

* fix(sessions): preserve recovery when stopping repeated exit cleanup

* fix(sessions): reconcile exit cleanup with current main

Preserve one-shot automatic SQLite exit cleanup and explicit recovery of retained worker custody. Include the reviewed checkout fixture single post-handler publication and current main's canonical archive-placement repair from #155751.

* test(ci): integrate canonical fixture repairs

Merge current main with the memory candidate synchronization fix from #155745 and archive lifecycle request settlement from 94b9c47. Preserve the reviewed six-file SQLite exit cleanup and checkout fixture delta without further source changes.

Co-authored-by: Peter Steinberger <[email protected]>
steipete added a commit that referenced this pull request Sep 23, 2026
* fix(cli): avoid readiness waits for absent Gateways

Local-only agent environments should report an unavailable Gateway promptly instead of spending the full startup budget. Let diagnostics use the existing readiness owner to confirm that the selected service, port listener, current lease, and validated legacy lock are absent.

Preserve native and foreground startup grace, published lock-based Gateway ownership, inspection and cleanup errors, and replacement handoffs. Start, restart, and updater callers retain their existing wait policy.

* fix(cli): report confirmed Gateway absence promptly

Use native service absence and runtime facts before taking the diagnostic-only missing-service path. Preserve unknown managers, current and legacy Gateway owners, selected-target matching, and shared deadline and cleanup behavior.

* test(cli): expose swallowed late cleanup errors

Reject the late legacy-owner lookup once so a later lookup cannot hide the loss of the original cleanup error.

* chore: refresh Gateway diagnostic readiness on main

Include the canonical memory candidate fixture repair from #155745.
Preserve the reviewed five-file diagnostic change exactly.

* fix(cli): preserve startup handoff within diagnostic deadlines

Consult the canonical startup migration lease before reporting a missing
Gateway, and retain observed migration activity across the lease-to-owner
handoff for this readiness wait.

Use the shared deadline owner for numeric diagnostic budgets, returning the
last diagnostic snapshot only for its own expiry while joining process cleanup.
Keep lifecycle callers on their existing throwing policy.

The four new entry-point regressions fail on the prior public code. The
strengthened migration handoff also fails on the first repair. The final
candidate passes 353 focused cases, and independent P2 review is clean.

The complete selected 31-check gate passed, including all 25 test type graphs.

* fix(cli): preserve migration grace for missing service units

Keep missing-service diagnostics on the authoritative absence decision through
all stopped/free observations. Native stopped/missing-unit snapshots retain
migration and legacy-owner uncertainty until the diagnostic deadline.

Extend the adapter cases beyond the generic early-exit threshold and preserve
the default lifecycle missing-unit timing. The three strengthened rows fail
on the previous public head at 12.5 seconds.

Qualified 355 distinct cases pass, along with all 31 selected checks and 25
test type graphs. The lifecycle fixture uses the real service interface, and
fresh independent P2 review is clean.

* fix(cli): carry diagnostic deadlines through native inspection

* chore: refresh Gateway diagnostic readiness on canonical main

Preserve the complete fc6487d readiness and native-deadline patch while
integrating canonical backup recovery and CI export repairs.

The candidate passes 254 focused tests, selected type/lint checks, and
independent P2 review. Original ordered timeout reproduction remains
unrun because its matching resource capacity is unavailable.

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
* fix(tasks): throttle unchanged attempt activity

* test(tasks): keep fence checkpoint executor void

* test(memory): synchronize candidate repair worker completion

* test(ci): restore gateway typecheck headroom
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
)

* fix(sessions): stop repeated failed worker exit cleanup

Use one-shot process-exit cleanup for retained reclamation workers and the
canonical validation pool. A rejected asynchronous close previously kept its
beforeExit listener, so each drained event loop repeated the same cleanup and
could prevent CLI and QA commands from exiting.

Keep failed database resource ownership and explicit close retries intact.
The existing native-worker tests cover failed idle memory-pressure cleanup,
repeated pressure, one exit cleanup attempt, and explicit receipt recovery.
Exit simulations dispatch only still-registered handlers.

Validation: 51 focused worker tests pass on current main, including pressure
and custody composition. Both exit-event regressions fail with the original
listeners. Independent autoreview found no actionable issues.

* fix(sessions): preserve recovery when stopping repeated exit cleanup

* fix(sessions): reconcile exit cleanup with current main

Preserve one-shot automatic SQLite exit cleanup and explicit recovery of retained worker custody. Include the reviewed checkout fixture single post-handler publication and current main's canonical archive-placement repair from openclaw#155751.

* test(ci): integrate canonical fixture repairs

Merge current main with the memory candidate synchronization fix from openclaw#155745 and archive lifecycle request settlement from 5f027d8. Preserve the reviewed six-file SQLite exit cleanup and checkout fixture delta without further source changes.

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
)

* fix(cli): avoid readiness waits for absent Gateways

Local-only agent environments should report an unavailable Gateway promptly instead of spending the full startup budget. Let diagnostics use the existing readiness owner to confirm that the selected service, port listener, current lease, and validated legacy lock are absent.

Preserve native and foreground startup grace, published lock-based Gateway ownership, inspection and cleanup errors, and replacement handoffs. Start, restart, and updater callers retain their existing wait policy.

* fix(cli): report confirmed Gateway absence promptly

Use native service absence and runtime facts before taking the diagnostic-only missing-service path. Preserve unknown managers, current and legacy Gateway owners, selected-target matching, and shared deadline and cleanup behavior.

* test(cli): expose swallowed late cleanup errors

Reject the late legacy-owner lookup once so a later lookup cannot hide the loss of the original cleanup error.

* chore: refresh Gateway diagnostic readiness on main

Include the canonical memory candidate fixture repair from openclaw#155745.
Preserve the reviewed five-file diagnostic change exactly.

* fix(cli): preserve startup handoff within diagnostic deadlines

Consult the canonical startup migration lease before reporting a missing
Gateway, and retain observed migration activity across the lease-to-owner
handoff for this readiness wait.

Use the shared deadline owner for numeric diagnostic budgets, returning the
last diagnostic snapshot only for its own expiry while joining process cleanup.
Keep lifecycle callers on their existing throwing policy.

The four new entry-point regressions fail on the prior public code. The
strengthened migration handoff also fails on the first repair. The final
candidate passes 353 focused cases, and independent P2 review is clean.

The complete selected 31-check gate passed, including all 25 test type graphs.

* fix(cli): preserve migration grace for missing service units

Keep missing-service diagnostics on the authoritative absence decision through
all stopped/free observations. Native stopped/missing-unit snapshots retain
migration and legacy-owner uncertainty until the diagnostic deadline.

Extend the adapter cases beyond the generic early-exit threshold and preserve
the default lifecycle missing-unit timing. The three strengthened rows fail
on the previous public head at 12.5 seconds.

Qualified 355 distinct cases pass, along with all 31 selected checks and 25
test type graphs. The lifecycle fixture uses the real service interface, and
fresh independent P2 review is clean.

* fix(cli): carry diagnostic deadlines through native inspection

* chore: refresh Gateway diagnostic readiness on canonical main

Preserve the complete fc6487d readiness and native-deadline patch while
integrating canonical backup recovery and CI export repairs.

The candidate passes 254 focused tests, selected type/lint checks, and
independent P2 review. Original ordered timeout reproduction remains
unrun because its matching resource capacity is unavailable.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core 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