Repository navigation
Conversation
… the bound itsup imports instrukt_ai_logging.cli, which the logger stopped shipping in 0.7.0. The bound set for that was rewritten to <0.11 by the next grouped Dependabot bump, because a 0.x minor is not a semver-major and the existing ignore rule let it through. The lock moved to 0.10.2 and the container host installed it on its next self-update, after which every itsup command failed on import: boot bringup, the nightly apply, the API and the monitor start. Restore the bound, relock to 0.6.7, and tell Dependabot to ignore logger releases from 0.7 so the bound is not rewritten again. Session: t3:5128ca34-972f-4682-ada6-678a5e45024e Human-Involved: true
The logs command took both from the logger's reader side, which the logger removed in 0.7.0 when its Python package became the writer SDK only. The CLI imports the logs command at start, so that one import kept every itsup command from starting on a current logger. itsUP now carries the two helpers in lib/log_reading.py. The follower keeps the behaviour the access log needs: it follows an existing file from its end and keeps going across truncation in place (copytruncate), replacement at the same path, and a file that is not there yet. Three things differ from the code it replaces. A line is held until its newline arrives, so --grep and --since see whole records, and a file that appears after the follow started is read from its beginning instead of from its end; the logger project's current follower does both. The file is read as bytes, so truncation is judged against a true byte offset and line endings pass through unchanged, as they already do when the file is read without --follow. The third-party note that documented the removed reader primitives as something itsUP reuses goes with the imports. Session: t3:5128ca34-972f-4682-ada6-678a5e45024e Human-Involved: true
Nothing in itsUP imports the logger's removed reader side any more, so the upper bound has no reason left. The requirement becomes a floor at the 0.10 line, the lock moves to 0.10.3, and the Dependabot rule that kept updates from lifting the bound is removed so the logger follows the same update path as every other dependency. The writer API itsUP calls, configure_logging and get_logger, has the same signatures on that release. The logging design follows: the diagnostic viewer is a standalone tool that the Python package no longer installs, the handler is no longer named after a class the logger replaced, and the read path of itsup logs is stated as itsUP's own. Session: t3:5128ca34-972f-4682-ada6-678a5e45024e Human-Involved: true
itsUP uses the organisation's one logger so that every project carries the same instruction for reading its own logs, `instrukt-ai-logs <app>`. An itsUP-owned reader stands against that: it is a second place to read logs, and because the CLI imported it at start, the reader helpers it borrowed from the logger package took every itsup command down when the logger dropped its reader side. Copying those helpers into itsUP kept the second reader alive under itsUP's ownership instead of removing it. The command, its helpers, its host-gate entry and the path helpers nothing else uses are gone. The CLI spec, the logging design, the host-boundary rules and the README state where each log is read with the tool that owns it: logger-written diagnostics with instrukt-ai-logs (the logger project's standalone tool, with its install step), the supervised units in the supervisor journal, and the Traefik access log as Traefik's own file. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
The README and the itsup domain's CLI surface still sent readers to `instrukt-ai-logs itsup --include monitor`. The monitor has logged to its supervised unit's stdout since it became a supervised daemon and writes no file in the logger's directory, so that instruction shows none of its current records. They now name the journal, where the records are. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
The Test workflow formats and lints `api` and `lib` and never starts `itsup`, so a dependency update that stops the CLI from importing merges green and fails first on the host, where boot bringup, the nightly apply and the daemon starts all go through that CLI. `make smoke` starts it from the synced environment and the workflow runs it after lint, so an import that no longer resolves fails the check before merge. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
Moving the API server and the security monitor onto the logger's files was meant to make `instrukt-ai-logs itsup` show everything itsUP's own code logs. The monitor runs as root with HOME pinned to the itsUP user. At the locked logger release the writer keeps each file private to the user that wrote it, and the reader refuses a merged read that includes a file it cannot open, so a root-run producer in that directory breaks the itsUP user's read instead of completing it. The backup job is already such a producer. The logging design now states this as a failure mode, together with the case where root is the first writer and locks the itsUP user out of its own state directory, and the README tells an operator what to expect on the container host. The daemons keep logging to the supervisor journal: making root and user share the directory is a change to the logger or to how the units run, not to itsUP's logging setup. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
…n which hosts The failure mode said a window shorter than the backup's last write skips the root-written file. The reader also fails in a short window: when nothing in the window matches, it reports the newest entry in the folder and opens the most recently written file to find it. A bare `instrukt-ai-logs itsup` therefore fails from a backup run that wrote to its file until the CLI next logs, which is the common state on a host. The text also said the backup runs as root on the container host without qualification. Only the systemd units run a producer as root; the launchd agents run as the user, whose files are then its own. The reader's behaviour is no longer attributed to the lock, which pins the writer only, and the claim that the monitor's file would fail every read is reduced to what is established: its unit runs as root. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
The recipe carried a guard for a missing environment: a conditional with its own error handling inside the Makefile, where no linter or reviewer of scripts sees it. The recipe now only names the CLI. A missing environment or an import that no longer resolves both end the recipe non-zero, so the Test workflow still fails before merge. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
The design said the default source is avoided because independent processes must not share one log file. The CLI and the two CLI-family one-shots do share the default file, and the logger writes each line whole so that they can. The sentence now states what the code does: a producer with its own trigger declares a source, the CLI family shares the default. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
This branch starts at the head of the logger-reader removal and is read as a diff against main, so it carried that branch's rejected smoke recipe and the incorrect default-source sentence. Merging the fixed head keeps this branch's tree equal to that head plus its own two documentation commits. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
… included The failure mode stated that a read with nothing matching fails when the root-written file holds the newest write, without excluding `--follow`. The reader looks for the newest entry only when it is not following; a follow starts without an error and drops the file it cannot open, so the backup's later lines are silently absent. The cases are now laid out by what the reader does: the file inside the window, the file before the window without follow, and the file before the window with follow. Earlier wordings named one failing case at a time and each left another path misdescribed. Session: t3:thread:delegated-task:command%3Amcp%3A90097403-c516-484c-8d66-e31ba569c0c1%3Adelegate-task%3A07981b9a-bc91-45b2-a78c-d360166c6c63 Human-Involved: true
|
Closing without merging. Three independent reviews each found another case the text got wrong: first the window condition, then The repeated misses come from the shape of the change, not from the wording: it restates the logger's reader behaviour case by case inside itsUP's design, for a state itsUP should not be in. The logger's contract is that only the producing user reads the logs and that root appears nowhere; itsUP's two root-run systemd units write into the itsUP user's folder with That is to be fixed in how those units run and log, not documented as a matrix. The findings and reproductions from the three reviews carry over to that change. |
Builds on #150. The base is
main, and this branch contains #150's head (d8fa92c, taken by merge commit6a4b28e), so until #150 merges the diff here also shows #150's commits. The commits that belong to this PR are4378182,172337dandcf0ad12, documentation only; against #150's head the diff isREADME.mdanddocs/project/design/logging.md.Why
The goal was for the API server and the container security monitor to write their diagnostics through
instrukt_ai_logging, so thatinstrukt-ai-logs itsupshows everything itsUP's own code logs. That work stopped before any code changed: a root-run process and the itsUP user cannot share the logger's directory without breaking the user's read. Under systemd the monitor's unit runs as root withHOMEpinned to the itsUP user, and the backup job's unit already does. The launchd agents run as the user and are not affected.Making that sharing work is a change to the logger, or to which user the units run as. It is not something itsUP's logging setup should work around, so this PR records the limit and changes nothing else.
What was established
At the locked logger release (0.10.3):
docs/contract.md, File handling) and writer source at tagv0.10.3; observed in a local run.HOMEpinned to that user (the order on an installed host): root's file is owned by root inside the user's directory, the user cannot read it, and the user's own writes keep working.configure_loggingthen raisesPermissionError. For itsUP that means the CLI does not start.Permission deniedand no lines at all, with or without--follow. Last written before the window, without--follow: readable lines in the window print and the exit is 0; when nothing matches, exit 1 withPermission deniedif that file holds the folder's most recent write (the no-match note opens it to find the newest entry), and the note with exit 0 if a readable file does. Last written before the window, with--follow: no error, the follow runs on the readable sources until interrupted, and lines written to the unreadable file afterwards never appear, with empty stderr.--include <source>limited to readable sources reads and follows in every case.v0.10.3and run locally against a directory holding one unreadable file, each case by itself;reader.rs(execute,follow) andmerge.rs(newest_log_timestamp) at that tag. The no-match and follow cases were found in review and reproduced here.docs/design.mdand contract, Rotation.Consequence: on a systemd host a bare
instrukt-ai-logs itsupfrom the itsUP user fails from a backup run that wrote to its file until the CLI next logs, any window that reaches back to that write fails too, andinstrukt-ai-logs itsup --followoutside that window runs but silently leaves the backup's lines out. The monitor's unit also runs as root, so routing its diagnostics through the logger would add a second such file, written on every event it logs.What changes here
docs/project/design/logging.md: two failure modes (a root-written file in the itsUP user's diagnostic folder; root as the first writer), the ownership ofbackup.log, and a corrected reading flow that no longer promises the itsUP user can readbackup.log.README.md: what an operator sees on a systemd host and which command still works.No code, no unit files, no dependency change.
Also grounded, for whoever takes the daemon move further
monitor.logthrough the logger, as root. That delivery moved both daemons to the supervisor journal so that records survive a restart, rotate under host policy, and are readable regardless of which user ran the process. The third reason is this same ownership problem; older logger releases created files under the process umask, which is why it did not show then.configure_logginginstalls exactly one root handler, the file writer. A daemon that moves to the logger stops attaching its own stdout handler; nothing is duplicated to stdout by the library.lib/alerting.pyreads the failed unit's last journal lines. Once a daemon's diagnostics leave the journal, an alert carries only what the supervisor itself captured (start, stop, crashes, anything printed before logging is configured) unless the alert composer also reads the logger's file.Verified
instrukt docs validateandinstrukt docs render --checkpass on this head.Not verified
backup.logisroot:root 0600inside the user's0700folder, a long-windowinstrukt-ai-logs itsupas the itsUP user fails on it with a permission error, and the installed reader is still the pre-0.7 Python script.bin/format.shandbin/lint.shwere not run on this head: it changes no Python.