Skip to content

feat: add spinloop work logs - #237

Merged
outofcoffee merged 6 commits into
mainfrom
work-logs-command
Sep 19, 2026
Merged

outofcoffee merged 6 commits into
mainfrom
work-logs-command

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

Adds spinloop work logs as a client of the work list API's existing log endpoint, following on from #228.

Summary

  • spinloop work logs <id> prints an item's kept agent output through GET /v1/items/{id}/log
  • -f/--follow polls for new output and streams it as it arrives, waiting through backlog and running, ending once the item is done, failed, removed, or the operator interrupts
  • An item with no output yet prints as empty, not a fault; an id the run does not carry is refused, naming it

Implementation details

Follow reuses followUntilInterrupted, the same wiring fleet logs -f and remote logs -f already share. Each poll re-fetches the whole log (the endpoint has no offset/range parameter) and prints only the new suffix; it also checks the item's own state via the existing list endpoint rather than adding a new one.

Closes #231

spinloop-agent added 4 commits September 19, 2026 11:23
Reads an item's kept agent output through the existing GET
/v1/items/{id}/log, the same --url/token shape as add/list/abort/remove.
-f/--follow polls for new output and prints it as it arrives, waiting
through backlog and running, ending once the item is done, failed,
removed, or the operator interrupts — reusing followUntilInterrupted, the
same wiring fleet logs -f and remote logs -f already share.
Every function in work_logs.go now hits 100% statement coverage: the
malformed-answer and unreachable-API branches in workLogFetch/
workItemState, a real API failure propagating out of the follow loop
(distinct from a clean "item removed" end), the -f flag actually driven
through the real command rather than only the polling loop directly, and
printWorkLogSuffix's fallback when the kept output does not still start
with what was already printed.
@outofcoffee outofcoffee added the enhancement New feature or request label Sep 19, 2026
work logs/abort/remove all take a positional item id with no
ValidArgsFunction set, so tab completion fell through to Cobra's default
and offered filenames from the working directory — never valid ids. None
of the three has a local registry to draw real ids from (an id only
means anything against a specific run's work list, reached over the
network), so itemIDSlot only suppresses file completion.
@outofcoffee
outofcoffee marked this pull request as ready for review September 19, 2026 14:09
@outofcoffee
outofcoffee merged commit 6f2cb69 into main Sep 19, 2026
3 checks passed
@outofcoffee
outofcoffee deleted the work-logs-command branch September 19, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add spinloop work logs

1 participant