Skip to content

test(subagents): consolidate subagent-announce.format.e2e.test.ts - #166052

Merged
steipete merged 1 commit into
mainfrom
steipete/deslop-restart-t-announce-format-20261006
Oct 6, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/deslop-restart-t-announce-format-20261006

Conversation

@steipete

@steipete steipete commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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.

Deleted or merged case Remaining coverage
includes success status when outcome is ok keeps full findings and includes compact stats now also checks the same success label
announces tokens unknown when child usage never landed on the real session store; announces a genuine zero-usage reading from the real session store announces $name usage from the real session store, absent/zero rows with original positive and negative assertions
hands 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_REPLY handles $name NO_REPLY completion, all three original inputs and delivery counts
retries 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 exhaustion direct agent announce $name, original errors/routes, exact attempt counts and dispositions
carries 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 sessions preserves a producer route fact for a $name, exact result/route and audience-specific instructions
prefers requesterOrigin channel over stale session lastChannel in direct announce direct announce: prefers requesterOrigin over stale stored channel, including original collect-mode stored entry
Duplicate success-format instruction checks sends instructional message to main agent with status and findings
Ignored/requester-fallback internal lookup shapes Original ignore and missing-fallback cases retain no-delivery and no-cleanup assertions

The 35% target is not met. The outer subagent announce formatting block 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 nested subagent announce regression matrix for nested completion delivery keeps 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, profile openclaw-check, lease tbx_01m485j1fctgtmxhkd0w5st1aw; Testbox run. Source baseline: 355655951c77ccdcfb3426a6badc47a24019ecc9.

Measurement Before After
File lines 2,299 1,998
Tests 63 passed 62 passed
pnpm test <file> --maxWorkers=1 wall time, prepared runtime 15.17 s 14.07 s
Vitest test-body time 3.896 s 3.271 s

Reported 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=1 on the same lease after successful standard E2E preparation. The initial unmodified pnpm test src/agents/subagents/announce/subagent-announce.format.e2e.test.ts --maxWorkers=1 also 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.

Mutated behavior Test that caught it
Report unknown usage as zero announces absent usage from the real session store
Ignore delivery-target hook overrides All three uses the hook-provided thread target with requester thread %s rows: 777, undefined, 999
Announce before pending descendants settle nested completion chains re-check child then parent deterministically and defers a synthesis wake until both children settle

Independent 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_MS in extensions/voice-call/src/webhook/realtime-call-session-control.ts and loadManifestModelCatalog in src/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.mjs passed the selected format, ratchet, boundary, and core-test typecheck stages, then exited 1 at the broad unused-export audit. Running node --import tsx scripts/check-deadcode-exports.mts with 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, including openclaw/ci-gate, on a2f147ef18d00ee40ffc87da85c7e92ce797cf47. 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.

@clawsweeper

clawsweeper Bot commented Oct 6, 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.

@steipete
steipete marked this pull request as ready for review October 6, 2026 09:31
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL labels Oct 6, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 6, 2026
@clawsweeper

clawsweeper Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 5:48 AM ET / 09:48 UTC (Revision 2).

ClawSweeper review

What this changes

Consolidates 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
Reviewed head: a2f147ef18d00ee40ffc87da85c7e92ce797cf47

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused consolidation has a clear coverage mapping, mutation sanity evidence, and successful exact-head CI with no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a trusted MEMBER author, so contributor runtime proof is exempt. This changes fixtures around the existing announcement flow; reported suite and mutation runs are supplemental validation, and no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a trusted MEMBER author, so contributor runtime proof is exempt. This changes fixtures around the existing announcement flow; reported suite and mutation runs are supplemental validation, and no stored-data contract changes.
Evidence reviewed 7 items Pinned introduction scope: The merge-base-to-head diff changes only the announcement-format test. It removes forwarding mocks and the Proxy lookup, shares fixtures, and consolidates equivalent scenarios without modifying production owners.
Retained behavioral coverage: Read the complete final test file and introduced hunks. Absent versus zero usage still uses the real session reader; hook event/context and destination assertions remain; nested ordering, cancellation after accepted wake, pending-to-settled fan-out, and failed-child synthesis remain distinct tests.
Current-main necessity: The test file is unchanged between the pinned merge base and fetched main, so this consolidation has not already landed. The earlier merged cleanup at #165999 supplies the baseline rather than superseding this additional work. No release containing the proposed head was returned by the tag check.
Findings None None.
Security None None.

How this fits together

Subagent 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -301. Total -301 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 462 763 -301
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 462 763 -301

Review metrics

Metric Value Why it matters
Reported test cost Warm median 15.17 → 14.07 s; changed-test CI job 276 s The body discloses preparation separately, and overlapping timing ranges support only a modest performance claim.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is test-maintenance cleanup with no production behavior change or urgent user impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a trusted MEMBER author, so contributor runtime proof is exempt. This changes fixtures around the existing announcement flow; reported suite and mutation runs are supplemental validation, and no stored-data contract changes.

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)
  • vincentkoc: 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 (1 earlier review cycle)
  • reviewed 2026-10-06T09:37:38.384Z sha a2f147e :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 86e2107 into main Oct 6, 2026
184 of 185 checks passed
@steipete
steipete deleted the steipete/deslop-restart-t-announce-format-20261006 branch October 6, 2026 09:52
@steipete

steipete commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 6, 2026
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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
…, 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL 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