paperclip/server
Netquirk Primary Developer b596525475 feat(server): NET-6820 reintroduce GET /api/host-ops/lock-status with board auth + TTL validation
Reintroduces the host-ops lock-status endpoint dropped from PR #13276
(NET-4074 / NET-6815) with all four Greptile findings addressed:

  1. P1 — gate the route on requireBoard(req). Default-deny:
     non-board actors receive 403 {error: 'board_only'} before any
     disk I/O. The host-ops.ts module imports requireBoard from
     server/src/middleware/auth.ts.
  2. P2 — trim the response shape to {host, canonicalHost, status,
     age_seconds, ttl_seconds}. Internal lock metadata (agent, issue,
     intent, pid, started, heartbeat) is no longer exposed over the
     network; the bash helper and JSON-on-disk lock files retain full
     provenance for netquirk_acquire / netquirk_heartbeat callers.
  3. P2 — parseNetquirkLockTtlSec now rejects empty, non-numeric,
     fractional, negative, zero, and out-of-range values with
     InvalidLockTtlError. The accepted range is 30 <= n <= 3600
     seconds. Validated TTL is captured once at module load via
     resolvedLockTtl() and surfaced through /healthz's
     'host-ops.lock_ttl_sec' block (status: ok | invalid | default)
     so an operator sees a broken env without reading server logs.
  4. P2 — this PR's title names the lock-status endpoint explicitly;
     the prior bundled commit was buried in a 'narrow null-environment
     retry' PR scope.

Test coverage in server/src/__tests__/host-ops-route.test.ts:
  - parseNetquirkLockTtlSec boundary (30, 3600), invalid inputs
    (NaN, fractional, empty, undefined, negative, above max)
  - resolvedLockTtlFromEnv default vs env source paths
  - GET /api/host-ops/lock-status returns 403 board_only for
    missing / non-board actors, 200 trimmed shape for board actors,
    stale status when the admin-supplied TTL crosses the heartbeat,
    absent when no lock is present, and 400 missing_host when the
    host query param is absent.
  - Alias canonicalisation (apps-arm1.* fold to apps-arm1).

/healthz surfaces 'host-ops.lock_ttl_sec' with ttl_seconds, source,
env_key, env_value, min, max, default, and status. The field is
included in both the redacted (no auth) and full responses; the
config carries no host / agent / intent metadata so it is safe to
expose without a board session.

No host mutation. No data export. No secrets. No auth bypass.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-11 23:04:08 +00:00
..
scripts fix(server): bundle the vendored paperclip-runner instead of hand-mirroring its deps (#13121) 2026-09-09 16:38:17 -07:00
src feat(server): NET-6820 reintroduce GET /api/host-ops/lock-status with board auth + TTL validation 2026-09-11 23:04:08 +00:00
CHANGELOG.md fix: bound workspace Git scans (#11572) 2026-08-17 22:11:30 -05:00
package.json feat(connections): add AgentMail inboxes and email tasks (#13256) 2026-09-11 16:56:38 -05:00
tsconfig.json Fix root TypeScript solution config 2026-03-09 14:09:30 -05:00
vitest.config.ts fix(server): bundle the vendored paperclip-runner instead of hand-mirroring its deps (#13121) 2026-09-09 16:38:17 -07:00