Skip to content

fix(session): report daemon health probe failures - #927

Open
samuela wants to merge 1 commit into
modem-dev:mainfrom
samuela:fix/health-probe-observability
Open

fix(session): report daemon health probe failures#927
samuela wants to merge 1 commit into
modem-dev:mainfrom
samuela:fix/health-probe-observability

Conversation

@samuela

@samuela samuela commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Problem

hunk session currently collapses every /health failure to null. If the port still accepts TCP connections, the CLI then reports that another process owns it—even when a legitimate Hunk daemon is merely slow or returned a diagnosable HTTP/payload error.

This discards the evidence needed to distinguish a timeout, HTTP failure, malformed response, or transport error.

Change

  • add an internal typed health-probe result that retains failure kind and elapsed time
  • preserve the existing nullable readSessionBrokerHealth and boolean isSessionBrokerHealthy contracts
  • include the terminal probe diagnostic only when a reachable listener ultimately causes hunk session to fail
  • bound and sanitize runtime-generated transport messages, without reflecting response bodies
  • keep successful probes and expected no-daemon session list calls silent

The retry policy and 500 ms timeout are intentionally unchanged; this PR adds observability rather than changing daemon lifecycle behavior.

Validation

  • bun test src/session/broker/brokerLauncher.test.ts src/session/agent/commands.daemon.test.ts — 16 passed
  • HUNK_TEST_SHARDS=1 bun run test — 3508 passed, 12 skipped, 0 failed
  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun run deps:check
  • bun run changeset:status
  • manual source CLI check against a loopback listener returning HTTP 503; verified one bounded diagnostic on stderr and no stdout

Tested on NixOS/Linux with Bun 1.3.13. The delayed-response timeout test is skipped on Windows because of the existing Bun loopback-abort limitation documented by the session probe tests.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@samuela is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@samuela

samuela commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

i had a peculiar instance today where /health took >500ms, resulting in a timeout when using the skill. proposing adding some logging here to increase observability

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