feat(daemon): add abrupt-exit diagnostics and stale-socket startup recovery#405
Open
feat(daemon): add abrupt-exit diagnostics and stale-socket startup recovery#405
Conversation
…covery - Add ShutdownReason tracking to DaemonMetadata (graceful/restart/stopped) - Record shutdown reason before daemon exits (signal-based or API/command) - Add startup stale artifact detection for PID, socket, and lock files - Detect and log abrupt exits (no shutdown reason recorded) - Protect against killing/overriding healthy active daemon - Clear stale artifacts safely during startup recovery - Add LIFECYCLE log prefix for incident triage visibility - Add comprehensive test coverage for all recovery scenarios Fixes: orch-428
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.
Summary
Changes
Shutdown Reason Tracking
ShutdownReasonandShutdownAtfields toDaemonMetadatagraceful,restart,stoppedStartup Recovery
CheckAndRecoverStaleArtifacts()function detects and cleans up:Lifecycle Logging
All lifecycle events now use
LIFECYCLE:prefix for easy grep:Acceptance Criteria Verification
Startup logs clearly indicate when stale runtime state was detected and repaired
STARTUP RECOVERY:prefixed log messages show exactly what was found and cleaned upRecovery does not kill/override a healthy active daemon
CheckAndRecoverStaleArtifactsreturns error if PID file refers to running processIncident triage can distinguish graceful stop from abrupt disappearance using logs
LIFECYCLE: graceful shutdown completedSTARTUP RECOVERY: ... exited ABRUPTLY without graceful shutdownAdded test coverage for stale artifact recovery path
TestShutdownReasonTrackingTestCheckAndRecoverStaleArtifacts_NoArtifactsTestCheckAndRecoverStaleArtifacts_StalePIDTestCheckAndRecoverStaleArtifacts_StaleSocketTestCheckAndRecoverStaleArtifacts_AbruptExitTestCheckAndRecoverStaleArtifacts_ActiveDaemonTestCheckAndRecoverStaleArtifacts_GracefulShutdownLoggedTest Results
Fixes: orch-428