Skip to content

test(runtime-host): verify remote service restart - #3186

Merged
M4n5ter merged 1 commit into
mainfrom
test/runtime-host-remote-lifecycle-closure
Aug 18, 2026
Merged

test(runtime-host): verify remote service restart#3186
M4n5ter merged 1 commit into
mainfrom
test/runtime-host-remote-lifecycle-closure

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

English

Adds one service-level integration journey for the remaining Runtime Host production-hardening gap. An authenticated remote profile now proves it can reconnect after the real WebSocket service restarts with a new Host epoch and read the canonical Session created before restart.

This is a test-only change. It composes the existing profile connector, credential authority, reconnect lifecycle, Root identity, and durable Session state without duplicating Domain behavior suites per transport.

简体中文

为 Runtime Host 剩余的生产强化缺口增加一条 service-level 集成 journey。经过认证的远程 profile 会在真实 WebSocket service 以新 Host epoch 重启后重新连接,并读取重启前创建的 canonical Session。

本 PR 只修改测试。它组合验证现有 profile connector、credential authority、reconnect lifecycle、Root identity 与持久 Session 状态,不会按 transport 重复 Domain 行为测试。

Fixes #2522

Verification

English
  • Runtime Host full suite: 963 passed
  • New restart journey: 8 parallel repetitions passed
  • Runtime Host typecheck
  • Biome check and git diff --check
  • Required CI, including Windows recovery and baseline
简体中文
  • Runtime Host 全量测试:963 passed
  • 新增重启 journey:8 路并行重复验证通过
  • Runtime Host typecheck
  • Biome check 与 git diff --check
  • Required CI,包括 Windows recovery 与 baseline

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex audited the remaining hardening evidence and added the focused lifecycle test under maintainer direction.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Exercise the production profile connector and reconnect lifecycle against a real WebSocket service restart. This proves that credentials and canonical Session state survive a new Host epoch without duplicating Domain behavior suites by transport.

Generated-by: Codex
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08fbf407-141d-45c7-aad8-97ca7ff5d3d5

📥 Commits

Reviewing files that changed from the base of the PR and between 38bd18f and 7257049.

📒 Files selected for processing (1)
  • packages/runtime-host/src/__tests__/authenticated-websocket.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.


📝 Walkthrough

What problem this solves

Adds service-level integration coverage for authenticated WebSocket reconnect behavior after a Runtime Host service restart.

The test verifies that the client:

  • Reconnects to the restarted service.
  • Observes a new Host epoch.
  • Resumes the pending session catalog request.
  • Reads the canonical Session created before the restart.
  • Cleans up connections, Host state, and temporary files.

Source of truth and solution scope

The test extends the existing Runtime Host path. It composes the existing profile connector, credential authority, reconnecting connection, Root identity, and durable Session state.

It does not create a parallel Domain behavior path or add a public entity. The change adds only test coverage for a transport- and lifecycle-specific risk.

The solution is the smallest coherent change described by the diff. It reuses existing connectors and lifecycle utilities instead of duplicating Domain behavior suites for WebSocket transport.

Simplification opportunities

No deletion or simplification is evident without weakening restart and reconnect coverage. The test requires setup for authentication, durable state, service restart, Host epoch change, request resumption, and cleanup.

Validation and risks

Reported validation includes:

  • Runtime Host full suite.
  • Eight parallel repetitions of the new integration journey.
  • Typecheck.
  • Biome.
  • git diff --check.
  • Required CI.

The test exercises real WebSocket service restart behavior. Its main risk is test fragility from coordinating authentication, reconnect timing, Host restart, durable state, and temporary resource cleanup.

Complexity delta

  • Authorities: Adds no production authority. The test uses existing Runtime Host authority.
  • State: Adds test state for authentication, reconnect lifecycle, Host epochs, durable Sessions, and cleanup.
  • Branches: Adds test coverage for restart, reconnect, and request resumption branches.
  • Configuration: Adds no public or production configuration.
  • Public surface: Adds no exported or public entities.
  • Test-maintenance burden: Adds one service-level integration test and its lifecycle setup. It avoids duplicated transport-specific Domain suites.

The maintenance complexity increases by one integration scenario, but the increase is justified by the lifecycle risk and the reported repeated validation. No evidence shows that the change adds unnecessary production complexity.

Review-relevant risks

The current diff adds test code only. No effect on user-visible behavior, public contracts, security, licensing, releases, or governance was identified.

Material changes in any protected area require independent human review under repository policy.

The final status of required checks is unverified from direct repository evidence. The person performing the merge must review the final diff, and a maintainer makes the final determination.

Walkthrough

The authenticated WebSocket integration tests now cover client reconnection after a runtime host restart, session request recovery, host epoch changes, and cleanup.

Changes

Runtime host reconnect

Layer / File(s) Summary
Restart recovery integration test
packages/runtime-host/src/__tests__/authenticated-websocket.test.ts
The test uses reconnecting client utilities, restarts the host on the same port, verifies that a queued session request resolves to the persisted session, confirms the host epoch changes, and cleans up resources.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 72570

This test-only change adds localized coverage for remote service restart and session recovery; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: cxhsin

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The test addresses issue #2522 by adding lifecycle-specific evidence for authenticated reconnect, Host epoch changes, and durable Session recovery.
Out of Scope Changes check ✅ Passed The change is limited to one integration test and directly supports the linked issue's Runtime Host restart and reconnect objectives.
Ai Use Disclosure ✅ Passed The PR selects only substantive generative use, names OpenAI Codex and its test scope, and its sole introduced commit has the standalone Generated-by: Codex trailer.
Title check ✅ Passed The title clearly identifies the test change and the Runtime Host remote service restart behavior it verifies.
Description check ✅ Passed The description follows the required template and includes the summary, issue reference, verification results, AI disclosure, and checklist selections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/runtime-host-remote-lifecycle-closure

Comment @coderabbitai help to get the list of available commands.

@M4n5ter
M4n5ter marked this pull request as ready for review August 18, 2026 04:07
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Verify authenticated remote recovery after Runtime Host restart

🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds an authenticated WebSocket restart journey using the production remote profile connector.
• Verifies reconnection reaches a new Host epoch and reads the pre-restart canonical Session.
Diagram

sequenceDiagram
  actor Test as Restart Test
  participant Local as Local Client
  participant Host as Host Service
  participant Root as State Root
  participant Remote as Remote Client
  Test->>Host: Start first epoch
  Test->>Local: Connect over IPC
  Local->>Host: Issue credential and create Session
  Host->>Root: Persist authority and Session state
  Test->>Remote: Connect authenticated profile
  Remote->>Host: Open WebSocket
  Test->>Host: Stop and restart service
  Remote->>Host: Reconnect and query Session
  Host->>Root: Load canonical Session
  Root-->>Remote: Return persisted Session
  Remote-->>Test: Confirm Session and new epoch
Loading
High-Level Assessment

The service-level integration journey is the appropriate approach because it exercises the production profile connector, credential validation, reconnect lifecycle, real service restart, Host epoch rotation, and durable state together. A mocked connection or lifecycle unit test would be faster but would not prove cross-process recovery or persistence, while duplicating the complete Domain behavior suite per transport would add unnecessary maintenance cost.

Files changed (1) +100 / -0

Tests (1) +100 / -0
authenticated-websocket.test.tsCover authenticated WebSocket recovery across service restart +100/-0

Cover authenticated WebSocket recovery across service restart

• Adds a service-level integration test that creates a credential and Session, connects through a production remote profile, and wraps the connection with automatic reconnection. The test restarts the Runtime Host on the same port and State Root, then verifies the queued query returns the canonical pre-restart Session under a new Host epoch, with temporary state cleaned up afterward.

packages/runtime-host/src/tests/authenticated-websocket.test.ts

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Image

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more'

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@M4n5ter

M4n5ter commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Fast-path assessment for the current revision:

  • This is a test-only change that adds coverage for authenticated remote reconnection after a Runtime Host service restart.
  • It does not change production behavior, public contracts, security policy, licensing, release behavior, or governance.
  • The change is low impact and straightforward to revert.
  • All required checks pass, the branch is based on the latest main, and the completed reviews found no actionable issues.

I will review the final revision before merging. If another commit is added, the fast-path determination must be made again.

This automated comment was prepared and posted by OpenAI Codex at M4n5ter's request.

@M4n5ter
M4n5ter merged commit bcb08a0 into main Aug 18, 2026
12 checks passed
@M4n5ter
M4n5ter deleted the test/runtime-host-remote-lifecycle-closure branch August 18, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tracking] Runtime Host remote access and production hardening

1 participant