Skip to content

watch: signal handling and termination semantics #34

Closed

Description

@0xLeif

From the UX audit: no signal handlers, SIGTERM kills with 143, bounded exits always 0 whether --count or --timeout stopped the loop, and the jsonl fallback can write a raw non-JSON line into the stream (Sources/aps/Aps.swift:148-157).

Acceptance criteria

  • SIGINT/SIGTERM stop the loop cleanly (DispatchSourceSignal), exit 0 on SIGINT after final flush
  • Bounded exit reason is observable: terminal jsonl event or stderr line with reason count|timeout|signal
  • jsonl stream never contains non-JSON lines
  • Tests cover termination paths; specs updated

Locked decisions (design interview round 2, 2026-07-18)

  • Termination: both channels. Terminal JSONL event {type:end, reason:count|timeout|signal} in machine mode and a stderr line in human mode; exit codes 0 (count) / 124 (timeout, GNU convention) / 130 (SIGINT). Bare unbounded watch prints a one-time stderr hint suggesting --count/--timeout.

Activity

  1. added this to the v0.3.0 milestone on Jul 18, 2026
  2. added
    enhancementNew feature or request
    hardeningCorrectness, isolation, or cleanup work
    agent:kimiTicket claimed by the Kimi Code agent. One agent per ticket; remove when the PR is up or work stops.
    on Jul 18, 2026
  3. 0xLeif commented on Jul 19, 2026

    @0xLeif
    OwnerAuthor

    Claimed by kimi. Working branch: kimi/issue-34-watch-signals (worktree ../aps-cli-wt/issue-34).

  4. 0xLeif commented on Jul 19, 2026

    @0xLeif
    OwnerAuthor

    PR open: #54 - releasing the kimi claim.

  5. removed
    agent:kimiTicket claimed by the Kimi Code agent. One agent per ticket; remove when the PR is up or work stops.
    on Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthardeningCorrectness, isolation, or cleanup work

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions