Repository navigation
refactor(agents): centralize typed activity event emission - #122188
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
a3cda68 to
1a11c68
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 4:09 PM ET / 20:09 UTC. ClawSweeper reviewWhat this changesThe PR replaces four internal agent-activity event wrappers with one stream-discriminated typed emitter, migrates their callers, and adds owner-level event-bus coverage. Merge readinessNo blocking correctness finding: current main still has the duplicated activity wrappers, while this maintainer-owned PR cleanly centralizes them. Wait for the remaining exact-head checks before landing. Priority: P3 Review scores
Verification
How this fits togetherAgent tool and run lifecycle code emits item, approval, command-output, and patch activity to a shared event bus. The gateway then enriches, sequences, and dispatches those events to subscribers and operator-facing activity surfaces. flowchart LR
A[Tool and run lifecycle] --> B[Typed activity emitter]
B --> C[Shared agent event bus]
C --> D[Sequence and context enrichment]
D --> E[Gateway subscribers]
E --> F[Operator activity surfaces]
Decision needed
Why: The PR author is a repository member and the item carries the maintainer label, so automated cleanup must not close or merge it without maintainer judgment. Before merge
Agent review detailsSecurityNone. PR surfaceSource -28, Tests +105. Total +77 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the canonical typed emitter once exact-head required checks are green, preserving the event-bus sequencing and callback boundaries already exercised by the focused proof. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an existing internal event-emission path rather than repairing a reported user-facing failure. Is this the best way to solve the issue? Yes: the map-discriminated emitter sits at the shared event owner, removes duplicate wrapper policy, and retains the existing event-bus contract at every caller. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 09c39e0ec528. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
…-prep * commit 'edb7a1692e58d78ff7e196db39ea8eff297b2e19': (1351 commits) fix(telegram): expose live location updates to hooks (openclaw#122185) fix(ui): remove the pre-creation session row (openclaw#122259) fix(openai): surface failed realtime response outcomes (openclaw#121177) fix(logging): publish diagnostics ZIP through staged atomic overwrite (openclaw#122130) test(cli): trim duplicate MCP probe process cases (openclaw#122260) feat(agents): replay persisted native video (openclaw#122257) fix(test): serialize default e2e runner (openclaw#122203) fix(ui): always show full assistant responses (openclaw#122207) feat(mcp): per-requester OAuth for MCP servers (openclaw#122166) fix(ui): preserve focus on composer accessory clicks (openclaw#122243) fix(backup): exclude state temp files (openclaw#122250) fix(browser): let attached workers exit after CDP use (openclaw#122103) test(cli): trim duplicate Claw authoring process cases (openclaw#122248) refactor(outbound): inline delivery diagnostics (openclaw#122219) refactor: eliminate final wrapper-shadowing hazards (openclaw#122157) fix(ui): keep new-session identity anchored (openclaw#122242) test(cli): trim duplicate gateway process cases (openclaw#122240) fix(media): decode local file URLs safely (openclaw#122192) refactor(agents): centralize typed activity event emission (openclaw#122188) fix(ui): effort slider matches selected level after model switches (openclaw#122125) ...
What Problem This Solves
Agent activity emission duplicated the same shared-bus plumbing across four semantic wrappers. That repeated run/session forwarding, payload casting, and bus dispatch while making stream/payload pairing depend on which wrapper a caller happened to choose.
Why This Change Was Made
The agent activity owner now exposes one mapped-discriminated-union emitter. Its
streamliteral selects the exact allowed payload type, all existing callers use that canonical path, and the four duplicate wrappers are removed. Callback emissions remain separate because their best-effort failure semantics differ from the global bus.Architectural closeout:
src/infra/agent-activity-events.ts.emitAgentActivityEvent({ runId, sessionKey?, stream, data }).User Impact
No user-visible behavior change. Agent item, approval, command-output, and patch events keep the same payloads, ordering, session routing, and operator-visible activity.
Evidence
Exact head:
1a11c684cdd861fdfd5befbba1d7450aa756830eLocal focused proof:
pnpm check:test-types: core, extension, and root test programs passed.git diff --check: passed.Remote proof:
tbx_01kzs162ctntwq15j2ygwx11zw, Actions run31522684684, exit 0.tbx_01kzs43kk7hqjwzrxmxsb5c3na, Actions run31527072635, job93897908795; 229 focused tests andpnpm check:test-typespassed, workflow conclusion success.cbx_cbff05a9e647, runrun_5f1849151da8, exit 0. The private-QA packaged build passed; the builtemitAgentActivityEventhelper emitted ordereditem,approval,command_output, andpatchevents with sequence 1-4, session omission, and payload identity preserved; built CLI and launcher version smoke passed.31526043249; no code findings. Its proof-only rank-up move is satisfied by the fresh green focused Testbox and AWS helper-level runtime proof above.