Repository navigation
watch signal handling and termination semantics (Closes #34) - #54
Merged
Merged
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
4 tasks
Review (agent:cursor) — tested locallyVerdict: Approve after SpecSync renumber (post-#50). Tested
Required before merge
Merge orderAfter #50 (and preferably after or beside #53). Independent of #55. |
This was referenced Jul 19, 2026
- SIGINT/SIGTERM stop the loop cleanly via DispatchSourceSignal on the
main queue (delivered by the watch loop's RunLoop draining)
- stop reason observable in both channels: terminal
{type:end,reason:count|timeout|sigint|sigterm} event in --jsonl mode,
stderr summary in human mode
- exit codes: 0 count, 124 timeout (GNU), 130 SIGINT, 143 SIGTERM
- jsonl stream never carries non-JSON lines (encode failure now emits a
WatchErrorEvent)
- unbounded watch prints a one-time stderr hint suggesting --count/--timeout
- tests (2 new) + smoke covers all exit paths incl. kill -INT; specs/README
in lockstep
- SpecSync CHG-0021 accepted; evidence rebound for shared changes
(audited reopens, actor 0xLeif)
The macOS self-hosted runner hung 30m on wait $WPID (orphan aps process). Poll with a deadline and SIGKILL fallback; still asserts exit 130 when the signal works.
An ignored disposition also suppresses kqueue signal delivery on some platforms; the macOS CI runner lost SIGINT while local shells received it. Blocking keeps dispatch-source delivery intact everywhere (verified: exit 130 on SIGINT, 143 on SIGTERM locally).
…dows CI agents run job children with SIGINT ignored, which also suppresses kqueue delivery - so the dispatch source never fired on the macOS runner while local shells (default disposition) worked. Signal(SIG_DFL) before blocking, and compactMap-nil the whole mechanism on Windows where POSIX signals do not exist.
…he loop The real bug all along: '_ = signalSources' discarded the dispatch sources immediately; debug kept them incidentally, release optimized them away so no signal ever fired (initially misdiagnosed as runner signal masking). Post-loop cancel() is an actual use that pins the lifetime. Smoke's signal assertion returns to SIGINT (exit 130) with the bounded-wait guard kept.
Co-authored-by: Leif <leif.algo@pm.me>
cursor
Bot
force-pushed
the
kimi/issue-34-watch-signals
branch
from
July 19, 2026 13:00
cf6bf94 to
0302966
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34.
Summary
watch signal handling and observable termination semantics (design round 2: both channels).
DispatchSourceSignalfor SIGINT/SIGTERM on the main queue, delivered by the watch loop's own RunLoop draining; newSignalBox+StopReasoninSources/aps/WatchTermination.swift{"type":"end","reason":"count|timeout|sigint|sigterm"}event in--jsonlmode, one-line stderr summary in human mode--countis satisfied, 124 on--timeout(GNU convention), 130 SIGINT, 143 SIGTERMWatchErrorEventinstead of the raw value line--count/--timeoutprints a one-time stderr hint suggesting boundsVerification (local, worktree; all empirical)
{"type":"end","reason":"count"}eventreason:"timeout"event; human mode printswatch counter: stopped (timeout)on stderrkill -INT) → exit 130 withreason:"sigint"eventkill -TERM) → exit 143smoke.shgreen incl. all exit paths and a jsonl-purity checkspecsync check --force7/7 files 100%,specsync change check20 active valid,fledge lanes run verifygreenSpecSync
Merge note
Touches
Aps.swiftWatch andCLIOutput.swiftlike #50/#33 do; whichever merges second gets the usual rebase + rebind pass, which I will run.