Skip to content

feat: make the work commands clients of the work list API - #228

Merged
outofcoffee merged 9 commits into
mainfrom
work-commands-api
Sep 16, 2026
Merged

outofcoffee merged 9 commits into
mainfrom
work-commands-api

Conversation

@outofcoffee

Copy link
Copy Markdown
Collaborator

Make spinloop work a client of the orchestrator's work list API, so an orchestrator running on another machine is reachable from the shell and from clients such as a GitHub action.

Summary

  • BREAKING: spinloop work add, list, abort and remove no longer work the items file and the state beside it directly; they call the work list API the orchestrator serves.
  • Each subcommand takes --url, the API's base address, and presents the API's token as a bearer — --api-token, else --api-token-file, else SPINLOOP_API_TOKEN, resolved through the same daemonToken helper the daemon uses; two token flags at once is a refusal. The --items flag is removed: the file the API works belongs to the run.
  • The API's calls are synchronous — the run does the work and answers once it is done — so the client-side file checks, the abort marker, and the bounded waits for a run to take a change in go away. A refusal is the command's error, read the way the API states it, so an idempotent caller reads the same text as before.
  • Tests rewritten against a test server standing in for the API; cmd/spinloop coverage holds at 92.1%.
  • Docs: docs/commands/work.md rewritten for the API; the cross-references in docs/work-items.md, docs/commands/orchestrator.md and docs/README.md now describe the commands as the API's client.

Implementation details

  • The openspec change work-commands-api rides in this branch: its delta removes the file-working requirements of the work-commands spec and adds the work list client requirements; the change is archived after the merge.
  • internal/orchestrator is unchanged: it still serves the API and works the file. Only the CLI that calls it changes.
  • Migration for a caller: --items <file> becomes --url <the address the run prints> plus the API's token, where the run serves one.

@outofcoffee outofcoffee added enhancement New feature or request go Pull requests that update go code labels Sep 15, 2026
Replaces the file-based work command requirements with the work list
API client requirements now that the implementation has landed.
work list joined its columns with raw tabs, so an id longer than one
terminal tab stop (8 columns) threw every column after it out of line.
Compute each column's width from the list and pad with spaces instead.
The work list API now serves clients over the network (the CLI, CI
actions), so a refusal or a fault needs to show up in the orchestrator's
own log, not just in the caller's reply. Every call is logged with its
method, path, status and duration once answered, graded by status: a
refusal is a warning, a fault an error, an ordinary answer debug.
Aligned columns without a heading still left the reader to already know
the column order. The table opens with a heading row naming each
column, dimmed the way the state colour draws only on a terminal.
"work list api call" read as if it named the work list subcommand
rather than a call to the API — renamed to "api call". Also drop the
add handler's own "item added" line: WorkList.Add already logs it,
so every accepted add was logged twice.
…ent has stopped

Abort detached the item's inflight entry and record before its agent
had actually exited, so a pass landing in that window saw the item as
free backlog and launched a second agent into the same directory while
the first was still shutting down. The first agent then had nothing
tracking it: not in inflight, so nothing waited for it, killed it, or
folded its outcome into the record.

Abort now holds the id out of admission until the agent it is stopping
has actually ended.
…fleet-orchestrator specs

Adds the heading row / column alignment scenario to work-commands'
listing requirement, and the call-logging paragraph and scenario to
fleet-orchestrator's work list API requirement, matching what the
change actually implemented.
@outofcoffee
outofcoffee marked this pull request as ready for review September 16, 2026 09:32
@outofcoffee
outofcoffee merged commit 61e4cd8 into main Sep 16, 2026
3 checks passed
@outofcoffee
outofcoffee deleted the work-commands-api branch September 16, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant