Skip to content

feat(runtime-core): replace the sidecar frame timeout with a heartbeat silence watchdog#1653

Merged
NathanFlurry merged 4 commits into
mainfrom
stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq
Jul 8, 2026
Merged

feat(runtime-core): replace the sidecar frame timeout with a heartbeat silence watchdog#1653
NathanFlurry merged 4 commits into
mainfrom
stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq

Conversation

@NathanFlurry

@NathanFlurry NathanFlurry commented Jul 8, 2026

Copy link
Copy Markdown
Member
  • The native sidecar emits a connection-scoped StructuredEvent{name:"heartbeat"} every 10s from a dedicated thread, so beats keep flowing while the dispatch loop is busy inside one long request. No protocol schema change — reuses the existing structured-event variant.
  • The host replaces the per-frame 120s timeout with a silence watchdog: any inbound frame resets a 30s clock; sustained total silence kills the sidecar and rejects in-flight requests with a typed SidecarSilenceTimeout (stderr tail included).
  • Individual requests no longer have a deadline: a legitimately long agent turn runs for minutes without teardown, while a genuinely dead or wedged sidecar is detected in ~30s instead of 2 minutes.
  • Removes NATIVE_SIDECAR_FRAME_TIMEOUT_MS, the AGENTOS_SIDECAR_FRAME_TIMEOUT_MS env override (feat(runtime-core): env-override the native sidecar frame timeout #1641), and all frameTimeoutMs plumbing (spawn options, native-client, protocol-client, frame-rpc, correlation).
  • Heartbeats are swallowed at the frame layer on both clients so they never reach event consumers or the bounded event buffer; the Rust client mirrors the watchdog (activity-reset reader, kill + fail-pending on silence).
  • Heartbeat cadence and silence window are fixed protocol constants (no env knobs); docs updated.

@NathanFlurry

NathanFlurry commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Stack for rivet-dev/agentos

Get stack: forklift get 1653
Push local edits: forklift submit
Merge when ready: forklift merge 1653

@railway-app

railway-app Bot commented Jul 8, 2026

Copy link
Copy Markdown

🚅 Deployed to the agentos-pr-1653 environment in agentos

Service Status Web Updated (UTC)
agentos 😴 Sleeping (View Logs) Web Jul 8, 2026 at 5:22 am

🚅 Environment agentos-pr-1653 in rivet-frontend has no services deployed.

@NathanFlurry NathanFlurry force-pushed the stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq branch from a8f2d27 to faab7b6 Compare July 8, 2026 04:07
@railway-app railway-app Bot temporarily deployed to agentos / agentos-pr-1653 July 8, 2026 04:07 Destroyed
@NathanFlurry NathanFlurry changed the title feat(runtime-core): env override for the native sidecar frame timeout feat(runtime-core): validate, test, and document the sidecar frame timeout override Jul 8, 2026
@NathanFlurry NathanFlurry force-pushed the stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq branch from faab7b6 to c8ffbcc Compare July 8, 2026 05:10
@railway-app railway-app Bot temporarily deployed to agentos / agentos-pr-1653 July 8, 2026 05:10 Destroyed
@NathanFlurry NathanFlurry changed the title feat(runtime-core): validate, test, and document the sidecar frame timeout override feat(runtime-core): replace the sidecar frame timeout with a heartbeat silence watchdog Jul 8, 2026
@NathanFlurry NathanFlurry changed the base branch from main to stack/fix-core-deliver-post-boot-mountfs-reconfiguration-reliably-to-the-native-sidecar-nyvvsyxp July 8, 2026 05:10
@NathanFlurry NathanFlurry changed the base branch from stack/fix-core-deliver-post-boot-mountfs-reconfiguration-reliably-to-the-native-sidecar-nyvvsyxp to main July 8, 2026 06:17
…ircuit

- Builds on #1640: also short-circuit on the session record already marked closed (covers exits the kill RPC does not report), and skip the second wait when SIGKILL itself reports the process gone.
- Mirror the short-circuit in the agentos-sidecar-core sync engine, with regression tests proving zero dead waits.
…bridge round-trip

- Resolve `realpath("/")` of a js_bridge mount locally (mirroring host_dir): host-side drivers often cannot canonicalize their own root and returned ENOENT, which aborted kernel permission-subject resolution before the readDir bridge call was ever issued.
- Regression test: readdir of a js_bridge mount root against a driver whose realpath always fails.
…native sidecar

- `mountFs`/`unmountFs` now return a promise that settles once the sidecar has applied the mount; delivery failures reject instead of being swallowed.
- Runtime mount reconfigures resend the boot `packages`/`packagesMountAt`/`toolShimCommands`: Rust `configure_vm` rebuilds the whole VM configuration from each payload, so omitting them stripped the `/opt/agentos` projections and tool shims as a side effect of a post-boot mount.
- Runtime `linkSoftware` packages are retained too, so a later `mountFs` no longer unprojects them.
- The Rust client `mount_fs` remains in-process-only; sidecar-visible runtime mounts there are a follow-up.
…t silence watchdog

- The native sidecar emits a connection-scoped `StructuredEvent{name:"heartbeat"}` every 10s from a dedicated thread, so beats keep flowing while the dispatch loop is busy inside one long request. No protocol schema change — reuses the existing structured-event variant.
- The host replaces the per-frame 120s timeout with a silence watchdog: any inbound frame resets a 30s clock; sustained total silence kills the sidecar and rejects in-flight requests with a typed `SidecarSilenceTimeout` (stderr tail included).
- Individual requests no longer have a deadline: a legitimately long agent turn runs for minutes without teardown, while a genuinely dead or wedged sidecar is detected in ~30s instead of 2 minutes.
- Removes `NATIVE_SIDECAR_FRAME_TIMEOUT_MS`, the `AGENTOS_SIDECAR_FRAME_TIMEOUT_MS` env override (#1641), and all `frameTimeoutMs` plumbing (spawn options, native-client, protocol-client, frame-rpc, correlation).
- Heartbeats are swallowed at the frame layer on both clients so they never reach event consumers or the bounded event buffer; the Rust client mirrors the watchdog (activity-reset reader, kill + fail-pending on silence).
- Heartbeat cadence and silence window are fixed protocol constants (no env knobs); docs updated.
@NathanFlurry NathanFlurry force-pushed the stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq branch from c8ffbcc to d9179cc Compare July 8, 2026 06:17
@railway-app railway-app Bot temporarily deployed to agentos / agentos-pr-1653 July 8, 2026 06:18 Destroyed
@NathanFlurry NathanFlurry changed the base branch from main to stack/fix-core-deliver-post-boot-mountfs-reconfiguration-reliably-to-the-native-sidecar-nyvvsyxp July 8, 2026 06:18
@NathanFlurry NathanFlurry changed the base branch from stack/fix-core-deliver-post-boot-mountfs-reconfiguration-reliably-to-the-native-sidecar-nyvvsyxp to main July 8, 2026 06:18
@NathanFlurry NathanFlurry merged commit d9179cc into main Jul 8, 2026
3 of 4 checks passed
@NathanFlurry NathanFlurry deleted the stack/feat-runtime-core-env-override-for-the-native-sidecar-frame-timeout-rwrqkykq branch July 8, 2026 06:18
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.

1 participant