fix(agent): set the override owner on the temp file before the rename (#24)

This commit is contained in:
2026-10-13 09:25:18 +02:00
parent 92b1a0835e
commit cf9c0c4b10
5 changed files with 185 additions and 128 deletions
+6 -3
View File
@@ -98,9 +98,6 @@ DATABASE_URL=postgres://... go test -tags integration ./internal/master/store/
without the other has caused a fix commit already.
- **`<summary>` C# convention from global CLAUDE.md does not apply here** — this
is Go. Use idiomatic GoDoc (`// FuncName does X.`).
- **The override file gets the owner of the existing override, else of the stack's first
compose file.** The agent runs as root and renames a new file into place; it chowns it
afterwards. A failure is a `warning:` line in the job output, never a failed job.
- **Compose loads only one override file.** Of `compose.override.yml`,
`compose.override.yaml`, `docker-compose.override.yml`, `docker-compose.override.yaml`
only the first that exists is read. Hence the refusal described above.
@@ -108,6 +105,12 @@ DATABASE_URL=postgres://... go test -tags integration ./internal/master/store/
agent's own jobs always pass it explicitly.
- **Override entries are never pruned.** A service deleted from the stack file keeps its
`image:` line in `compose.override.yaml`.
- **The override file gets the owner of the existing override, else of the stack's first
compose file.** The exception is a root-owned existing override (written before this
fix): then the compose file's owner is used, so it stops being root-owned. The agent runs
as root, so `WriteOverride` chowns the open temp file before the rename (never the path
afterwards: a symlink could be swapped in). A failure is a `warning:` line in the job
output, never a failed job.
- **There is no `STACKS_ROOT`.** Stack directories must be mounted read-write at the host
path (`/path:/path`), and `SELF_ID` must resolve to the agent's own container. On Docker
Desktop/OrbStack bind sources are translated, so Compose jobs fail there.