Skip to content

perf: prepare worker trajectory payloads only for recorded events - #138086

Merged
steipete merged 1 commit into
mainfrom
codex/perf8-worker-trajectory
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf8-worker-trajectory

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Worker live events prepared a second diagnostic payload even for phases the trajectory does not record. Move that preparation into the existing recording branches and remove the recorded flag, while retaining the separate live-delivery copy and unchanged stored rows/flush behavior.

Production LOC is unchanged (+17/−17); tests add 14 lines to protect live-listener versus stored-result independence. The fixed 18-case actual projection/SQLite corpus preserves all 16 stored rows, metadata, order and flush counts, while skipped phases remove one observed structuredClone call each. The full receiver suite passes 40 tests on both original and candidate. No timing or retained-memory claim; real deployed-worker proof is outside this local synthetic-event scope. Managed P0–P2 review is scoped-clean, and the full canonical changed-file gate passed.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 4, 2026, 10:38 AM ET / 14:38 UTC.

ClawSweeper review

What this changes

The PR prepares worker trajectory diagnostic payloads only for event phases that are recorded, while testing that live-listener mutation cannot change the stored diagnostic result.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this maintainer-authored PR open. The patch correctly removes unnecessary diagnostic payload preparation while preserving live delivery, trajectory rows, terminal handling, and SQLite flush behavior; the protected maintainer label still requires human handling before merge.

Priority: P3
Reviewed head: 9a93b704754167626d6c0f09917651086ed1402b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused net-neutral patch preserves the receiver-to-recorder boundary and has meaningful integration coverage with no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR changes an internal diagnostic projection; the receiver-to-SQLite integration test is relevant supplemental evidence, while the external-contributor real-setup proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR changes an internal diagnostic projection; the receiver-to-SQLite integration test is relevant supplemental evidence, while the external-contributor real-setup proof gate does not apply.
Evidence reviewed 7 items Introduced projection change: The introduced patch moves preparation into exactly the existing branches that call the recorder, leaving unrecorded tool updates, assistant/thinking events, and non-definitive lifecycle phases as early returns.
Current-main behavior: Fetched current main still prepares the trajectory payload before determining whether the event is recorded, so this focused optimization is not already implemented on main.
Receiver and recorder boundary: The receiver prepares and synchronously emits a listener-facing copy before passing the untouched worker event to the trajectory projection; the recorder then sanitizes, bounds, queues, and flushes only recorded rows.
Findings None None.
Security None None.

How this fits together

Worker live events are delivered to runtime listeners and separately projected into trajectory diagnostics. The projection filters recordable phases, sanitizes an independent payload, and writes the resulting rows to SQLite-backed trajectory storage.

flowchart LR
  A[Worker live event] --> B[Live event receiver]
  B --> C[Runtime listener delivery]
  B --> D[Trajectory projection]
  D --> E{Recordable phase?}
  E -->|Yes| F[Prepared diagnostic payload]
  F --> G[Trajectory recorder]
  E -->|No| H[No trajectory preparation]
  C --> I[Runtime consumers]
Loading

Before merge

  • Complete next step (P2) - Complete the protected maintainer-label review after exact-head required checks are green.
Agent review details

Security

None.

PR surface

Source 0, Tests +14. Total +14 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 17 0
Tests 1 15 1 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 32 18 +14

Review metrics

Metric Value Why it matters
Production versus tests production +0 net (17 added, 17 removed); tests +14 net The production refactor is net-neutral, and the test addition protects the listener-versus-persisted-diagnostic isolation boundary.

Technical review

Best possible solution:

Land the net-neutral projection refactor after the protected maintainer review and exact-head required checks; it keeps the recorder as the sole owner of trajectory preparation without altering the live-event path.

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

Yes, at source level: the receiver always sends a prepared live payload, then current main prepares a second payload even for phases the trajectory projection intentionally does not store.

Is this the best way to solve the issue?

Yes. The existing trajectory projection owns the recordability decision, so moving its existing preparation calls into record-producing branches is the narrowest maintainable fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 523221e3767f.

Labels

Label justifications:

  • P3: This is a small internal performance improvement that preserves the existing trajectory event contract.
  • 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: This MEMBER-authored PR changes an internal diagnostic projection; the receiver-to-SQLite integration test is relevant supplemental evidence, while the external-contributor real-setup proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (4 earlier review cycles)
  • reviewed 2026-09-04T08:34:24.773Z sha 12f619f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T09:08:55.940Z sha 12f619f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T10:47:49.960Z sha 1641f26 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T12:39:22.697Z sha c6b84ab :: needs changes before merge. :: none

@steipete
steipete force-pushed the codex/perf8-worker-trajectory branch 2 times, most recently from 1641f26 to c6b84ab Compare September 4, 2026 12:28

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good boundary cleanup. Preparing the diagnostic copy only for recorded phases removes unused work while the separate live-listener copy still prevents mutation from contaminating persisted trajectory rows.

@steipete
steipete force-pushed the codex/perf8-worker-trajectory branch from c6b84ab to 9a93b70 Compare September 4, 2026 14:12
@steipete
steipete merged commit a66263c into main Sep 4, 2026
175 checks passed
@steipete
steipete deleted the codex/perf8-worker-trajectory branch September 4, 2026 15:05
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…9-prep

* commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits)
  perf(ui): coalesce automation event refreshes (#138065)
  fix: reject incomplete Skill Workshop directory reads (#138082)
  test(ui): decouple rendering checks from generated wording (#138283)
  perf: avoid temporary entries in bounded JSON traversal (#138017)
  fix(irc): render complete messages before splitting (#138328)
  perf: prepare worker trajectory payloads only for recorded events (#138086)
  fix(mcp): paginated listings no longer time out after a forward clock step (#137206)
  fix(codex): page native transcripts and bound UI previews (#136282)
  feat(gateway): apply more settings without restarting (#138112)
  fix(docs): preserve mirrored ClawHub maturity links (#138241)
  fix(test): own UI animation and legacy database setup (#138296)
  fix(tts): preserve literal directives in Markdown code (#138319)
  fix: load chat widgets behind authenticated gateways (#138074)
  chore(ui): cover native approval finalization (#137259)
  fix(cron): cancel conditions before main-session handoff (#138313)
  fix(backup): preserve text after embedded NUL characters (#138327)
  fix(android): align composer control sheets (#137442)
  fix(ci): wait for replacement PR runs instead of stale failures (#138307)
  fix(sessions): keep Gateway responsive with long transcripts (#138094)
  fix(computer): map window inputs to delivered image coordinates (#138271)
  ...

# Conflicts:
#	scripts/release-check.ts
#	test/release-check.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants