Commit f89176e
committed
feat: emit exiting{reason:"requested"} on clean shutdown (Aegis Engine Protocol v1)
Aegis-AI's daemon (aegis-daemon, W7 Rust rewrite) needs to tell a clean,
planned shutdown apart from a real crash. Today SwiftLM's SIGTERM/SIGINT
handlers print plain text and exit(0) with no machine-readable signal at
all.
Adds a small shared emitEvent(_:) helper (used by both the existing ready
event and this new one, replacing ready's inline JSONSerialization call)
and emits {"event":"exiting","reason":"requested"} on both signal handlers
before exiting. Consumers should ignore unrecognized future reason values
rather than error on them.
This is Phase 1 of a larger plan (see Aegis-AI's daemon/spec/engine-protocol.md
§3/§4) — self-reporting a SPECIFIC failure reason on a real crash (OOM,
model load failure, etc.) is separate, larger follow-up work, since none
of those paths have any error handling to build on today.
Verified: swift build --target SwiftLM (debug) and swift build -c release
--product SwiftLM both green. Smoke-tested against a real Aegis-AI daemon
build in an isolated sandbox: reached ready normally, and a real SIGTERM
via the daemon's stop endpoint exited the process cleanly with the new
event observed, without the daemon misclassifying it as a crash.1 parent bb11618 commit f89176e
2 files changed
Lines changed: 37 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
192 | 207 | | |
193 | 208 | | |
194 | 209 | | |
| |||
1026 | 1041 | | |
1027 | 1042 | | |
1028 | 1043 | | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
| 1044 | + | |
1034 | 1045 | | |
1035 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
1036 | 1054 | | |
1037 | 1055 | | |
1038 | 1056 | | |
1039 | 1057 | | |
1040 | 1058 | | |
1041 | 1059 | | |
1042 | 1060 | | |
| 1061 | + | |
1043 | 1062 | | |
1044 | 1063 | | |
1045 | 1064 | | |
1046 | 1065 | | |
| 1066 | + | |
1047 | 1067 | | |
1048 | 1068 | | |
1049 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
0 commit comments