mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-02 10:09:02 +01:00
On a default install Pulse can see that a container failed and not why. The line that names the cause is in the log, and a default agent reads no logs. On the fault set, the restart loop from a bad DATABASE_URL stayed "Handed back" on a default agent through every replay for that reason. An operator can now turn on --enable-failure-logs (or PULSE_ENABLE_FAILURE_LOGS) on a host. The agent then reports the last lines of a container whose own state shows a failure: a non-zero exit, an out-of-memory kill, a restart after either, or a failing health check. It never reads a container that stopped cleanly, runs healthy or was never started, and with the switch off it never asks the runtime for logs at all. Nothing the server sends can turn the switch on: this is a local boundary like custom sensors, not a read-only command mode, and the server never chooses a container, a path or a line count. What leaves the host is at most 30 lines and 4 KB, read once per failure, with terminal codes and control characters removed and then credential-shaped values masked. Cleaning comes before masking because a secret split by a control character matches no rule until the character is gone. The server cleans, masks and bounds the lines again on receipt and accepts only the four known reasons, so it does not depend on the agent having done any of it. The masking rules moved from the AI safety package to pkg/secretredact, with no change to them, so the agent and the server apply one set. The lines show in the container's details as "Last log lines", in view on the overview, as plain text. Patrol and the Assistant get them on the single-container payload with a fixed note that they are untrusted text and never instructions. Masking is pattern-based and is not a guarantee. The lines are readable by anyone who can read the container, go to the AI provider when Patrol reads it, and can be quoted by Patrol in a finding. The docs say so. A read-only review before this was pushed found that masking ran before cleaning, that a restarted healthy container qualified for a read, that the stream reader trusted a frame's declared length and kept the oldest text, and that stale lines could be served for a new failure. All are fixed here with tests. It also found that the first docs promised the lines never reach a notification, which a quoted line in a finding can. The promise is corrected.