Skip to content

feat(#645): relay CLI UX — sequant abort, prompt --wait, accurate phase label - #648

Merged
admarble merged 1 commit into
mainfrom
feature/645-relay-cli-ux-followups
May 14, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/645-relay-cli-ux-followups

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

Follow-up to PR #646. Closes the user-visible CLI gaps that were deferred from the root-cause fix:

  • Gap 7 — sequant abort <issue>: Out-of-band escape that bypasses the relay inbox. Reads state.relay.pid, sends SIGINT (10s grace), escalates to SIGTERM then SIGKILL. Distinct from prompt --type abort by design: that's the polite path; this is the kill that doesn't depend on the agent reading inbox.
  • Gap 6 — accurate phase in sequant prompt confirmation: Re-reads state.json with a fresh StateManager immediately before printing, bypassing cached snapshots. Omits the label entirely when no fresh phase is available — a wrong phase is worse than no phase.
  • Gap 4 — sequant prompt --wait <seconds>: Optional reply tailing. After appending to inbox, polls outbox for a response with matching inReplyTo. Prints inline on hit, exits 1 on timeout with "may be archived without response". Skipped for type=abort. Default behavior unchanged when --wait absent.

Test plan

Unit (passing in CI):

  • npm run build (tsc) — clean
  • npx vitest run src/commands src/lib/relay src/lib/merge-check — 353 tests passing
  • 11 new tests: 5 for abort (no-pid, already-dead, SIGINT-success, SIGINT→SIGTERM→SIGKILL escalation, --force), 3 for prompt --wait (reply, timeout, abort skips wait), 3 existing watch tests still passing

Manual smoke (after merge):

# Start a small run
npx sequant run <issue> --no-mcp --phases exec
# In another terminal — prompt with wait
npx sequant prompt <issue> "status?" --wait 30
# Verify reply prints inline; phase label matches state.json

# Out-of-band abort while run is alive
npx sequant abort <issue>
# Verify: SIGINT delivered, ShutdownManager teardown runs, relay archived

Files

  • src/commands/abort.ts (new, 213 LOC) — abort command implementation
  • bin/cli.ts (+37) — abort registration and --wait option on prompt
  • src/commands/prompt.ts (+128) — fresh state re-read for Gap 6, --wait reply tailing for Gap 4
  • src/commands/__tests__/abort.test.ts (new, 159 LOC)
  • src/commands/__tests__/prompt-wait.test.ts (new, 163 LOC)

Refs #645

Three independent CLI UX improvements that complete the user-visible
gap list from #645 after the root-cause fix in #646. Each addresses
one of the deferred gaps:

Gap 7 — sequant abort <issue>
  Out-of-band escape hatch that bypasses the relay inbox entirely.
  Reads state.relay.pid (or the per-issue pidfile), sends SIGINT with
  a 10s grace, then escalates SIGTERM, then SIGKILL. Honors the
  existing ShutdownManager teardown so locks + relay archive run
  cleanly. Distinct from `prompt --type abort` by design: that is the
  polite path that needs the agent to read inbox; abort is the
  reliable kill that doesn't.

Gap 6 — accurate currentPhase in prompt confirmation
  prompt now reads state.json with a fresh StateManager immediately
  before printing, bypassing any cached snapshot from the start of
  the command. When no fresh phase can be resolved, the label is
  omitted entirely — a wrong phase is worse than no phase.

Gap 4 — sequant prompt --wait <seconds>
  Optional reply tailing: after appending to the inbox, poll the
  outbox for a response whose inReplyTo matches the new message ID.
  Print inline on hit, exit 1 with a "may be archived without
  response" message on timeout. Skipped for type=abort (no reply
  expected). Default behavior unchanged when --wait is absent.

11 new tests across abort + prompt-wait surfaces; 353 tests passing
on the touched surface.
@admarble
admarble merged commit bcd887b into main May 14, 2026
5 checks passed
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