Handle process signals through cooperative cancellation

This commit is contained in:
2026-11-26 02:23:48 +00:00
parent add2811a64
commit 383b43ab08
7 changed files with 277 additions and 4 deletions

View File

@@ -11,6 +11,10 @@ or [migration guidance](native-migration.md) for older callers.
Use an argument vector with explicit paths appropriate to the deployment.
Absolute paths avoid dependence on a service's working directory. Keep stdout
and stderr separate, and choose caller cancellation/deadline behavior.
On the executable, the first SIGINT or SIGTERM requests cooperative cancellation;
started work can drain and available capture can be finalized. A subsequent signal
uses ordinary process handling and may interrupt cleanup. No shutdown deadline is
implied, and callers should not assume non-cooperative extensions will stop.
Validate the application and pipeline offline:

View File

@@ -14,6 +14,9 @@ declares commands without configuration discovery, engine creation, provider
calls, or run-storage allocation. The executable and `RunWithOptions` supply
identity from ReleaseKit's native buildinfo accessor; `RunWithOptions` is a
convenience execution entry point, not a manual dispatcher.
The executable supplies a signal-cancelled context and restores ordinary signal
handling after the first interrupt or termination request; embedded applications
continue to use their caller-supplied contexts.
The constructor wires:

View File

@@ -138,6 +138,12 @@ available evidence. Publication, required capture, and presentation are separate
boundaries: later failure does not undo completed publication.
[CLI Reference](cli.md#completion-report) owns the completion value and outcomes.
The executable treats the first SIGINT or SIGTERM as a cooperative cancellation
request. It restores ordinary signal handling during cleanup so a subsequent
signal can terminate the process. There is no shutdown deadline or guarantee
that collaborators which ignore cancellation will stop; forced termination may
leave capture incomplete. Embedded application callers retain their own contexts.
### Acceptance And Fallback
PromptKit owns transient retries and structural repair. Application semantic

View File

@@ -266,6 +266,12 @@ the selected single failure-finalization boundary preserves genuine causes.
### CAT-010 — Process Signals Do Not Reach Cooperative Cancellation
**Status:** Resolved. The executable routes the first SIGINT/SIGTERM to its
application context and restores ordinary signal handling during cleanup.
Offline subprocess tests observe provider cancellation, joined work, terminal
evidence, no retry/fallback, and subsequent-signal termination with held delivery.
Embedded callers retain their contexts; no cleanup deadline is introduced.
**Assessment:** Static executable integration weakness; original P3.
**Source:** [CONC-001](04-concurrency.md#conc-001--process-signals-bypass-cooperative-cancellation-and-cleanup).
@@ -281,7 +287,7 @@ does not imply SIGKILL handling or a new shutdown deadline guarantee.
**Subsequent decision:** [Discussion Item 3](discussion.md#3-process-signals-and-cooperative-cancellation)
selects cooperative cancellation on the first SIGINT/SIGTERM and ordinary
termination on a subsequent signal, with no application shutdown deadline.
Signal handling stays at the executable boundary; implementation remains pending.
Signal handling stays at the executable boundary.
### CAT-011 — Extreme Accepted Context Radius Can Empty Evidence

View File

@@ -613,6 +613,13 @@ race tests. Update CLI/state internals, not CommandKit-owned syntax.
## Stage 21 — Connect Executable Signals To Cancellation
**Completed.** The executable routes the first SIGINT/SIGTERM into the existing
context and restores ordinary handling for a subsequent signal, joining its
signal helper before exit. Offline subprocess tests exercise in-flight provider
cancellation, terminal evidence, no fallback/retry, and a held-delivery second
signal. Repeated process tests and the prescribed executable/CLI checks pass.
No shutdown deadline or embedded process-wide handler was added.
**Coverage:** CAT-010. **Prerequisites:** Stages 10, 17, 20.
Pass a SIGINT/SIGTERM-cancelled context from cmd/notarius/main.go to app.Execute.