Skip to content

Log interrupted invocations to primary.log - #207

Merged
codeforester merged 1 commit into
mainfrom
bug/206-20260811-persist-interrupt-diagnostics-in-the-primary-run-log
Aug 11, 2026
Merged

Log interrupted invocations to primary.log#207
codeforester merged 1 commit into
mainfrom
bug/206-20260811-persist-interrupt-diagnostics-in-the-primary-run-log

Conversation

@codeforester

Copy link
Copy Markdown
Contributor

Fixes #206

def _record_lifecycle_diagnostic(context: Context[Any, Any, Any], outcome: InvocationOutcome) -> None:
try:
context.log.debug("Unexpected command exception", exc_info=True)
if outcome.kind == "interrupted":

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work for other types of signals like SIGTERM or just for SIGINT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. This change is specifically for Ctrl-C/SIGINT: base-cli normalizes KeyboardInterrupt to the interrupted outcome and logs it before lifecycle teardown. SIGTERM does not raise KeyboardInterrupt; by default it terminates the process without reliably running the logger or finalizer. Supporting SIGTERM would require explicit signal handlers, a defined exit code (typically 143), and platform-specific regression coverage, so I recommend keeping that as a separate follow-up rather than broadening #207.

@codeforester
codeforester marked this pull request as ready for review August 11, 2026 12:28
@codeforester
codeforester merged commit 1ae2db6 into main Aug 11, 2026
90 checks passed
@codeforester
codeforester deleted the bug/206-20260811-persist-interrupt-diagnostics-in-the-primary-run-log branch August 11, 2026 12:29
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.

Persist interrupt diagnostics in the primary run log

1 participant