Skip to content

fix: terminal lifecycle tests fail during module loading - #180156

Merged
shakkernerd merged 1 commit into
mainfrom
terminal-lifecycle-event-mock
Oct 22, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
terminal-lifecycle-event-mock

Conversation

@shakkernerd

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a terminal lifecycle test suite that fails during module loading before any of its behavior assertions can run. The suite replaced the complete agent-event module to observe one emitter, so runtime code imported by the same test could not register its required lifecycle-rotation cleanup handler.

User Impact

There is no user-visible or runtime behavior change. Contributors regain reliable coverage for terminal publication, retry selection, and sanitized failure messages, while the production lifecycle-rotation contract remains active inside the fixture.

Why This Change Was Made

The fixture now passes the real agent-event module through and overrides only emitAgentEvent, the function its assertions inspect. This follows the repository's export-complete mock pattern and avoids a lifecycle stub or production-only test seam. The matching grandfathered closed-mock entry is removed from the shrinking ratchet; no other baseline entry or assertion changes.

Evidence

Scheduled run 39703131373 failed the target suite before collection with the missing registerAgentEventLifecycleRotationHandler export, while 924 other tests passed in that job.

On the exact two-file candidate:

  • changed formatting and source lint passed;
  • all seven selected affected type-check groups passed;
  • the mock-export ratchet passed with exactly the repaired baseline row removed; and
  • src/auto-reply/reply/agent-lifecycle-terminal.test.ts collected and passed all 10 existing cases in 38.52 seconds.

Hosted CI and exact-head review continue on the published commit.

@clawsweeper

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

@shakkernerd shakkernerd self-assigned this Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves real agent-event exports while mocking the emitter and removes the corresponding closed-mock baseline exemption.

Example: Collect agent-lifecycle-terminal.test.ts.

  • Before: The emitter-only module mock omits registerAgentEventLifecycleRotationHandler, preventing imported lifecycle owners from initializing.
  • After: The real registration export remains available while emitAgentEvent stays observable by the 10 existing test cases.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test repair supported by source inspection and green exact-head checks; evidence is limited to test execution rather than a shipped entry point.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test fixture repair changes no shipped behavior; the reported focused pass and successful exact-head checks support the collection repair.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Contributors cannot run terminal lifecycle assertions because their fixture fails during module loading.
Reason: The maintainer-authored direction restores existing coverage while retaining production lifecycle ownership and all assertions.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a broken test fixture with a minimal change, preserves every existing assertion, and has no actionable review findings.

Priority: P3
Reviewed head: 377447af0115a9eccb1c95e5dfb46f26fff93240

Before merge

None.

Findings

None.

Agent review details

How this fits together

The terminal lifecycle backstop converts attempt outcomes into agent events; this fixture intercepts event emission to verify terminal selection and sanitized errors.

flowchart TD
  A[Terminal lifecycle test] --> B[Export preserving event mock]
  B --> C[Real lifecycle registration]
  A --> D[Terminal lifecycle backstop]
  D --> E[Mocked event emitter]
  E --> F[Existing assertions]
Loading

Technical review

Best possible solution:

Preserve the real event module, override only the observed emitter, and remove its obsolete baseline exemption.

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

Source confirms that the original factory replaces every export except emitAgentEvent while runtime dependencies require lifecycle registration during import; no target code was executed during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete repair: it follows the existing export-completeness recipe, preserves the intended emitter observation, and adds no lifecycle stub or production test seam.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Terminal lifecycle event mock keeps the original intent (ef5e853: The original fixture observed terminal publication to verify bounded authentication recovery and prevent private diagnostic leakage.)
  • Closed-mock baseline exemption keeps the original intent (unknown: The ledger grandfathers exact factories lacking real-module pass-through; its header, checker, and documentation require obsolete entries to shrink, although the older introduction blob was unavailable.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit ef5e853 adds src/auto-reply/reply/agent-lifecycle-terminal.test.ts:6 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ef5e85385236; files: src/auto-reply/reply/agent-lifecycle-terminal.test.ts)
  • Shakker: Raw commit 7e73a8a adds src/auto-reply/reply/agent-lifecycle-terminal.test.ts:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7e73a8a89ae6; files: src/auto-reply/reply/agent-lifecycle-terminal.test.ts)
  • Peter Steinberger: Raw commit 7aafd47 adds src/auto-reply/reply/agent-lifecycle-terminal.test.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7aafd47b1c30; files: src/auto-reply/reply/agent-lifecycle-terminal.test.ts)

PR surface

Tests +3, Other -1. Total +2 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 4 1 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 2 4 2 +2

Labels

Label changes:

  • add P3: This restores contributor test coverage without changing shipped runtime behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This restores contributor test coverage without changing shipped runtime behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 21, 2026, 10:11 PM ET / October 22, 2026, 02:11 UTC.

@shakkernerd
shakkernerd merged commit 18ba6d5 into main Oct 22, 2026
130 checks passed
@shakkernerd
shakkernerd deleted the terminal-lifecycle-event-mock branch October 22, 2026 02:18
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Terminal lifecycle tests now preserve the real lifecycle-rotation contract while exercising terminal event assertions.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
Terminal lifecycle tests now preserve real agent-event lifecycle registration while observing emitted terminal events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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