Repository navigation
test(subagents): consolidate subagent-announce.format.e2e.test.ts - #166052
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: needs maintainer review before merge. Reviewed October 6, 2026, 5:48 AM ET / 09:48 UTC (Revision 2). ClawSweeper reviewWhat this changesConsolidates subagent announcement tests with typed fixtures and case tables while preserving checks for output, routing, retries, cancellation, and nested completion ordering. Merge readiness✅ Ready for maintainer review Keep open: the consolidation remains useful and is absent from current main. No actionable correctness or security defect was found; the distinct regression scenarios remain covered. Priority: P3 Review scores
Verification
How this fits togetherSubagent announcements carry completed child results back to the requesting agent or conversation. This test suite exercises result recovery, destination selection, and parent continuation through the production announcement flow with controlled Gateway responses. flowchart TD
A[Child completion] --> B[Result and session readers]
B --> C[Announcement flow]
D[Routes and hook overrides] --> C
C --> E{Descendants settled?}
E -->|No| F[Defer completion]
E -->|Yes| G[Continue parent or deliver result]
G --> H[Test output and lifecycle assertions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -301. Total -301 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the consolidated suite while retaining its real session-reader checks and distinct nested lifecycle regressions. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing tests rather than repairing a reported runtime defect. Is this the best way to solve the issue? Yes: small typed fixtures and tables remove repetition while preserving distinct observable scenarios and avoiding production changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1e8b7a3623bc. LabelsLabel changes: No label 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.
|
Frozen upstream: 10334ec (previous base 14fe10d). Nine conflicts, resolved hunk by hunk: - config-baseline.counts.json, worker-access-inventory.md: upstream's copy; regenerated in follow-up commits. - agent-runner-run.ts: keep the feature's bindVisiblePartialReplyObserver; re-apply upstream's always-present runId (openclaw#165733). - agent-runner-result-payloads.ts: drop upstream-removed stale "drain" comment; keep queued-delegate counts. - session-accessor.sqlite-lifecycle.ts: add upstream's captureIncognitoSessionOperation import; history maintenance stays in the feature's sibling module; drop upstream-removed jsdoc. - openclaw-agent-db-lifecycle.ts: upstream's validation-cache imports (get/invalidate) replace hasRevoked. - doctor-health.migration-refusal.test.ts: both sides added the same maintenance facts; keep the typed one. - get-reply-run.media-only.test.ts: helpers stay in the continuation test-support; upstream's expectDefined form re-homed there. - subagent-announce.format.e2e.test.ts: upstream's call.params form + feature continuationTrigger assertion and omitted-trigger case; matrix stays in the feature's nested-matrix test-support; drop redundant embedded-run mock resets (upstream consolidation openclaw#166052). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
…, batch 2) Restores the remaining small Gate 2.7 drops from the lane-base review; continuation behavior is unchanged. Taken from upstream verbatim (the fork hunks had no continuation content): host-tool-factory.ts (public test-contract helper; its re-entry guard can no longer fire), codex side-question.test-support.ts, doctor-health.migration-refusal.test.ts, board-notices.ts (no Raw alias), channel-ingress-gateway-restart fixture (parent test owns the timeout). Ported into fork forms: - session-event-wake.types.ts: HeartbeatWakeRequest/HeartbeatRunResult instead of the aliases upstream deleted in openclaw#167666; upstream's base-tick comment back above the slot-group loop. - session-delivery-queue-codec.ts: SessionDeliveryContext = Pick<DeliveryContext, ...> (openclaw#165916); recovery imports split as upstream. - subagent-announce.format nested-matrix helper: upstream's consolidated block (openclaw#166052) verbatim; the fork copy still ran 4 tests upstream retired in openclaw#165177. - runAgentAttempt is synchronous again (its only caller awaits it), with upstream's sync-throw assertion. - prepared-compaction-runtime: upstream's bootstrap-disclosure comment; dropped tool options duplicated from the conversationContext spread (senderIsOwner and disableContinuationTools stay). - agent-runner-result-accounting.test: one provenance it.each at module scope, stale visibleToolErrorObserved (openclaw#126542) dropped. - small: subagent-registry arrow form, STALE_UNENDED_SUBAGENT_RUN_MS not exported, dead loadConfig mock keys, upstream comments/imports in agent.ts schema, media-only/session/timeout/followup-status/storage tests. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Consolidates repeated announce-format test setup and equivalent case bodies without changing production code.
User Impact
No user-visible behavior change. This is the test-only consolidation; all issue #18037 rows, real SQLite session-store reads, exact-run transcript recovery, descendant ordering, cancellation and retry behavior remain covered.
Why This Change Was Made
Remove the forwarding mock layer for embedded runs and hooks, replace the session-store Proxy with a typed lookup, and share small completion/wake/session fixtures. Combine usage, NO_REPLY, retry and route-policy variants into tables. Keep assertions on delivered output, route, lifecycle and cleanup; remove redundant internal-read call-shape checks.
Measurement: 2,299 → 1,998 lines, net −301 (13.1%). Shared support files are unchanged; no exclusive support files exist. Production LOC delta: 0, as required by this test-only wave. The launch estimate was 2,714; the actual pinned baseline already contains #165999's earlier consolidation.
includes success status when outcome is okkeeps full findings and includes compact statsnow also checks the same success labelannounces tokens unknown when child usage never landed on the real session store;announces a genuine zero-usage reading from the real session storeannounces $name usage from the real session store, absent/zero rows with original positive and negative assertionshands required NO_REPLY completion to the parent as missing output;keeps non-required NO_REPLY completion intentionally silent;uses fallback reply when wake continuation returns NO_REPLYhandles $name NO_REPLY completion, all three original inputs and delivery countsretries completion direct agent announce on transient channel-unavailable errors;does not retry completion direct agent announce on permanent channel errors;retries direct agent announce on fallback cooldown exhaustiondirect agent announce $name, original errors/routes, exact attempt counts and dispositionscarries a producer route fact to a local parent without changing child result text;keeps completion delivery enabled for extension channels captured from requester origin;keeps completion-mode announce internal for nested requester subagent sessionspreserves a producer route fact for a $name, exact result/route and audience-specific instructionsprefers requesterOrigin channel over stale session lastChannel in direct announcedirect announce: prefers requesterOrigin over stale stored channel, including original collect-mode stored entrysends instructional message to main agent with status and findingsThe 35% target is not met. The outer
subagent announce formattingblock retains the production flow composition across real SQLite, transcript recovery, route precedence, hook/binding resolution, silent output, retries, idempotency and nested ownership; their distinct inputs cannot be deleted based on lower-level tests. The nestedsubagent announce regression matrix for nested completion deliverykeeps the pending→settled two-child transition and failed-child synthesis because neither is equivalent to a formatting-only test. Further collapse would hide those state transitions in a general-purpose fixture or discard coverage.Evidence
Provider:
blacksmith-testbox, profileopenclaw-check, leasetbx_01m485j1fctgtmxhkd0w5st1aw; Testbox run. Source baseline:355655951c77ccdcfb3426a6badc47a24019ecc9.pnpm test <file> --maxWorkers=1wall time, prepared runtimeReported warm times are medians of three alternating before/after runs after one warmup of each version (before range 14.53–15.87 s; after 13.61–16.06 s). All runs passed. Both versions used
OPENCLAW_E2E_USE_PREBUILT_DIST=1on the same lease after successful standard E2E preparation. The initial unmodifiedpnpm test src/agents/subagents/announce/subagent-announce.format.e2e.test.ts --maxWorkers=1also passed all 63 tests in 1,071.45 s, including the 16-minute cold runtime build; that setup cost is not counted as a consolidation speedup.Mutation sanity ran the entire consolidated suite with
node scripts/run-vitest.mjs src/agents/subagents/announce/subagent-announce.format.e2e.test.ts --maxWorkers=1, one temporary production mutation at a time. Every mutant exited 1 and the original source was restored before the changed gate.announces absent usage from the real session storeuses the hook-provided thread target with requester thread %srows:777,undefined,999nested completion chains re-check child then parent deterministicallyanddefers a synthesis wake until both children settleIndependent Codex autoreview: scoped-clean at P0–P2 after restoring the hook event/context assertion flagged by its first pass. The broad unused-export audit identified two inherited findings outside this lane:
OUTBOUND_GREETING_FALLBACK_MSinextensions/voice-call/src/webhook/realtime-call-session-control.tsandloadManifestModelCataloginsrc/agents/model-catalog.runtime.ts. The former constant is used inside its module; the finding concerns its export. Production code remains unchanged. No shared support files changed.node scripts/check-changed.mjspassed the selected format, ratchet, boundary, and core-test typecheck stages, then exited 1 at the broad unused-export audit. Runningnode --import tsx scripts/check-deadcode-exports.mtswith this test restored to the untouched Git baseline reproduced both findings and exit 1. Earlier fixture type errors were corrected and the affected typecheck passed. The inherited audit is retained as a reported gap; no guard was disabled.Final targeted lint passed with zero warnings/errors:
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/subagents/announce/subagent-announce.format.e2e.test.ts. The final-byte changed check again passed its selected format, ratchet, boundary and typecheck stages, then reported only the same two inherited unused exports. The final review was followed only by the mechanical property-shorthand lint correction.After stopping the lease, rebased the single test-only commit onto
f997ec3775567f942585d729346628adf3466edb; the test blob and relevant announce production owners were unchanged by that base advance. Published candidate:a2f147ef18d00ee40ffc87da85c7e92ce797cf47. Testbox measurements remain pinned to their recorded baseline; Exact-head GitHub CI passed, includingopenclaw/ci-gate, ona2f147ef18d00ee40ffc87da85c7e92ce797cf47. The selected changed-test job passed in 276 s; its Node test-shard step took 107 s. Required checks are green. The PR remains open with auto-merge disabled.