Skip to content

FE-875: App runtime probe — boot, probe, classify#219

Open
kostandinang wants to merge 4 commits into
ka/fe-872-dep-install-classificationfrom
ka/fe-875-app-runtime-probe
Open

FE-875: App runtime probe — boot, probe, classify#219
kostandinang wants to merge 4 commits into
ka/fe-872-dep-install-classificationfrom
ka/fe-875-app-runtime-probe

Conversation

@kostandinang

@kostandinang kostandinang commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Stacks on FE-872. Fifth Arc-1 frontier -- the concrete reachability mechanism behind integration-oracle (without it, "reachable" collapses to "a test imports the module"). Slices 1 + 2 both land here.

What?

Boot the host app from the cook worktree and exercise it over the wire -- the app-execution analogue of test-runner.ts.

  • Slice 1 -- probe (runProbe, app-probe.ts): boot -> poll readiness -> hit one HTTP feature endpoint -> classify, always tearing the process down. reachable (< 400), not-reachable (booted but endpoint absent/erroring -- the FE-800 orphan), infra (never booted). A spawn error bails fast instead of polling to timeout.
  • Slice 2 -- spec resolution (buildProbeSpec, app-probe.ts): resolve a ProbeTarget (boot argv + paths) into a runnable ProbeSpec by allocating a free port and assembling the ready/feature URLs. The boot test's hand-rolled port dance becomes the production primitive it now dogfoods.

Why?

Verification today only runs the test runner in the worktree, so "reachable" degrades to "a test imports the module" and the FE-800 orphan survives. The harness owns the deterministic, unshortcuttable check; the boot argv + paths are inputs (cook-time grounding supplies them later) -- no per-stack boot engine. The port can't be hardcoded: under parallel cook each slice boots its own app and a fixed port collides, so port->URL binding is the one harness-owned piece (best-effort ephemeral, loopback-only, acknowledged TOCTOU window -- no retry framework).

Tests

Real seeded node:http apps in tmp worktrees, no mocks: reachable; booted-but-404 -> orphan; immediate-exit / missing-binary -> infra; teardown leaves no process. Plus buildProbeSpec: port allocated + URLs assembled, caller env layered under PORT, distinct ports across 8 concurrent allocations. (Also hardens the FE-743 wall-clock timing test, which flaked under the CPU contention real-process tests add -- tolerance now scales with serialMs.)

Deferred

Mode-awareness + where the ProbeTarget argv/paths come from (architect intent + cook grounding) = integration-oracle (#6).

Co-authored-by: Amp amp@ampcode.com

@kostandinang kostandinang changed the title FE-875: app runtime probe — boot + HTTP probe + reachability classification (slice 1) FE-875: App runtime probe — boot, HTTP probe, reachability classification Jun 16, 2026
@kostandinang kostandinang force-pushed the ka/fe-875-app-runtime-probe branch from cb90e92 to f7a632b Compare June 16, 2026 10:40
@kostandinang kostandinang changed the title FE-875: App runtime probe — boot, HTTP probe, reachability classification FE-875: app runtime probe — boot/probe/classify + ProbeSpec resolution Jun 16, 2026
@kostandinang kostandinang changed the title FE-875: app runtime probe — boot/probe/classify + ProbeSpec resolution FE-875: App runtime probe — boot, probe, classify Jun 16, 2026
@kostandinang kostandinang force-pushed the ka/fe-872-dep-install-classification branch from ff041c6 to 7e923c6 Compare June 16, 2026 12:53
@kostandinang kostandinang force-pushed the ka/fe-875-app-runtime-probe branch 2 times, most recently from 6139723 to abb2725 Compare June 16, 2026 13:24
@kostandinang kostandinang force-pushed the ka/fe-872-dep-install-classification branch 2 times, most recently from 2cec280 to fecc5c6 Compare June 16, 2026 13:38
@kostandinang kostandinang force-pushed the ka/fe-875-app-runtime-probe branch from abb2725 to 56fa05d Compare June 16, 2026 13:38
@kostandinang kostandinang marked this pull request as ready for review June 16, 2026 14:18
@cursor

cursor Bot commented Jun 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
New isolated orchestrator module and tests only; no cook-net or promotion path changes yet. Residual risk is flaky port allocation (acknowledged TOCTOU) and timing-sensitive contract tests, mitigated by loopback ephemeral ports and scaled timing tolerance.

Overview
Adds the app runtime probe (Arc 1 / FE-875): harness-owned reachability checks over real HTTP, intended for future integration-oracle gating—not wired into the cook net yet.

runProbe boots a child from a worktree ProbeSpec, polls a readiness URL, hits one feature URL, and returns reachable (<400), not-reachable (up but wrong/missing route—the orphan case), or infra (boot/probe failure), mirroring FE-872’s infra vs test split. Boot processes are always torn down (SIGTERM → SIGKILL). Readiness and feature fetch calls use AbortSignal.timeout so hung servers cannot block the cook loop.

buildProbeSpec turns a ProbeTarget (boot argv + paths) into a full spec by picking a loopback ephemeral PORT and assembling ready/feature URLs—so parallel slices do not collide on a hardcoded port.

New types live in types.ts (ProbeSpec, ProbeTarget, ProbeResult, ProbeOutcomeKind). app-probe.test.ts exercises real node:http sandboxes (reachable, 404 orphan, boot fail, hang/timeouts, teardown, concurrent port allocation). engine-contract.test.ts relaxes the parallel-vs-serial wall-clock assertion to scale with serialMs so real-process probe tests do not flake under CPU contention. memory/PLAN.md records slices 1–2 landed and remaining integration-oracle / mode work.

Reviewed by Cursor Bugbot for commit a188d00. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 56fa05d. Configure here.

Comment thread src/orchestrator/src/app-probe.ts
Comment thread src/orchestrator/src/app-probe.ts
kostandinang and others added 4 commits June 16, 2026 19:04
…cation (slice 1)

The app-execution analogue of test-runner.ts: runProbe(spec, sandboxDir)
boots an app from the worktree, polls readiness, exercises one HTTP feature
endpoint, and returns a structured ProbeResult classifying the outcome as
reachable (<400) / not-reachable (booted but endpoint absent — the FE-800
orphan) / infra (never booted), always tearing the boot process down.

- types.ts: ProbeOutcomeKind / ProbeSpec / ProbeResult
- app-probe.ts: runProbe + readiness poll + SIGTERM->SIGKILL teardown;
  spawn-error bails fast instead of polling to timeout
- the boot argv + URLs are ProbeSpec INPUTS (cook-time grounding supplies
  them later), not a per-stack boot engine — harness owns the deterministic,
  read-only check; boot mechanics may lean on agent bash (honors the boundary)
- tests boot real seeded node:http apps: reachable / orphan-404 /
  boot-fail / missing-binary / teardown

Also hardens the FE-743 'comparable wall-clock' timing test: its absolute
25ms slack flaked under CPU contention from real-process test files (this
slice's probe tests exposed it). Tolerance now scales with serialMs; a true
serialized-parallel regression is many x serialMs, still caught.

Remaining slices: mode-awareness, integration-oracle gating, ProbeSpec sourcing.

Amp-Thread-ID: https://ampcode.com/threads/T-019ecb9a-9a08-733b-833d-76885fc8243a
Co-authored-by: Amp <amp@ampcode.com>
… probe

runProbe's readiness poll and feature fetch used bare global fetch with
no timeout. A server that accepts a connection but never responds would
block await fetch forever — the wall-clock READY_TIMEOUT_MS is only
checked between poll attempts, so it never fired, hanging the probe and
the whole cook. Each fetch now carries a per-call AbortSignal.timeout;
timeouts are overridable so the no-hang behavior is unit-tested fast.

Amp-Thread-ID: https://ampcode.com/threads/T-019ecb9a-9a08-733b-833d-76885fc8243a
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang kostandinang force-pushed the ka/fe-875-app-runtime-probe branch from 56fa05d to a188d00 Compare June 16, 2026 18:05
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