53da52ecd1d2af3de4df327196058d92ff275237
Part of #453 (task-observability epic #450). archie-agent logged to os.Stderr only, and its container is created with AutoRemove: true (internal/container/pool.go), so all of it disappeared the moment a task's container exited -- there was no way to see why, say, a gate command failed inside one. Adds agentexec.SystemLogHandler: a slog.Handler that tees to whatever it wraps (kept for an operator attached to a live container) and additionally publishes each record, JSON-encoded as a logging.Entry, to SubjectForSystem(taskID) -- a subject that already existed, documented for exactly this ("log dumps, health... observability"), with zero publishers anywhere in the codebase. cmd/archie-agent/main.go wires it in only when this container was spawned for one specific task (bootTaskID / .git/task.json present); shared queue-group mode serves many unrelated tasks per process, so there's no single task subject to ship to and keeps the stderr-only logger. Building this surfaced a real pre-existing bug: FeedHandler's attr flattening applied the group chain active at Handle-time to *all* accumulated attrs, including ones added via WithAttrs before a later WithGroup call -- nesting them under a group they were never actually inside, contrary to slog's own documented Handler contract. It went unnoticed because nothing in the codebase called WithGroup until this change needed to. Extracting the shared flattening logic into exported FlattenAttrs/PrefixAttrs (so SystemLogHandler doesn't duplicate it) is what surfaced it; fixed in the same change since I was the one making it public API. Docs on the wire format's own trap for the daemon-side consumer (#454, not yet written): the published bytes are a marshaled logging.Entry, meant for json.Unmarshal, not logging.decode() -- decode() parses raw slog JSON *log lines* off disk, a different and incompatible shape. See the doc comment on SystemLogHandler.
Description
Archie connects events from your systems to agents that can investigate, reason, and act.
Define what an event means, map its data into a workflow, and give that workflow an agent equipped for the job: its own execution environment, tools, and identity.
https://archie.catlow.cloud
133 MiB
0 Stars
1 Watchers
0 Forks
Releases
11
Archie v1.62.0
Latest
Languages
Go
76.7%
Vue
13.1%
TypeScript
7.8%
JavaScript
1.2%
Shell
0.6%
Other
0.4%