Compare commits

...
144 Commits
Author SHA1 Message Date
sam cdbdbbc72d chore(release): v1.61.3
deploy / plan (push) Successful in 7s
deploy / agent-image (push) Successful in 2m44s
deploy / gate (push) Successful in 15m51s
deploy / archied-image (push) Successful in 3m32s
deploy / dist-zip (push) Successful in 3m17s
2026-11-08 15:47:31 +00:00
sam 2a04abb84e docs(ui): note the merged agent-profiles and harness settings page
deploy / dist-zip (push) Skipped
deploy / plan (push) Failing after 1s
deploy / agent-image (push) Skipped
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
2026-11-09 02:09:58 +11:00
sam 98f5af3eef refactor(ui): merge the harness settings page into agent profiles
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / plan (push) Failing after 2s
deploy / gate (push) Skipped
The harness page's setup terminal targets the Kit agent profiles, so the
two pages were two halves of one flow split across routes: with no Kit
profile the harness page dead-ended in a disabled 'No profiles
configured' select while the place to create one sat on another page.

/settings/agent-profiles now carries the profiles editor and a 'Harness
sign-in' section (setup terminal plus the credential-bindings sign-in
table), and /settings/harness redirects to it. The bindings re-read when
a terminal session ends so a fresh capture shows immediately, and a
null-seeded agent-profiles document now renders the empty state instead
of a bare add form. The gateway page registry names the merged page.
2026-11-09 02:03:20 +11:00
sam d1b1bac4fb fix(presence): list only running agents; a finished task's agent is not stale
deploy / plan (push) Failing after 1s
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 01:53:42 +11:00
sam 45b368af2e docs(agentexec): drop history and refactoring narration from comments
deploy / plan (push) Failing after 2s
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 01:45:07 +11:00
sam 0f6448c048 refactor(agentexec): delete unused runner injection seams, ServeCaptureMCP, an unreachable approval branch and orphan fixtures
deploy / plan (push) Failing after 1s
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
2026-11-09 01:43:53 +11:00
sam b15858adc9 fix(agentexec): clip tool detail on a rune boundary, stop resuming without a session, keep captures when the ready marker fails, log with context
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / plan (push) Failing after 1s
deploy / gate (push) Skipped
2026-11-09 01:41:46 +11:00
sam 1ef576ca7b fix(agentexec): run gate commands as the harness user and reap the process group after each invocation
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / plan (push) Failing after 7s
2026-11-09 01:40:10 +11:00
sam 50cb0b4276 fix(agent): point toolchains at their cache volumes so pnpm's store stays out of the worktree (#1815)
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / plan (push) Failing after 2s
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 01:35:18 +11:00
sam 472478cf83 refactor(state): delete the unused ArmedBindingsForSource RPC and query
deploy / plan (push) Failing after 2s
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 01:22:02 +11:00
sam 90c7d137fb fix(ui): embed only the Latin IBM Plex subsets, woff2 only
deploy / plan (push) Failing after 1s
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
2026-11-09 01:21:07 +11:00
sam 2d51cf5106 perf(daemon): dispatch captured events every second instead of every poll_interval; match bindings in memory
deploy / archied-image (push) Skipped
deploy / plan (push) Failing after 2s
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
2026-11-09 01:19:50 +11:00
sam 1167f8a51e docs: add the Archie mark, wordmark, app icon and social card; show the wordmark in the README
deploy / gate (push) Skipped
deploy / plan (push) Failing after 1s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 01:11:08 +11:00
sam 17e6e66e72 refactor(archied): delete the file-configured forge webhook receiver; forge webhooks arrive through event capture (#1817)
deploy / plan (push) Failing after 2s
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
2026-11-09 00:50:00 +11:00
sam fa76f4c994 fix(worktree): sign and attribute agent commits at push; forge git credentials (#1816, #1817)
deploy / agent-image (push) Skipped
deploy / plan (push) Failing after 7s
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-09 00:11:54 +11:00
sam 21a523bd35 fix(gateway): report why curators are disabled instead of never reporting
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / plan (push) Failing after 2s
2026-11-09 00:11:03 +11:00
sam db377380a0 perf(ui): load route pages on demand
deploy / plan (push) Failing after 32s
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
2026-11-09 00:05:39 +11:00
sam 81fcea7a03 fix(ui): keep blocked tasks out of pinned activity alerts 2026-11-09 00:05:39 +11:00
sam 011d22c24c fix(ui): read board and alerts once on load, not again on the first stream connect 2026-11-09 00:05:39 +11:00
sam 83c8614418 fix(statestore): start service health grace at boot, not at a peer's last report 2026-11-09 00:05:39 +11:00
sam ac98b68bda feat(archied): connection commit identity and SSH commit signing (#1816)
deploy / plan (push) Failing after 2s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
2026-11-09 00:05:32 +11:00
sam ad63692781 fix(archied): sign connection commits with the connection account (#1815)
deploy / plan (push) Failing after 12s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
2026-11-08 23:57:40 +11:00
sam 090b220d25 fix(ui): label resolved alerts in the activity feed
deploy / plan (push) Failing after 1s
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Skipped
2026-11-08 23:56:41 +11:00
sam 514219b6a5 chore: ignore the pnpm store agents create in the worktree
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / plan (push) Failing after 4s
deploy / agent-image (push) Skipped
2026-11-08 23:53:17 +11:00
sam 6a5ba67cf5 ci: keep the golangci-lint cache between quality runs
deploy / dist-zip (push) Skipped
deploy / gate (push) Skipped
deploy / plan (push) Failing after 10s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
2026-11-08 23:34:33 +11:00
sam c09ece6064 fix(webui): hash, cache and gzip dashboard assets
deploy / plan (push) Failing after 8s
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-08 23:32:25 +11:00
sam 43ba64684e fix(webui): start a fresh event stream at recent activity, not the whole events table
deploy / plan (push) Successful in 25s
deploy / archied-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 2m38s
deploy / agent-image (push) Canceled after 0s
2026-11-08 23:29:40 +11:00
sam 67fa57008e fix(ui): read alerts once per event burst, not once per replayed event
deploy / plan (push) Failing after 1s
deploy / gate (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
2026-11-08 23:21:06 +11:00
sam 074ebbd931 fix(chat): keep long turns alive, record and log why a turn failed (#1813)
deploy / gate (push) Skipped
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / plan (push) Failing after 1s
2026-11-08 23:03:04 +11:00
sam 10d23e3e06 fix(ui): compare live reloads structurally instead of serialising them (#1812)
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 1m35s
deploy / plan (push) Successful in 26s
2026-11-08 23:01:10 +11:00
sam 6a4e1964f6 refactor(chat): one send path, drop POST /api/chat/message
deploy / plan (push) Successful in 8s
deploy / archied-image (push) Skipped
deploy / gate (push) Failing after 13m53s
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-08 18:34:26 +11:00
sam 5939ef6ff1 fix(postgres): write no audit row when retention prunes nothing (#1810)
deploy / archied-image (push) Successful in 2m55s
deploy / plan (push) Successful in 10s
deploy / agent-image (push) Successful in 12s
deploy / gate (push) Successful in 8m29s
deploy / dist-zip (push) Skipped
2026-11-08 17:27:30 +11:00
sam 1d9eff6529 fix(ops): log cancelled contexts at debug, one reconnect line per outage (#1809) 2026-11-08 17:27:30 +11:00
sam 6ae7f319cb fix(staterpc): log the cause of run credential lookup failures (#1808) 2026-11-08 17:27:30 +11:00
sam 260e9fc46e fix(agentworker): stop reporting task worker presence (#1807) 2026-11-08 17:27:30 +11:00
sam 52b5740c39 fix(daemon): cap tasks per issue poll and wait for disk before cloning (#1805)
deploy / plan (push) Successful in 1m6s
deploy / gate (push) Canceled after 11s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-11-08 17:26:00 +11:00
sam d11a0cd245 fix(workflow): one baseline fix per repository revision, drop download noise from gate output (#1806)
deploy / archied-image (push) Canceled after 0s
deploy / gate (push) Canceled after 1m2s
deploy / plan (push) Successful in 14s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
2026-11-08 17:23:21 +11:00
sam 860b2c85e0 fix(taskstate): retry transient parks with backoff, escalate when exhausted (#1804)
deploy / gate (push) Canceled after 2m21s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / plan (push) Successful in 16s
2026-11-08 17:19:14 +11:00
sam af7577625f refactor(messaging): store Telegram's connection in extension-settings (#1802)
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / gate (push) Canceled after 7m26s
deploy / plan (push) Successful in 11s
deploy / dist-zip (push) Canceled after 0s
2026-11-08 17:12:59 +11:00
sam 617a312ed5 ci(deploy): cancel superseded main deploys, never a release (#1801)
deploy / archied-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / plan (push) Canceled after 0s
deploy / gate (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
2026-11-08 17:11:56 +11:00
sam a7d202fb04 ci: drop comments from workflow scripts 2026-11-08 17:11:56 +11:00
sam 2a52508a5d fix(build): install protoc-gen-go and protoc-gen-go-grpc in the agent image
deploy / archied-image (push) Skipped
deploy / gate (push) Failing after 14m30s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Skipped
The in-container baseline task check failed at proto:check because buf
generate could not find either plugin on PATH, parking every task at
gate.repository.
2026-11-08 17:11:49 +11:00
sam 98fb9dfddf feat(workflow): task, workflow, step and model attributes on run, step and agent spans (#1803)
deploy / gate (push) Successful in 16m25s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 22s
deploy / archied-image (push) Successful in 7m25s
2026-11-08 17:00:42 +11:00
sam 64bb195700 perf(ui): mount row action dialogs only while open and keep unchanged live reloads (#1798)
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
deploy / gate (push) Failing after 13m59s
2026-11-08 16:55:59 +11:00
sam c8a46fd9e7 ci: drop comments from workflow files
deploy / gate (push) Successful in 16m26s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m53s
2026-11-08 16:55:03 +11:00
sam 93db9a6395 feat(extensions): typed extension settings (number, boolean, duration, list, select)
deploy / gate (push) Successful in 7m52s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m33s
2026-11-08 16:14:23 +11:00
sam 89808d0719 fix(extensions): list settings a version no longer declares and save only once they are removed
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Failing after 13m0s
deploy / agent-image (push) Skipped
2026-11-08 16:07:42 +11:00
sam ef99b7d74e fix(extensions): keep an extension's settings across removal and keys a version drops
deploy / archied-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Skipped
deploy / gate (push) Failing after 3m39s
2026-11-08 16:05:19 +11:00
sam 62ddbea0c1 fix(messaging): show a configured Telegram whose extension is not installed
deploy / gate (push) Failing after 8m12s
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Skipped
2026-11-08 16:00:29 +11:00
sam b548cabcbf refactor(publicnet): one public-address dial guard for webhooks, attachments and web fetch (#1795)
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / gate (push) Failing after 8m13s
deploy / dist-zip (push) Skipped
2026-11-08 15:52:39 +11:00
sam 8f37cc79cd feat(channels): package-declared channel settings on an instance Channels page (#1796)
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / gate (push) Failing after 8m32s
deploy / dist-zip (push) Skipped
2026-11-08 15:48:43 +11:00
sam 031521550a fix(ui): keep unchanged rows across live reloads on the dashboard and workflows (#1798)
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
deploy / gate (push) Failing after 8m11s
deploy / archied-image (push) Skipped
2026-11-08 15:09:06 +11:00
sam 3b67ef746f Merge pull request 'fix(daemon): claim and fetch tasks only while the dispatcher has room' (#1799) from fix/1797-claim-within-capacity into main
deploy / gate (push) Successful in 6m5s
deploy / agent-image (push) Successful in 15s
deploy / archied-image (push) Successful in 3m9s
deploy / dist-zip (push) Skipped
2026-11-08 03:53:07 +00:00
sam 18838105f0 ci(quality): run on pull requests only; deploy gates main
deploy / archied-image (push) Successful in 3m10s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m50s
deploy / agent-image (push) Successful in 15s
2026-11-08 14:50:29 +11:00
sam d70596f4bf Merge branch 'main' into fix/1797-claim-within-capacity
Quality / check (pull_request) Successful in 7m24s
2026-11-08 03:45:21 +00:00
sam a9878c329d Merge pull request 'fix(ui/tasks): keep unchanged rows across live reloads' (#1800) from fix/1798-task-list-stable-rows into main
deploy / gate (push) Successful in 4m39s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Successful in 6m40s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m27s
Reviewed-on: #1800
2026-11-08 03:45:13 +00:00
sam 558659bcf4 test(daemon): adopt go fix's promoted-field literal (#1797)
Quality / check (pull_request) Canceled after 2m32s
2026-11-08 03:37:54 +00:00
sam 00e7603932 fix(ui/tasks): keep unchanged rows across live reloads (#1798)
Quality / check (pull_request) Successful in 6m36s
2026-11-08 03:32:08 +00:00
sam 33f7323eb0 fix(daemon): claim and fetch tasks only while the dispatcher has room (#1797)
Quality / check (pull_request) Failing after 6m37s
2026-11-08 03:29:25 +00:00
sam 184038a918 fix(webui): link tasks to their repository connection's forge
deploy / archied-image (push) Successful in 3m2s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 44m46s
deploy / gate (push) Successful in 4m52s
2026-11-08 06:42:38 +11:00
sam 8cb76092b6 chore(release): v1.61.2
deploy / gate (push) Successful in 5m3s
Quality / check (push) Canceled after 12m5s
deploy / agent-image (push) Successful in 3m23s
deploy / dist-zip (push) Successful in 1m51s
deploy / archied-image (push) Successful in 3m6s
2026-11-08 06:30:16 +11:00
sam 49d7619ba3 fix(daemon): claim a requeued backlog without a poll wait per task
deploy / gate (push) Successful in 4m56s
Quality / check (push) Canceled after 6m11s
deploy / archied-image (push) Successful in 3m1s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
2026-11-08 06:24:54 +11:00
sam ae53e83ff3 chore(release): v1.61.1
Quality / check (push) Successful in 6m19s
deploy / archied-image (push) Successful in 3m0s
deploy / dist-zip (push) Successful in 2m41s
deploy / gate (push) Successful in 4m46s
deploy / agent-image (push) Successful in 3m16s
2026-11-08 06:04:33 +11:00
sam ef84e18f46 fix(ui): a new canvas workflow names the agent it runs as (#1622)
deploy / gate (push) Successful in 4m52s
Quality / check (push) Successful in 6m53s
deploy / agent-image (push) Successful in 11s
deploy / archied-image (push) Successful in 3m21s
deploy / dist-zip (push) Skipped
2026-11-08 05:49:40 +11:00
sam cf1be16763 fix(controlplane): repair a stored workflow collection that no longer validates (#1622) 2026-11-08 05:49:40 +11:00
sam cc8428643a fix(gatewayrpc): sniff the head of URL-only attachments (#1672)
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 12s
deploy / gate (push) Successful in 4m41s
deploy / archied-image (push) Successful in 3m37s
Quality / check (push) Successful in 7m2s
2026-11-08 05:40:27 +11:00
sam 70251ff3ce chore(release): v1.61.0
deploy / gate (push) Successful in 4m44s
deploy / agent-image (push) Successful in 3m35s
deploy / dist-zip (push) Successful in 2m39s
Quality / check (push) Successful in 7m16s
deploy / archied-image (push) Successful in 3m0s
2026-11-08 04:59:28 +11:00
sam 76dc34a17c fix(distribution): trust the rotated catalogue signing key (#1790)
Quality / check (push) Canceled after 5m9s
deploy / archied-image (push) Successful in 2m58s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m32s
deploy / agent-image (push) Successful in 12s
2026-11-08 04:54:32 +11:00
sam a6a0c7c11e fix(archied): say why the canary can't compare migrations
deploy / archied-image (push) Successful in 2m57s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m41s
Quality / check (push) Successful in 6m27s
2026-11-08 03:05:29 +11:00
sam f759387eb7 chore: ignore the fleet run directory 2026-11-08 02:48:29 +11:00
sam 21b3591da1 fix(e2e+ui): e2e checks for the audit's failure classes, and the gaps they caught (#1767)
deploy / gate (push) Successful in 4m48s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m31s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Successful in 6m11s
loading-errors now forces each list API (/api/tasks, /api/captures,
/api/event-types, /api/tokens, /api/access/policies) to fail and asserts
the page shows its error surface, never its empty-state copy.
accessibility gains two static-route sweeps: every input/textarea/select/
button must have an accessible name, and every keyboard focus stop's
indicator (ring var, outline, shadow or focus border) must clear 3:1
against the background behind it. phone-overflow sweeps every static
route at 390x844 for horizontal scroll. The sweeps caught real gaps,
fixed here: the DurationInput amount input had no accessible name and
its unit select no focus indicator, and TabsContent and CodeBlockContent
were focusable with outline-none and no ring. The stale 'Sections' list
selector now matches the nav landmark.
2026-11-07 17:08:10 +11:00
sam e9937ded6b fix(ui): a failed answer keeps the question card and its filled-in answer (#1728)
Quality / check (push) Successful in 9m2s
deploy / gate (push) Successful in 4m49s
deploy / archied-image (push) Successful in 3m25s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 11s
answerAsk now clears the pending question only after api.chatAnswer
accepts it, and resolves whether it did. On failure the new askError ref
carries the message, shown on the card as a ReadError whose Retry resends
the last answer; ChatAskCard keeps the typed reply until acceptance and
routes every choice button through the same path, and the questionnaire
submits through the card so its answers are retryable too. askError resets
on turn start, on a new ask, and on conversation switch.
2026-11-07 01:23:10 +11:00
sam bd1acdd0cc fix(ui): switching conversation detaches the running turn (#1729)
Quality / check (push) Canceled after 23s
deploy / archied-image (push) Successful in 3m24s
deploy / gate (push) Successful in 4m47s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
selectSession now bumps a session epoch and aborts the in-flight stream
before switching, and the transcript read is applied only if the session is
still current. sendMessage captures the epoch at turn start: a detached turn
stops reading, cancels the reader, and writes no messages, streamingTurn or
session id; only the turn still owning the abort controller clears isSending,
so it cannot unlock the composer for a turn running in the new conversation.
2026-11-07 01:20:49 +11:00
sam a2c6341544 fix(ui): policy form opens blank on New, id read-only when editing, dirty draft asks first (#1730)
Quality / check (push) Canceled after 4m48s
deploy / archied-image (push) Successful in 3m26s
deploy / gate (push) Successful in 4m52s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
New policy now resets the draft instead of reusing the open policy's, so
Save cannot overwrite the policy that happens to be open. The id input is
readonly while editing a persisted policy, so a rename can no longer write
a second policy. New/Edit/Cancel route through openForm, which asks for
confirmation before discarding a dirty draft.
2026-11-07 01:16:48 +11:00
sam cb3372ac76 fix(ui): terminal palette is theme tokens, switches live (#1739)
deploy / archied-image (push) Successful in 3m22s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 3m23s
deploy / gate (push) Successful in 4m51s
--terminal-bg/fg/cursor/selection are defined per theme in style.css
(dark keeps the deep well, light gets a paper inset) and exposed as
bg-terminal. Both xterm surfaces (SetupTerminal, SandboxView) read them
via lib/terminalTheme and re-apply on every data-theme flip, so the
theme switch is live; the raw #0b0f14/#e6edf3/#264f78 hex is gone.
2026-11-07 01:13:41 +11:00
sam 48e605a545 fix(ui): dead tokens replaced or deleted — text-ok, --radius-lg, real surface (#1740)
Quality / check (push) Successful in 6m33s
deploy / archied-image (push) Successful in 3m22s
deploy / agent-image (push) Successful in 11s
deploy / gate (push) Successful in 4m49s
deploy / dist-zip (push) Skipped
text-success was not a token (now text-ok) in ChatToolCall and BindEvent;
var(--radius) is undefined (now var(--radius-lg)) in input-group and Sonner;
Sonner's hsl(var(--popover) / 0.9) wrapped a hex (now a plain hex); the
undefined cn-font-heading class is deleted from the nine title components.
2026-11-07 01:06:42 +11:00
sam 9a4e59f0e0 fix(ui): tab, toggle, input and idle-text contrast meet their targets (#1741)
Quality / check (push) Canceled after 3m37s
deploy / archied-image (push) Successful in 3m24s
deploy / gate (push) Successful in 4m48s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Inactive tab labels use text-fg-muted instead of foreground/60 (was
4.1:1). The selected toggle/toggle-group segment gains a sage-deep ring
(5.3:1 light, 3.9:1 dark) instead of the near-invisible muted fill.
--input rises to 3.6:1 (light) and 3.5:1 (dark) on the card; dark --idle
rises to 5.1:1 on --accent. Values computed against the style.css tokens.
2026-11-07 01:03:19 +11:00
sam 820beda72f fix(ui): empty states wait for the first read to settle (#1742)
Quality / check (push) Successful in 6m42s
deploy / gate (push) Successful in 4m49s
deploy / archied-image (push) Successful in 3m27s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 11s
Skills, curators, QuickTask's workflow list, the alerts bell and the
extensions catalogue now show a loading state until the first read
settles, then the data, the error, or the empty state. Draft-backed lists
(agent profiles, playbooks, credential bindings) show their empty state
only once the draft exists, not beside the load error.
2026-11-07 00:54:25 +11:00
sam c6f70de82d fix(ui): settings pages show a skeleton or the error until their draft loads (#1743)
Quality / check (push) Successful in 7m32s
deploy / agent-image (push) Successful in 11s
deploy / archied-image (push) Successful in 3m27s
deploy / gate (push) Successful in 4m59s
deploy / dist-zip (push) Skipped
New settings/KindGate renders the store's per-kind loading/error state
where the form would be: a skeleton while loading, ReadError with Retry
on a failed read. Wired into Tools, SystemModels, SystemRepos,
SchedulingPolicy, ContainerRuntime, OrgAlerts, Instructions, Plugins,
SystemTasks, UpdateSettings, IdentityGrants, OrgModels, Channels and
Authentication pages, which no longer render blank until the draft
exists.
2026-11-07 00:42:28 +11:00
sam f37f6e2453 fix(ui): one error presentation with Retry across the dashboard (#1744)
Quality / check (push) Successful in 6m56s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 11s
deploy / gate (push) Successful in 4m58s
deploy / archied-image (push) Successful in 3m28s
New components/ui ReadError (destructive Alert + message + optional Retry)
is now the single read-error presentation, used by Versions, Services,
Canary, OrgAccess, Denials, Tokens, Audit, Extensions, Harness and the
Status page (one page-level error instead of one per card). PanelError is
the same alert for task panels, and TasksState's error kind, the attempts
panel and the task-log pane all offer Retry. Org policy save errors sit
beside the Save button instead of at the page top.
2026-11-07 00:33:49 +11:00
sam f7a999e317 fix(ui): failed task pages keep rows with an inline error; refreshes don't flash (#1745)
deploy / archied-image (push) Successful in 3m28s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Successful in 6m31s
deploy / gate (push) Successful in 4m49s
deploy / dist-zip (push) Skipped
A failed Load more or live refresh sets moreError beside the Load more
button instead of replacing the table; only a first-load failure takes
the table down. The no-match empty state says search covers loaded rows
when more pages exist. refreshAll keeps attempts/events (keep=true) and a
failed task-list read keeps the last known list, so panels no longer
flash to loading on every live update.
2026-11-07 00:25:36 +11:00
sam 45494d5b43 fix(ui): logs page error no longer flickers, live entries pruned, unavailable clears (#1746)
deploy / gate (push) Successful in 4m51s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 2m59s
deploy / agent-image (push) Successful in 11s
deploy / archied-image (push) Successful in 3m28s
readError is cleared only by a successful read instead of at the start of
every 5 s refresh, so an outage shows a steady error beside the stale
lines. liveEntries is pruned past 1500 (the list shows 1000) so the map
cannot grow unbounded. streamState leaves "unavailable" as soon as live
entries flow again.
2026-11-07 00:22:40 +11:00
sam 9ca9545847 fix(ui): alert state is shared; a failed dismiss keeps the alert and says why (#1747)
deploy / archied-image (push) Successful in 3m30s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Canceled after 3m8s
deploy / gate (push) Successful in 4m51s
deploy / dist-zip (push) Skipped
use-alerts.ts now holds the alerts/failed refs at module scope (wired once),
so the bell and the dashboard card see the same list. dismiss removes the
alert only after the server confirms; on failure it stays and the reason
shows in the bell. dismissAll reports any rejection and reloads.
2026-11-07 00:19:31 +11:00
sam fa14e7da80 fix(ui): chat failures are shown where they happen and leave the real state (#1748)
deploy / gate (push) Successful in 4m47s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Canceled after 1m18s
deploy / archied-image (push) Successful in 3m27s
deploy / dist-zip (push) Skipped
Mic permission failure shows an inline alert; setModel only switches on
server confirmation and reverts + reports in the transcript on failure;
a failed session refresh after a turn no longer becomes a retryable turn
error; a voice clip during a turn queues instead of dropping; blocked
localStorage falls back to a per-load channel id; a failed install offers
Retry/Not now again; rename/branch use a labelled Dialog instead of
window.prompt; a failed cancel is reported; a stopped turn no longer
blocks transcript reloads.
2026-11-07 00:17:44 +11:00
sam 12eea5eee3 fix(ui): destructive actions confirm via AlertDialog, naming the item (#1749)
deploy / gate (push) Successful in 4m49s
deploy / archied-image (push) Successful in 3m29s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Canceled after 7m10s
deploy / dist-zip (push) Skipped
Delete policy, remove member, revoke token, remove passkey and delete
source now open the shared AlertDialog confirmation that names the item,
matching the binding/mapping/event-type deletes that already confirmed.
2026-11-07 00:11:16 +11:00
sam ef623f6c68 fix(ui): rows keep table semantics; first-cell link/button is the focus target (#1750)
deploy / archied-image (push) Successful in 3m29s
Quality / check (push) Successful in 6m40s
deploy / gate (push) Successful in 4m59s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
DataTable, ActivityRow, LiveActivityCard's group row and CaptureRow no
longer put role=link/button, tabindex or aria-label on the <tr>. The row
keeps its mouse click handler; the first cell carries a real RouterLink
(DataTable rowLink) or button with the accessible name, so keyboard and
screen-reader users get a focus target and rows keep row/cell semantics.
The live-activity group row's disclosure button and open button are now
siblings, not nested.
2026-11-07 00:00:41 +11:00
sam ee2d19d011 fix(ui): real heading structure and a nav landmark for the sidebar (#1751)
deploy / gate (push) Successful in 4m52s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Canceled after 4m2s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m30s
CardTitle and EmptyTitle take an as prop (default h2) and render through
component :is, so card and empty-state titles are headings; Section passes
as="h2" under the page's h1. The sidebar menu list now sits in
<nav aria-label="Sections">.
2026-11-06 23:56:34 +11:00
sam 53c6b3e413 fix(ui): disabled reasons and truncated values reachable without hover (#1752)
Quality / check (push) Canceled after 4m7s
deploy / archied-image (push) Successful in 3m32s
deploy / gate (push) Successful in 4m49s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
Disabled New run and task-row buttons now carry their reason in a Tooltip
on a focusable wrapper (disabled buttons cannot take focus), and New run
says when the task list has not loaded. Truncated values (binding filter
and failure reason, activity rows, live alerts, event-type rule summaries,
source URLs, mapping field paths) are focusable spans whose full text is in
a Tooltip. The org switcher has distinct loading ('…' tile, 'Loading…')
and failed ('!' tile, 'Organisations unavailable') states.
2026-11-06 23:52:25 +11:00
sam d58125c0bc fix(ui): combobox pattern for the slash palette, named palette input, bound labels (#1753)
deploy / gate (push) Successful in 4m48s
Quality / check (push) Canceled after 4m45s
deploy / archied-image (push) Successful in 3m28s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
The composer textarea is now role=combobox with aria-expanded,
aria-controls and aria-activedescendant wired to the slash palette's
listbox ids. CommandInput has an accessible name. FieldLabels without a
control beside them are bound: for/id on selects, inputs, switches and
duration inputs across channels, curators and schedules pages, and
role=group + aria-labelledby/aria-label on the TagsInput, secret-ref and
rule row groups.
2026-11-06 23:47:41 +11:00
sam 029198ff61 fix(ui): generation-guard the remaining async loads and polls (#1754)
deploy / gate (push) Successful in 4m51s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 7m38s
deploy / archied-image (push) Successful in 3m26s
deploy / agent-image (push) Successful in 12s
Schedules, command palette, skills, repos, services, secret engines,
captures, event types, curators, sources, channels, mappings (list and
preview), dispatch links and workflow history now capture a generation
at request start and drop their writes unless still latest — the guard
logs/state.ts already used. A failed schedules poll keeps the last good
rows beside the inline error instead of replacing the table, and a
failed skills/secret-engines poll no longer clears the list.
2026-11-06 23:40:03 +11:00
sam 0b08fc5242 fix(ui): harness setup terminal reports the real failure and can be reopened (#1755)
Quality / check (push) Canceled after 5m18s
deploy / archied-image (push) Successful in 3m29s
deploy / gate (push) Successful in 4m48s
deploy / dist-zip (push) Skipped
deploy / agent-image (push) Successful in 11s
A websocket that never opened stays "failed" — onclose no longer
overwrites it with "closed", so the terminal says "Could not open the
setup terminal." instead of "The terminal session ended.". The terminal
emits ended when its session closes, and HarnessPage resets terminalOpen
on it (plus a Close terminal button), so reopening starts a fresh session
instead of requiring a page reload. The harness load failure now has a
Retry button.
2026-11-06 23:34:38 +11:00
sam 93609c7ab3 fix(ui): eleven small dashboard state bugs from the audit (#1756)
deploy / gate (push) Successful in 4m50s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Canceled after 3m13s
deploy / archied-image (push) Successful in 3m28s
deploy / dist-zip (push) Skipped
Install disables when no installable snapshot; retention hours is empty
until loaded instead of showing 0; the audit Action field carries all
comma-separated actions; saving a view over an existing name asks first;
"Password changed" is a notice, not a destructive alert; "Sign in
again" appears only on an expired session (classifyActionError) on
account, authentication and create-account; sign-out failure sets the
store error instead of an unhandled rejection; the workflow identity
select shows the seeded agent without writing it into the YAML;
unparseable durations show an inline error instead of snapping back;
CardAccordion keys items by id; curator add() explains a no-op.
2026-11-06 23:31:47 +11:00
sam 461d3dc1f7 fix(ui): phone-width overflows in the audit's flagged rows, with an e2e check (#1757)
deploy / agent-image (push) Successful in 11s
deploy / archied-image (push) Successful in 3m23s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m54s
Quality / check (push) Successful in 6m36s
Grants rows and toggle groups wrap with a smaller phone label; the token
form wraps and its input flexes; the sources name column caps at full
width and its action buttons wrap; the rule-editor condition row wraps
with a full-width phone select; the payload tree indents less and breaks
long JSON leaves; the topbar instance badge truncates; org agent rows
keep Assign inline and move Rename/Suspend/Retire into a MoreMenu. New
e2e check phone-overflow.cjs visits these views at 390x844 with seeded
data and asserts no horizontal scroll.
2026-11-06 23:23:16 +11:00
sam 94f79177a2 fix(ui): adopt the type scale across components/ui and pages (#1758)
deploy / archied-image (push) Successful in 3m20s
deploy / gate (push) Successful in 4m53s
Quality / check (push) Successful in 6m42s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
components/ui and the pages now use only the style.css scale:
text-[0.8rem]→text-label, text-[0.625rem]→text-micro, text-base/text-sm→
text-label (rows and controls), text-xs→text-caption (captions and
secondary text), text-lg/text-xl/text-2xl→text-title (panel and page
titles). Rendered markdown (ChatMarkdown/ChatInline/markdown.ts) keeps
Tailwind steps as the issue allows. 196 files, class-token swaps only.
2026-11-06 23:07:46 +11:00
sam 9169e9db09 fix(ui): hand-rolled cards, headings, captions and empties use components/ui (#1759)
deploy / archied-image (push) Successful in 3m24s
Quality / check (push) Canceled after 4m48s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m50s
Captions move from text-xs to the text-caption type-scale token across
the workflow/bind/schedule editors and curator card. The task page title
uses PageHeader's h1 classes. Hand-rolled boxes become Card (token
reveal, recovery code, pending extension update) or CodeView (install
progress); the startup-settings key/value table becomes MetadataList;
the harness empty row becomes TableEmpty; 'No tokens/dispatches/inputs/
removed' states become Empty; the step-editor problem line becomes a
destructive Alert. The risky-row danger tint in ToolsPage and
SystemReposPage now uses SettingRow tone="danger" instead of a
hand-written before: overlay (DANGER_ROW deleted).
2026-11-06 23:03:10 +11:00
sam 0d0cd09124 fix(ui): known lists use Select/TagsInput fed by the server catalogue (#1760)
deploy / gate (push) Successful in 4m36s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m17s
Quality / check (push) Successful in 8m37s
deploy / agent-image (push) Successful in 12s
Token lifetimes use Select instead of NativeSelect. Credential bindings
pick service from the store's credentialServices and organisation from
the org list (empty = default, via a sentinel). Curator and agent-profile
tools are TagsInput instead of comma text; curator model is a Select of
the configured providers' models from /api/config's catalog. Org and
system model pages pick provider class from the catalog's classes, and
SystemModelsPage's local CLASSES list is deleted. Chat model choice is a
Select of the server-served model list instead of a button row.

Left as free text because no server source exists: policy object kind,
curator memory engine, update channel labels, connection type default,
container default, step titles (x-step-types carries no titles).
2026-11-06 22:51:21 +11:00
sam 0dc5bf9a9b fix(ui): times honour the Appearance zone, one duration formatter everywhere (#1761)
Quality / check (push) Successful in 6m44s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 3m44s
deploy / gate (push) Successful in 4m54s
lib/format.ts gains shortTime(value, zone) and becomes the home of the
single duration() formatter (moved from timeline-event.ts, which
re-exports it so the stage rail and duration.test.ts are unchanged).
LogTable's time column, audit's From/To chips and chat session titles now
format in the zone chosen under Appearance instead of the browser's.
StepNode, schedule runDuration, labels formatMs and ChatToolCall all
delegate to duration(), removing the "12ms" vs "12 ms" vs "under 1 s"
split.
2026-11-06 22:21:45 +11:00
sam ca107f6977 fix(ui): failed draft save is retried, then shown — never dropped silently (#1731)
persistDraft retried only while draftState.saving was true, but
settings.replace clears saving in its finally before resolving false, so
the retry branch could never run and a failed putDraft vanished. It now
retries on a bounded schedule (5 attempts, 500ms apart) regardless of the
saving flag, and on final failure sets localError so the editor's alert
says the draft was not saved while the edit stays in the editor. The
alert also reads the draft store's own error (workflows.draftState.error)
instead of only the definitions store's.
2026-11-06 22:09:56 +11:00
sam 4dad1415e6 fix(ui): workflow reads keep their error instead of showing empty (#1732)
Triggers: a failed bindings/schedules read surfaces as an error with
Retry in TriggerSettings instead of "Manual runs only." Run stages: a
failed attempts read sets stagesError, shown with Retry above the canvas
instead of a bare canvas. Bind form: failed reads show an error with
Retry rather than empty pickers, and save refuses to mappingUpdate an
existing mapping unless the bindings list actually loaded. History: a
failed revisions read shows the error with Retry in the revision list,
and "No recorded changes" appears only after a successful read.
2026-11-06 22:06:25 +11:00
sam 5bf0a696c6 fix(ui): failed reads show an error with Retry, not an empty view (#1733)
Chat: a failed conversation load sets sessionError, shown in the
transcript with Retry instead of the empty invitation (it no longer goes
to statusText in the settings popover). Command palette: failed task or
workflow reads render a "Couldn't load … — Retry" item in that group.
Denials: the table no longer shows "No denials recorded" under an
error. Mapping form: failed captures/event-types reads show an error row
with Retry instead of "No captured events yet." or a silently empty
select. Channels: a failed status read keeps the last badges and shows
an error with Retry. Sources: read failures are separate from write
failures, shown with Retry, and a loaded-but-empty list gets an empty
state.
2026-11-06 22:01:03 +11:00
sam 7a8d948fcb fix(ui): drop stale async responses with a generation guard (#1734)
TasksPage load/loadMore, use-task-run keyedLoad, TaskLogs loadOlder and
EventsPage loadCounts now each capture a generation at request start and
drop their writes unless they are still the latest request, the same
guard logs/state.ts already uses. dropCaches also stales every in-flight
keyed read, so a 30s timeout's null can no longer overwrite a newer
successful response, and the task-log pager no longer writes a page
fetched under the old attempt or filter.
2026-11-06 21:52:55 +11:00
sam d90f7d48d0 fix(ui): step card header is a keyboard-operable button, Edit in its menu (#1735)
The step header in StepNode.vue was a div with @click and no role, so a
step could not be opened from the keyboard, and Edit existed only in the
right-click canvas menu. The header now renders as a real <button> (with
aria-expanded) whenever the step can toggle, so Tab/Enter/Space open it;
while renaming it stays a div so the rename input is not nested inside a
button. The actions menu trigger moved to an absolute overlay at the
card's top-right (same spot as before, with a matching spacer in the
header row) and gained an Edit item that toggles the step, matching the
canvas context menu.
2026-11-06 21:48:55 +11:00
sam c5a43f21aa fix(ui): accessible names on fields that had only placeholders (#1736)
Step editor fields (lead, compact rows, long/YAML textareas and the
compact boolean switch), the org policy editor (policy id, level,
workspace id, object kind/id, Cedar textarea), the binding constant
value input, the log search and the channel tags inputs now each carry
an aria-label. On TagsInput the aria-label moved from the root div,
where screen readers never reach it, onto the actual TagsInputInput.
2026-11-06 21:43:23 +11:00
sam d3fbb0842f fix(ui): focus rings at full strength for 3:1 contrast (#1737)
The shared components used focus-visible:ring-ring/50 (and the base
outline-ring/50), which measured 2.1:1 on light and 2.4:1 on dark --
under the 3:1 WCAG 2.4.11/1.4.11 requires. All ring-ring and outline-ring
tokens in ui/src now render at full strength (5.3:1 light, 5.7:1 dark),
matching the :focus-visible outline floor in style.css.
2026-11-06 21:39:37 +11:00
sam dafd426316 fix(ui): startup failure is a centred panel that retries on its own (#1738)
When /api/auth/status fails, App.vue now shows a centred card with the
logo, a plain 'Can't reach Archie' statement and the detail in a
destructive Alert (role=alert), and retries the read every 5s until it
succeeds instead of offering only a manual Retry link. errorMessage in
api.ts only reads text/plain bodies, so a proxy's HTML error page no
longer passes through as the detail; other content types fall back to
the status line.
2026-11-06 21:36:17 +11:00
sam bec374aa92 ci(quality): stop installing ripgrep and setting sysctl from the gate (#1710)
The check job now runs on the archie-quality self-hosted runner under an
unprivileged user, so the sudo apt-get install and sudo sysctl steps fail,
exactly as the deploy gate did before 3b372b4a. Both are host provisioning:
ripgrep is installed on the runner host and the userns restriction belongs in
sysctl.d. The namespace check stays, without sudo.
2026-11-06 21:30:33 +11:00
sam 85b21578d8 ci(release): name the missing DEPLOY_TOKEN before checkout, and list what a mirror needs
Quality / check (push) Successful in 3m46s
deploy / gate (push) Successful in 4m29s
deploy / archied-image (push) Successful in 2m53s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
Refs #1788
2026-11-05 00:33:18 +11:00
sam 03c25e7214 docs(workflow): say repo.commit never runs the checkout's git hooks
deploy / gate (push) Successful in 4m45s
deploy / archied-image (push) Successful in 3m0s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Successful in 3m44s
deploy / dist-zip (push) Skipped
Refs #1792
2026-11-05 00:26:20 +11:00
sam c30624a59e feat(workflow): a handoff starts a separate linked run of the next workflow (#1791)
Quality / check (push) Successful in 4m12s
deploy / gate (push) Successful in 4m42s
deploy / archied-image (push) Successful in 3m13s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
2026-11-03 20:56:03 +11:00
sam 3cf025fb4a fix(worktree): mirror fetch follows moved tags and rewritten branches
deploy / gate (push) Successful in 4m35s
Quality / check (push) Successful in 6m46s
deploy / archied-image (push) Successful in 2m55s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
2026-11-03 10:00:04 +11:00
sam 81b784876b fix(ui): live task updates refresh in place instead of flashing the loading state
deploy / agent-image (push) Successful in 11s
Quality / check (push) Successful in 3m52s
deploy / archied-image (push) Successful in 3m14s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m33s
2026-11-03 09:51:43 +11:00
sam 6c42f64bfa chore(release): v1.60.0
deploy / archied-image (push) Successful in 2m52s
Quality / check (push) Canceled after 18s
deploy / gate (push) Successful in 4m39s
deploy / agent-image (push) Successful in 3m21s
deploy / dist-zip (push) Successful in 1m47s
2026-11-03 09:51:30 +11:00
sam d74216c6b7 docs(changelog): curator issue tools (#1770)
Quality / check (push) Successful in 4m3s
deploy / archied-image (push) Successful in 2m49s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m42s
2026-11-03 09:43:45 +11:00
sam 0b7ce448ab fix(e2e): checks follow the sidebar navigation; trim stray button and caption whitespace (#1789)
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 3m52s
deploy / gate (push) Successful in 4m36s
deploy / archied-image (push) Successful in 3m16s
2026-11-03 09:35:19 +11:00
sam 2fb8c09a00 refactor(webui): extract the workflows module (#1778)
deploy / gate (push) Successful in 4m37s
deploy / archied-image (push) Successful in 2m51s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Successful in 4m23s
deploy / dist-zip (push) Skipped
2026-11-03 08:39:40 +11:00
sam 0442f1849f refactor(webui): extract the audit module and its export guards (#1778)
deploy / gate (push) Successful in 4m33s
deploy / archied-image (push) Successful in 2m52s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Canceled after 1m17s
deploy / dist-zip (push) Skipped
2026-11-03 08:38:22 +11:00
sam cf049797b0 refactor(webui): extract the schedules and alerts modules (#1778)
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 1m5s
deploy / gate (push) Successful in 4m33s
deploy / archied-image (push) Successful in 2m48s
2026-11-03 08:37:15 +11:00
sam 18e6fe6af6 refactor(webui): extract the chat module and its ask/file state (#1778)
deploy / gate (push) Successful in 4m35s
Quality / check (push) Canceled after 1m5s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m48s
deploy / agent-image (push) Successful in 11s
2026-11-03 08:36:09 +11:00
sam e8a84d3e41 refactor(webui): extract the control-plane and logs modules (#1778)
deploy / gate (push) Successful in 4m31s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 1m17s
deploy / archied-image (push) Successful in 2m49s
2026-11-03 08:34:51 +11:00
sam c5f4541cbf refactor(webui): extract the access policies and denials module (#1778)
Quality / check (push) Canceled after 1m5s
deploy / gate (push) Successful in 4m35s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m49s
deploy / agent-image (push) Successful in 12s
2026-11-03 08:33:46 +11:00
sam 369e5038ca refactor(webui): extract the identities and tokens module (#1778)
deploy / agent-image (push) Successful in 10s
deploy / dist-zip (push) Skipped
Quality / check (push) Canceled after 1m9s
deploy / gate (push) Successful in 4m34s
deploy / archied-image (push) Successful in 2m52s
2026-11-03 08:32:44 +11:00
sam 66862a1bab refactor(webui): extract the orgs resource module (#1778)
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 4m2s
deploy / gate (push) Successful in 4m39s
deploy / archied-image (push) Successful in 2m51s
deploy / agent-image (push) Successful in 11s
2026-11-03 08:28:36 +11:00
sam 25dcdb2d19 refactor(webui): extract the extensions resource module (#1778)
Quality / check (push) Successful in 5m1s
deploy / archied-image (push) Successful in 2m46s
deploy / agent-image (push) Successful in 10s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m35s
2026-11-03 08:22:02 +11:00
sam 1830a89898 refactor(webui): extract the harness resource module (#1778)
Quality / check (push) Successful in 3m56s
deploy / agent-image (push) Successful in 12s
deploy / gate (push) Successful in 4m34s
deploy / archied-image (push) Successful in 2m55s
deploy / dist-zip (push) Skipped
2026-11-03 08:17:12 +11:00
sam 6e718e165a feat(curator): issue_list and issue_create tools via the daemon (#1770)
deploy / gate (push) Successful in 4m30s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Successful in 4m6s
deploy / archied-image (push) Successful in 2m50s
deploy / dist-zip (push) Skipped
2026-11-03 08:12:05 +11:00
sam 0a37b551f5 refactor(webui): extract the tasks resource module (#1778)
Quality / check (push) Successful in 3m47s
deploy / agent-image (push) Successful in 10s
deploy / gate (push) Successful in 4m32s
deploy / archied-image (push) Successful in 2m51s
deploy / dist-zip (push) Skipped
2026-11-03 08:06:56 +11:00
sam 864b87faa6 refactor(webui): extract event-types, mappings and sources modules (#1778)
deploy / gate (push) Successful in 4m29s
Quality / check (push) Successful in 3m52s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m48s
deploy / agent-image (push) Successful in 11s
Same pattern as the bindings pilot: eventTypesAPI (registers unconditionally,
list answers enabled:false without a store), mappingsAPI and sourcesAPI
(constructed only when their store is configured, 503 stub otherwise).
Shared helpers unsignedSources/recentRefusals/listedIn stay on Server; the
dispatch-ledger handler stays shared for captures/tasks. task check green.
2026-11-03 07:42:50 +11:00
sam d55d8580cf refactor(webui): extract the bindings resource module (#1778)
Pilot for one-module-per-resource: bindingsAPI owns the /api/bindings*
routes and their handlers, constructed only when the binding store is
configured; a 503 stub mounts the same routes otherwise, preserving the
old not-configured answers. Handlers move off *Server unchanged in
behavior; the shared dispatch-ledger handler stays on Server for the
captures/tasks routes. task check green.
2026-11-03 07:01:12 +11:00
sam 63229d1711 refactor(storecontract): assert every store interface at its implementation (#1781)
Complete the var _ storecontract.X = (*T)(nil) sweep so each of the 31
contract interfaces is compiler-checked against at least one adapter:
postgres.Store (19), postgres.EDA (11, consolidated into edastore.go),
staterpc.Client (29). Removes the scattered single-line assertions from
harness_secrets.go, edastore_eventtypes.go, sources.go, run_credentials.go.
task check green.
2026-11-03 06:24:09 +11:00
sam 56044476fc chore(release): v1.59.0
deploy / archied-image (push) Successful in 2m45s
deploy / dist-zip (push) Successful in 2m35s
deploy / gate (push) Successful in 4m21s
deploy / agent-image (push) Successful in 3m15s
Quality / check (push) Successful in 3m53s
2026-11-03 06:15:09 +11:00
sam 796bfd0045 docs(changelog): forge extensions gain CreateIssue
deploy / gate (push) Successful in 5m16s
deploy / archied-image (push) Successful in 3m2s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 7m12s
2026-11-03 02:43:25 +11:00
sam abcb72a76a feat(curator): dry-run self-intake pass with run inspection tools (#1770)
Curators could only reach the workflow/integration tools; there was no way
to survey task runs. Adds run_list/run_events to the shared registry
(guarded as read on task kind), attaches the instance's acting principal
to curator model calls so guarded tools authorize, and records a pass's
final text as a pass.summary action so the report is inspectable. Ships a
dry-run self-intake definition in dev.toml/config.example.toml declaring
only those two tools, so it cannot file issues yet.
2026-11-03 02:35:06 +11:00
sam 443a7a501b refactor(storecontract): split the store contract into topical files (#1781)
Pure move: one 624-line storecontract.go becomes storecontract.go
(package doc + composed TaskStore), task.go, capture.go, binding.go,
mapping.go, source.go, status.go, resource.go, credentials.go and
errors.go. The package remains the single seam; no declaration changed
(verified line-identical against HEAD). task check green.
2026-11-03 02:27:57 +11:00
sam 88e86776e8 feat(forge): add CreateIssue to the forge contract (#1770)
deploy / archied-image (push) Successful in 2m54s
deploy / gate (push) Successful in 4m43s
deploy / agent-image (push) Successful in 11s
Quality / check (push) Successful in 4m10s
deploy / dist-zip (push) Skipped
Issue-level writes could comment and close but not open an issue, so no
curator or workflow stage can file its own work yet. Adds the rpc to
proto/forge/v1, regenerates the contracts, and threads it through the
domain interface, forgerpc client/server (comment permission, like
CloseIssue), forgeext, and the archipelago SDK + gitea/github plugins.
2026-11-03 02:04:56 +11:00
sam e10bb161fe docs(prds): mark the self-development ADR as decided, not built (#1769) 2026-11-03 01:52:06 +11:00
sam 3b525b7482 docs(prds): mark the self-development ADR as record, not mechanism (#1769) 2026-11-03 01:50:54 +11:00
sam c2cc10ebfa docs(prds): record the self-development loop decision (#1769) 2026-11-03 01:36:31 +11:00
sam 2f8076d7f8 fix(access): forbid clause scopes the canary grant against its developer role (#1727)
deploy / gate (push) Successful in 4m45s
deploy / archied-image (push) Successful in 2m53s
deploy / agent-image (push) Successful in 10s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 3m37s
Service accounts created through the identities API are assigned the
developer role in the request's org, whose shipped policy permits read and
write across the org -- the permit alone did not scope the canary. Install a
matching org-canary-grant-forbid policy (access.CanaryGrantForbidPolicy) that
negates exactly the permit's surface for the canary identity; a forbid wins
within the level, so the role can no longer widen access. Engine tests pin
the surface with the principal carrying the developer role, and the
rehearsal now proves it live: the scoped token gets 403 on /api/access/policies
and 200 on /api/chat/update, and the full canary loop runs on it.

task check passes; task canary:rehearse green (REHEARSE_EXIT=0).
2026-11-02 06:23:38 +11:00
sam c180a2debb feat(access): scoped canary grant replaces instance-admin CANARY_TOKEN (#1727)
deploy / gate (push) Successful in 4m48s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 3m49s
deploy / archied-image (push) Successful in 2m55s
deploy / agent-image (push) Successful in 11s
The canary now authenticates as a dedicated service-account identity in the
system org whose only grant is access.CalaryGrantPolicy: read the signal
endpoints (chat update, alerts, logs, tasks), read and write the
update-settings resource, and trigger an update install. CANARY_TOKEN no
longer carries instance admin; DEPLOY_TOKEN stays CI-only.

- authorize: POST /api/chat/update/install and /defer map to
  update on Object::"update" (dashboard) instead of run on any workflow,
  so the grant can cover installs without granting workflow runs
- accounts: active service-account identities may authenticate with bearer
  tokens (CanAct), not just users
- new POST /api/identities/{id}/tokens (behind manage_identities) mints a
  token for a named non-user identity; new AccountService RPC
  BindIdentityPersonalToken backs it remotely, refusing user-kind targets,
  with the caller recorded as audit actor
- engine tests pin the grant's exact allow/deny surface

RELEASING.md documents the one-time setup. task check passes on this tree.
2026-11-02 06:03:41 +11:00
sam 5356745968 fix(releaseupdate): address review findings on the #1725 canary change
deploy / archied-image (push) Successful in 3m11s
Quality / check (push) Successful in 3m39s
deploy / gate (push) Successful in 4m28s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
- one shared UpdateStateDir() resolver for daemon and dashboard, instead of
  two copies that could drift
- the recovery path for a committed/rolled-back journal writes
  installed.json too, so a crash after the outcome phase cannot lose the
  install record
- JudgeCanaryNow is the explicit signals-only entry point for promoting
  without the window, replacing the zero-install-time sentinel
- canary version comparisons use IssuedAt, matching Promote's replay rule,
  so semver/issued-at divergence cannot wedge check red; queuedBehind
  reuses the judgeable predicate instead of a looser check
- promote prints the channel/pin; promote.yml cancels superseded runs
- canary card: no duplicated elapsed rendering, channel row waits for the
  settings resource instead of showing a default, agent fallback '?'
- rehearsal script bounds its docker build/push/run calls

task check passes on this tree.
2026-11-02 02:45:26 +11:00
sam 5b5059615b feat(releaseupdate): judge the installed release, window from install (#1725)
deploy / archied-image (push) Successful in 3m14s
deploy / dist-zip (push) Skipped
deploy / gate (push) Successful in 4m31s
Quality / check (push) Successful in 4m2s
deploy / agent-image (push) Successful in 11s
The canary window now counts from when a release is installed on the host
(installed.json / installed_at in the update snapshot), not from the
statement's issued_at, and 'release canary check' judges the release the
canary actually runs via its exact-pin tag instead of the moving next tag.
A newer release on next queues behind the one being judged instead of
restarting the clock, so stable moves once per release.

New subcommands: canary status (read-only state, signals, verdict), canary
promote (promote now when hard checks pass), canary unpin (back to next),
and start -force. A held/pinned canary is verified installable every check
and a stranded pin fails the run red instead of looking green. Rollback
pre-flight checks stable's zip and agent image digests before pinning.
Relative signals are judged whenever both windows carry minimum data, so a
breach rolls back mid-window; promote still needs the full window unless
the operator promotes early (new promote.yml workflow_dispatch). The window
is configurable via -window / CANARY_WINDOW.

Also: dashboard canary status card (ui), and task canary:rehearse, a local
end-to-end rehearsal of publish -> canary start -> status -> check ->
promote against a throwaway registry and host.

task check passes; rehearsal run green (REHEARSE_EXIT=0).
2026-11-02 01:15:29 +11:00
sam bca1f3b412 chore(release): v1.58.1
deploy / agent-image (push) Successful in 3m18s
Quality / check (push) Successful in 3m43s
deploy / gate (push) Successful in 4m36s
deploy / archied-image (push) Successful in 2m52s
deploy / dist-zip (push) Successful in 2m37s
2026-11-02 00:27:14 +11:00
sam 3af96fd818 fix(daemon): watch the task intake loop too and name the stalled loop
deploy / gate (push) Successful in 4m30s
deploy / agent-image (push) Successful in 12s
Quality / check (push) Canceled after 26s
deploy / archied-image (push) Successful in 2m50s
deploy / dist-zip (push) Skipped
2026-11-02 00:26:50 +11:00
sam 1043982529 fix(daemon): stamp each run-loop cycle so the systemd watchdog keeps beating
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
Quality / check (push) Successful in 3m37s
deploy / gate (push) Successful in 4m27s
deploy / archied-image (push) Successful in 2m54s
2026-11-02 00:22:24 +11:00
553 changed files with 13819 additions and 7194 deletions

No files matched your search

+6 -10
View File
@@ -1,7 +1,3 @@
# Every 15 minutes, checks how the newest release on the `next` channel is
# running on the canary host. If a hard check fails, the canary goes back to
# the stable release straight away. If the release stays healthy for 24 hours,
# it's promoted to stable. A rollback fails the run, so it shows up red.
name: canary
on:
@@ -21,8 +17,6 @@ jobs:
if: vars.CANARY_URL != ''
runs-on: self-hosted
steps:
# Full history with tags: a rollback compares the migrations between
# the stable and failed release tags.
- name: Checkout
uses: actions/checkout@v4
with:
@@ -33,21 +27,23 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The self-hosted runner keeps the Go caches on disk between jobs, and
# archiving them for the Actions cache takes minutes.
cache: false
- name: Build archied
# The check never serves the dashboard, so the build leaves it out.
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
# Promotion retags stable and the images' latest in the registry.
- name: Log in to the Gitea registry
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
- name: Judge the canary
env:
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
CANARY_WINDOW: ${{ vars.CANARY_WINDOW }}
run: |
window_args=()
if [ -n "$CANARY_WINDOW" ]; then
window_args=(-window "$CANARY_WINDOW")
fi
"$RUNNER_TEMP/archied" release canary check -dashboard "${{ vars.CANARY_URL }}" \
"${window_args[@]}" \
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
+27 -103
View File
@@ -1,7 +1,3 @@
# Builds and pushes the archied and archie-agent images to the Gitea
# registry on every merge to main, and publishes the distribution zip as a
# release on this repository. Gitea Actions reads this .github/workflows/
# directory.
name: deploy
on:
@@ -9,20 +5,8 @@ on:
branches: [main]
tags: ["v*"]
# Rapid successive pushes to main (a release commit right after its
# preceding fix, say) previously queued a full gate+build for each one,
# several minutes apiece, with no caching -- so a burst of pushes left
# three deploys racing in parallel for the same runner capacity. Only the
# last one's images matter (each job pushes its image tags), so cancel a
# superseded run rather than let it fight for resources it can't use.
#
# Keyed on the commit, not github.ref: a release push lands main and its
# tag in one go, both pointing at the same commit -- on.push matches
# branches and tags both, so a single release push otherwise fires
# redundant builds of identical content that a ref-keyed group can't see
# as the same work.
concurrency:
group: deploy-${{ github.sha }}
group: ${{ startsWith(github.ref, 'refs/tags/') && format('deploy-release-{0}', github.sha) || format('deploy-{0}', github.ref) }}
cancel-in-progress: true
permissions:
@@ -30,20 +14,17 @@ permissions:
packages: write
jobs:
gate:
plan:
runs-on: self-hosted
outputs:
archied_version: ${{ steps.release_tag.outputs.archied_version }}
run: ${{ steps.release_tag.outputs.run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Read the release from the commit, not from github.ref. One release
# push carries main and both tags at the same SHA, and only one of
# those refs survives the concurrency group, so a ref-derived version
# is whatever won the race. The tag at HEAD is the same either way.
- name: Resolve archied tag at HEAD
id: release_tag
run: |
@@ -54,13 +35,32 @@ jobs:
else
echo "no release tag at HEAD; distribution zip will be skipped"
fi
run=true
case "$GITHUB_REF" in
refs/tags/*) ;;
*)
if [ -n "$version" ]; then
run=false
echo "the v$version tag push runs this commit; skipping the branch run"
fi
;;
esac
echo "run=$run" >> "$GITHUB_OUTPUT"
gate:
needs: plan
if: needs.plan.outputs.run == 'true'
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The self-hosted runner keeps the Go caches on disk between jobs, and
# archiving them for the Actions cache takes minutes.
cache: false
- uses: pnpm/action-setup@v4
@@ -87,22 +87,12 @@ jobs:
git branch main origin/main
fi
# ripgrep and the unprivileged-userns sysctl are provisioned on the host.
# A self-hosted runner should not need sudo, and installing a package on
# every run is not the gate's job.
- name: Verify unprivileged user namespaces
run: unshare --user --map-root-user --net true
# The gate's uncached `go test ./...` runs the Docker-backed tests that
# -short skips, and those start a container from alpine:3. A fresh runner
# has no such image, so the suite failed on "No such image: alpine:3".
- name: Pull test container images
run: docker pull alpine:3
# One definition of the gate, in the Taskfile. TEST_FLAGS is the one
# difference: the release runs the whole suite, uncached and including
# the Docker-backed tests -short skips. The diff after it asserts
# `task fmt` changed nothing.
- name: Quality gate
run: |
task check TEST_FLAGS=-count=1
@@ -148,9 +138,6 @@ jobs:
with:
fetch-depth: 0
# Deliberately NOT `github.sha`. On a tag push that is the ref's OBJECT id,
# and every release tag in this repo is annotated, so it names a tag object
# that cannot be checked out. Dereference it to the commit.
- name: Resolve the commit this ref points at
id: commit
run: |
@@ -167,30 +154,14 @@ jobs:
- name: Resolve component versions
id: versions
run: |
# One release stream: a `v*` tag names both components' versions.
RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)"
GATEWAY_VERSION="${RELEASE_TAG#v}"
RUNTIME_VERSION="${RELEASE_TAG#v}"
# `dev+<sha>` is what a build that is NOT a release reports, and it is
# honest now that such a build no longer publishes :latest: the version
# names the commit it came from, and the sha-<sha> tag makes it
# restorable. Before, this same string reached :latest minutes after a
# release and made the release's own stamping read as dev
# (archie-core-i5nb). (On an untagged push GITHUB_SHA IS the commit —
# the tag case is handled by the dereference above.)
[ -n "$GATEWAY_VERSION" ] || GATEWAY_VERSION="dev+${GITHUB_SHA:0:12}"
[ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="dev+${GITHUB_SHA:0:12}"
echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
echo "gateway=$GATEWAY_VERSION" >> "$GITHUB_OUTPUT"
echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT"
# :latest names the newest PROMOTED release, so a release publishes
# :v<version> and canary promotion moves :latest to it. A push to
# main publishes :edge (mutable, newest main) and sha-<sha>
# (immutable), so an ordinary commit never overwrites a release's
# stamping.
#
# `if` blocks rather than `[ -n "$X" ] && echo`: the latter returns
# non-zero when the test fails, and these steps run under `set -e`.
{
echo "archied_tags<<EOF"
if [ -n "$RELEASE_TAG" ]; then
@@ -214,7 +185,6 @@ jobs:
cache-from: type=gha,scope=archied
cache-to: type=gha,mode=max,scope=archied
agent-image:
outputs:
agent_digest: ${{ steps.agent.outputs.digest }}
@@ -226,7 +196,6 @@ jobs:
with:
fetch-depth: 0
# Annotated tags: dereference to the commit, as archied-image does.
- name: Resolve the commit this ref points at
id: commit
run: |
@@ -264,23 +233,9 @@ jobs:
cache-from: type=gha,scope=archie-agent
cache-to: type=gha,mode=max,scope=archie-agent
# Packages every host-run binary (archied, archie-gateway,
# archie-state-store, archie-ui, archie-messaging) as a
# linux/amd64 zip for a
# non-Docker install, plus archie-agent: it has no unit, but a Kit run
# mounts it from archied's directory, so a host without it parks them.
# It waits only for the agent image, whose digest
# release.json pins.
dist-zip:
needs: [gate, agent-image]
# Not gated on github.ref. A release is pushed as main plus both tags at
# one SHA, the concurrency group below collapses those into a single run,
# and the survivor is whichever ref happened to start last -- for
# v1.23.0 that was refs/heads/main, so this job was skipped and no zip
# was ever produced. Resolve the tag from the commit instead of trusting
# the ref that won the race, and skip only when there is genuinely no
# archied tag at HEAD.
if: needs.gate.outputs.archied_version != ''
needs: [plan, gate, agent-image]
if: needs.plan.outputs.archied_version != ''
runs-on: self-hosted
steps:
- name: Checkout
@@ -290,8 +245,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The self-hosted runner keeps the Go caches on disk between jobs, and
# archiving them for the Actions cache takes minutes.
cache: false
- uses: pnpm/action-setup@v4
@@ -303,7 +256,6 @@ jobs:
with:
node-version: "24"
# archied and archie-ui embed the dashboard.
- name: Build the dashboard
working-directory: ui
run: |
@@ -312,7 +264,7 @@ jobs:
- name: Resolve archied version
id: version
run: echo "version=${{ needs.gate.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
run: echo "version=${{ needs.plan.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
- name: Build linux/amd64 binaries
env:
@@ -321,22 +273,8 @@ jobs:
CGO_ENABLED: "0"
run: |
set -e
# Every process in the documented deployment ships in the zip, and
# every one of them carries the archied version it was cut from:
# they are one release, and an operator matching binaries by eye
# needs each to say so.
#
# That claim is load-bearing and this list is the whole of it: the
# v1.30.0 messaging extraction moved Telegram/email/webhook out of
# archied and nothing added archie-messaging here, so a host install
# ran on with a dead Telegram bot and no error anywhere
# (archie-core-1c01). TestDistZipShipsEveryHostCommand fails if this
# list and the copy list below stop matching the commands in cmd/.
ldflags="-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary -X github.com/samcharles93/archie-core/internal/buildinfo.Version=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/buildinfo.Runtime=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/app/agentworker.version=${{ steps.version.outputs.version }}"
mkdir -p dist
# Units first, then the binaries that run beside them without one.
# The agentworker stamp only lands in archie-agent; the linker
# ignores -X for a symbol a binary does not import.
for cmd in $(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json); do
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
done
@@ -354,8 +292,6 @@ jobs:
digest='${{ needs.agent-image.outputs.agent_digest }}'
test -n "$digest"
jq --arg image "git.catlow.cloud/sam/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json"
# README.md doesn't exist yet in this repo; include it once it does
# rather than fail the release on its absence.
[ -f README.md ] && cp README.md "$name/"
zip -r "$name.zip" "$name"
echo "name=$name" >> "$GITHUB_OUTPUT"
@@ -367,10 +303,6 @@ jobs:
path: ${{ steps.zip.outputs.name }}.zip
retention-days: 90
# Installs and updates take a release from the signed artifact in the
# registry, so this is what publishes it: the statement signed with
# RELEASE_SIGNING_KEY and the zip, tagged v<version> and next. stable
# moves only when canary.yml promotes it.
- name: Log in to the Gitea registry
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
@@ -388,8 +320,6 @@ jobs:
-agent-image "git.catlow.cloud/sam/archie-agent@${{ needs.agent-image.outputs.agent_digest }}" \
-changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$version"
# The release page carries this version's changelog section, the
# release's own reviewed prose; the signed statement links to it.
- name: Publish the Gitea release notes
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
@@ -410,7 +340,6 @@ jobs:
api="https://git.catlow.cloud/api/v1"
repo="sam/archie"
auth="Authorization: token $DEPLOY_TOKEN"
# Idempotent: a re-run replaces the release on the tag.
curl -sf -X DELETE -H "$auth" "$api/repos/$repo/releases/tags/$tag" >/dev/null || true
curl -sf -X POST -H "$auth" -H "Content-Type: application/json" \
-d "$(jq -n --arg tag "$tag" --arg name "Archie v$version" --arg body "$(cat "$notes")" \
@@ -418,17 +347,12 @@ jobs:
"$api/repos/$repo/releases" >/dev/null
echo "published release notes for $tag"
# The canary host follows the `next` channel. canary.yml then decides
# whether this release is promoted to stable or the canary is rolled back.
- name: Install the release on the canary
if: vars.CANARY_URL != ''
env:
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
run: ./dist/archied release canary start -dashboard "${{ vars.CANARY_URL }}" -version "${{ steps.version.outputs.version }}"
# A Gitea package belongs to its owner, not a repository, so the ones this
# workflow publishes are linked here. Linking is per package and a no-op
# once done, so an already linked package is not an error.
- name: Link the packages to this repository
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
+47
View File
@@ -0,0 +1,47 @@
name: promote
on:
workflow_dispatch:
inputs:
version:
description: "release the canary is expected to run; must match what it runs"
required: true
type: string
concurrency:
group: promote
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
promote:
if: vars.CANARY_URL != ''
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: Build archied
run: go build -tags no_ui -o "$RUNNER_TEMP/archied" ./cmd/archied
- name: Log in to the Gitea registry
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
- name: Promote the canary's release
env:
ARCHIE_CANARY_TOKEN: ${{ secrets.CANARY_TOKEN }}
run: |
"$RUNNER_TEMP/archied" release canary promote -dashboard "${{ vars.CANARY_URL }}" \
-version "${{ inputs.version }}" \
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
+9 -10
View File
@@ -2,8 +2,6 @@ name: Quality
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
@@ -20,12 +18,8 @@ jobs:
with:
fetch-depth: 0
- name: Verify extension namespace support
run: |
if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
unshare --user --map-root-user --net true
- name: Verify unprivileged user namespaces
run: unshare --user --map-root-user --net true
- uses: actions/setup-go@v5
with:
@@ -46,8 +40,13 @@ jobs:
go install mvdan.cc/gofumpt@v0.11.0
bash tools/proto.sh install
sudo apt-get update
sudo apt-get install -y --no-install-recommends ripgrep
- uses: actions/cache@v4
with:
path: ~/.cache/golangci-lint
key: golangci-lint-${{ hashFiles('.golangci-version', '.golangci.yml', 'go.sum') }}-${{ github.sha }}
restore-keys: |
golangci-lint-${{ hashFiles('.golangci-version', '.golangci.yml', 'go.sum') }}-
golangci-lint-
- name: Ensure contract baseline ref
run: |
+9 -8
View File
@@ -1,6 +1,3 @@
# Cuts a release from main: [Unreleased] in CHANGELOG.md becomes the version's
# section, then the commit and its tag are pushed together. The tag push starts
# deploy.yml, which publishes the release to `next` for the canary.
name: release
on:
@@ -21,8 +18,15 @@ jobs:
cut:
runs-on: self-hosted
steps:
# DEPLOY_TOKEN rather than the job token: a push made with the job token
# doesn't start workflows, and the tag push must start deploy.yml.
- name: Check DEPLOY_TOKEN is configured
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
if [ -z "$DEPLOY_TOKEN" ]; then
echo "::error::DEPLOY_TOKEN is not set for this repository, so the release cannot push its commit and tag. Set the secret here, or dispatch the release from the Gitea primary."
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
@@ -34,8 +38,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
# The self-hosted runner keeps the Go caches on disk between jobs, and
# archiving them for the Actions cache takes minutes.
cache: false
- name: Install Task
@@ -49,6 +51,5 @@ jobs:
git config user.email "sam@catlow.tech"
task release RELEASE="$RELEASE"
# Atomic: a commit without its tag would build images stamped dev.
- name: Push the release
run: git push --atomic origin main "$(git describe --exact-match --match 'v*' HEAD)"
+2
View File
@@ -47,3 +47,5 @@ __pycache__/
# Local symlink to the archipelago marketplace repo
/archipelago
.agents-run/
/.pnpm-store/
+63
View File
@@ -5,6 +5,69 @@ release's per-component sections are labelled beneath its heading.
## [Unreleased]
## [1.61.3] - 2026-11-08
### archie-ui
- Issue, pull request and repository links on tasks open on the forge the repository's connection points at, instead of GitHub.
- Settings: the Harness page is now part of Agent profiles. The setup terminal and the credential sign-in status sit on the same page as the Kit profiles they target, so a profile with a Kit can be signed in from the page that defines it.
## [1.61.2] - 2026-11-07
### archied
- archied no longer gets killed by the systemd watchdog when a restart or update leaves many tasks to resume. Each resumed task used to cost a full queue poll before the next was picked up, so a dozen of them outlasted the 30-second watchdog; an update that hit this was rolled back.
## [1.61.1] - 2026-11-07
### archie-gateway
- An image or voice attachment that arrives as a link is now checked against what the link serves, the same as an uploaded one. A link whose content is not the declared type, or that cannot be read, is refused.
### archie-ui
- A workflow created on the canvas now saves the agent it runs as, so it runs instead of parking with "declares no identity to run as".
### archie-state-store
- A workflow that no longer validates after an upgrade (for example it names a step type that was removed) is repaired at startup instead of breaking every workflow. A shipped workflow is restored from this release's copy; a workflow you created is removed and logged, and its earlier revision stays in the resource history. Valid workflows you created or edited are kept.
## [1.61.0] - 2026-11-07
### archied
- A `workflow.handoff` now finishes its run and starts a separate, linked run of the next workflow on the same issue, instead of continuing as another attempt. The task page links each run to the one before and after it; attempts count only retries of one run.
- A task no longer fails to prepare its worktree with "some refs were not updated" after a tag or branch moves on the forge.
### archie-ui
- The task page no longer flashes its loading state on every live update while a task runs.
### archie-state-store
- The extension catalogue lists and installs again. Its default signing key has changed; an instance that set its own catalogue signing key in Extension settings keeps using that key.
## [1.60.0] - 2026-11-02
### archied
- Curators can list a repository's open issues and file new ones with the `issue_list` and `issue_create` tools, which reach the forge through the daemon. A curator files only when its definition declares `issue_create`; the shipped self-intake example runs in dry run with `issue_list` for deduplication. Listing every open issue needs the forge extensions from the archipelago release after 1.2.0.
## [1.59.0] - 2026-11-02
### archied
- Forge extensions can open issues: the forge surface gains `CreateIssue` alongside list, comment and close, and the bundled Gitea and GitHub extensions implement it.
## [1.58.1] - 2026-11-01
### archied
- The systemd watchdog now also watches the task intake loop, and its warning names the loop that stalled.
- archied no longer restarts about a minute after it starts. Under systemd, the watchdog never saw a poll pass and killed it on every start since 1.56.0.
## [1.58.0] - 2026-11-01
### archied
+19 -1
View File
@@ -58,6 +58,9 @@ ENV PATH="/usr/local/go/bin:/go/bin:${PATH}"
ARG GOLANGCI_LINT_VERSION=2.14.0
ARG GOFUMPT_VERSION=0.11.0
ARG BUF_VERSION=1.72.0
# Pinned to the versions tools/proto.sh installs; buf generate shells out to them.
ARG PROTOC_GEN_GO_VERSION=1.36.11
ARG PROTOC_GEN_GO_GRPC_VERSION=1.6.2
RUN curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \
| tar -xz -C /usr/local/bin --strip-components=1 \
@@ -66,7 +69,10 @@ RUN curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v${G
"https://github.com/mvdan/gofumpt/releases/download/v${GOFUMPT_VERSION}/gofumpt_v${GOFUMPT_VERSION}_linux_amd64" && \
curl -fsSL -o /usr/local/bin/buf \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" && \
chmod +x /usr/local/bin/gofumpt /usr/local/bin/buf
chmod +x /usr/local/bin/gofumpt /usr/local/bin/buf && \
GOBIN=/usr/local/bin go install "google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOC_GEN_GO_VERSION}" && \
GOBIN=/usr/local/bin go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${PROTOC_GEN_GO_GRPC_VERSION}" && \
go clean -cache -modcache
# ── Python via uv ─────────────────────────────────────────────────────
ARG PYTHON_VERSION=3.14
@@ -74,6 +80,18 @@ RUN curl -fsSL https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
RUN uv python install --default "${PYTHON_VERSION}" && rm -rf /root/.cache/uv
# Point each toolchain at its cache volume (internal/storage). Unset, pnpm puts
# its store on the worktree's filesystem, inside the repository the agent commits.
ENV GOMODCACHE=/data/cache/go/mod \
GOCACHE=/data/cache/go/build \
npm_config_cache=/data/cache/node \
npm_config_store_dir=/data/cache/pnpm \
DENO_DIR=/data/cache/deno \
BUN_INSTALL_CACHE_DIR=/data/cache/bun \
PIP_CACHE_DIR=/data/cache/pip \
UV_CACHE_DIR=/data/cache/pip \
CARGO_HOME=/data/cache/cargo
COPY --from=builder /usr/local/bin/archie-agent /usr/local/bin/archie-agent
# The daemon injects NATS_URL and, when configured, NATS_TOKEN.
+6 -1
View File
@@ -1,4 +1,9 @@
# Archie
<h1>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/brand/archie-wordmark-dark.svg">
<img alt="Archie" src="assets/brand/archie-wordmark.svg" height="56">
</picture>
</h1>
**Event-driven Agentic Automation**
+137 -20
View File
@@ -47,6 +47,21 @@ then pushes `main` and the tag atomically with `DEPLOY_TOKEN`. A push made with
the job token wouldn't start other workflows, so the user token is what lets
the tag start the deploy.
Every workflow that reaches the registry or the canary reads its credentials
from Actions secrets, so a mirror of this repository carries its own set:
| Name | Kind | Used by |
|---|---|---|
| `DEPLOY_TOKEN` | secret | release, deploy, canary, promote — the registry push, the tag push, and the package links |
| `RELEASE_SIGNING_KEY` | secret | deploy — signs the release statement |
| `CANARY_TOKEN` | secret | deploy, canary, promote — the canary's dashboard API |
| `CANARY_URL` | variable | deploy, canary, promote — where that dashboard is |
| `CANARY_WINDOW` | variable | canary — the judged window; empty means the default |
A mirror missing them fails at its first login or push; `release.yml` names the
missing `DEPLOY_TOKEN` before it checks out, so the run doesn't read as a broken
release.
After a release, pull `main` before committing on it again: CI has added the
release commit.
@@ -78,27 +93,64 @@ release rather than committing the fix on top of a tagged one.
The canary is the production host, following `next`. Every quarter hour
`canary.yml` runs `archied release canary check`, which reads the canary
through its dashboard API and judges the release on `next`:
through its dashboard API and judges **the release the canary actually runs**,
not the moving `next` tag:
| Signal | Source | Fails when |
| --- | --- | --- |
| Install outcome | `GET /api/chat/update` | the canary doesn't run the release (the watchdog rolled it back) |
| Install outcome | `GET /api/chat/update` | the canary doesn't run the judged release (the watchdog rolled it back) |
| Readiness | `GET /health/detailed` | the rollup isn't `ok` |
| Alerts | `GET /api/alerts` | an open `action` alert was first raised after the release was issued |
| Error log | `GET /api/logs?level=error` | error lines per day exceed `2 × baseline + 10` |
| Alerts | `GET /api/alerts` | an open `action` alert was first raised after the release was installed |
| Error log | `GET /api/logs?level=error` | error lines per window exceed `2 × baseline + 10` |
| Task outcomes | `GET /api/tasks` | the share of finished tasks that parked or died rose more than 10 points |
- **Control.** The canary's own 24 hours before the release was issued. With
- **Control.** The canary's own window before the release was installed. With
one production host there's no simultaneous control.
- **Window.** 24 hours from issue, one cycle of schedules and traffic. The
first 30 minutes are for the install and restart.
- **Window.** 24 hours counted from the **install** on the canary, not from
the release's issue time: the host records it in `installed.json`
(`committed_at`) and reports it as `installed_at` in `GET /api/chat/update`.
One cycle of schedules and traffic. The first 30 minutes are for the install
and restart. `canary.yml` passes `-window` when the `CANARY_WINDOW` Actions
variable is set; the flag defaults to 24h. A host that doesn't report an
install time degrades to the release statement's issue time.
- **Hard signals** (install, readiness, alerts) roll back at any check after
that. **Relative signals** (errors, tasks) are judged at the end of the
window.
that. **Relative signals** (errors, tasks) are judged against the baseline
whenever both windows carry enough data, so a breach rolls the release back
even mid-window; a full window with no failure promotes it.
- **Too little data skips a signal** rather than failing it: fewer than 5
finished tasks in the window, or an error log that reaches back less than an
hour into the baseline. A log read that stops short of a window is scaled to
a full day from what it covers.
a full window from what it covers.
### Queueing
`deploy.yml` installs each new release on the canary with
`archied release canary start -version V`, which first points the canary back
at `next` (clearing any rollback pin) and then installs `V` — unless the
canary is already judging a release newer than stable that isn't `V`, in which
case `V` is **queued** behind it and the canary keeps running what it judges.
`-force` installs regardless. A `check` that promotes (or finds nothing to
judge) installs the newer `next` in the same run, so a queue drains one
release per promotion.
### Subcommands
```
archied release canary status read-only: channel/pin, installed release and
installed_at, stable/next, window progress, and
the verdict the current signals would give
archied release canary start point the canary at next and install -version,
queued behind a release being judged (-force to
override)
archied release canary check judge the installed release over -window
(default 24h): promote, pick up a newer next,
or roll back; a held canary is reported, and a
held pin that is no longer installable fails
the run red
archied release canary promote promote the installed release now if its
signals pass; refuses with exit 1 otherwise
archied release canary unpin return the canary to next from any pin
```
### Promote
@@ -106,32 +158,97 @@ A release that passes the window is promoted: `stable` is retagged to the
`v<version>` manifest. The signature covers the statement, not the tag, so the
retag needs no signing key. The `archied` and `archie-agent` images' `:latest`
move to their `:v<version>` first, and the agent image must be the digest the
statement pins. Promotion refuses a prerelease and a release issued
before the one `stable` names, the same replay rule hosts enforce. The decision
and its reasons are in the `canary` run log.
statement pins. Promotion refuses a prerelease and a release issued before the
one `stable` names, the same replay rule hosts enforce. The decision and its
reasons are in the `canary` run log.
Early promotion is a dispatch away: the **promote** workflow
(`.github/workflows/promote.yml`) takes a `version` input and runs
`archied release canary promote -version V` on the canary. It judges the
release the canary runs — the window doesn't matter for the decision — and
refuses (red run) on any hard failure or relative breach with enough data.
### Roll back
`stable` stays put, and the run turns red. The canary is pinned to the `stable`
version through its update settings and reinstalled through its dashboard.
`stable` stays put, and the run turns red. Before the canary is pinned to
`stable`, `check` verifies `stable` is actually installable — its statement's
zip blob must still be in the release repository and its pinned agent image
must still resolve (`releaseupdate.Installable`). If it isn't, the run fails
loudly and the canary stays on `next` rather than being stranded on a pin.
Otherwise the canary is pinned to the `stable` version through its update
settings and reinstalled through its dashboard.
A release whose migrations differ from `stable`'s can't go back without
restoring the pre-update database snapshot, which loses every write since. The
canary is held on the failed release instead (pinned to it) and the fix goes
forward in the next release. The next release's deploy points the canary back at
`next`.
forward in the next release. The next release's deploy points the canary back
at `next`.
A pinned canary isn't judged, so a rollback is decided once.
A pinned canary isn't judged, so a rollback is decided once — but `check`
verifies the pin is still installable every run, so a stranded pin shows red
instead of green. `archied release canary unpin` returns the canary to `next`
by hand.
### Configuration
| Name | Kind | Holds |
| --- | --- | --- |
| `CANARY_URL` | Actions variable | the canary's dashboard URL; unset disables the canary steps |
| `CANARY_TOKEN` | Actions secret | a personal API token on the canary with instance admin |
| `DEPLOY_TOKEN` | Actions secret | registry and repository write, for publishing, promoting and the release push |
| `CANARY_TOKEN` | Actions secret | an API token bound to a dedicated `service_account` identity on the canary, carrying only the canary grant policy (see below) — never instance admin |
| `CANARY_WINDOW` | Actions variable | optional `-window` override for `canary check`; unset is 24h |
| `DEPLOY_TOKEN` | Actions secret | registry and repository write, for publishing, promoting and the release push; stays CI-only, promotion runs in CI and never on the host |
| `RELEASE_SIGNING_KEY` | Actions secret | the release signing seed |
#### Setting up `CANARY_TOKEN` once
`CANARY_TOKEN` is a bearer token for a dedicated service-account identity in
the system org whose only grant is the canary policy
(`access.CanaryGrantPolicy`): read the signal endpoints (`GET /api/chat/update`,
`GET /api/alerts`, `GET /api/logs`, `GET /api/tasks`), read and write the
`update-settings` resource, and trigger an update install
(`POST /api/chat/update/install`). It carries no other rights, and instance
admin is never needed. With an instance-admin token (for example the operator
session), run against the canary host:
```bash
# 1. Create the service-account identity in the system org.
curl -X POST "$CANARY_URL/api/identities" -H "Authorization: Bearer $ADMIN" \
-H 'Content-Type: application/json' \
-d '{"kind":"service_account","display_name":"ci-canary"}'
# -> {"id":"<canary-identity-id>", ...}
# 2. Issue its token (shown exactly once).
curl -X POST "$CANARY_URL/api/identities/<canary-identity-id>/tokens" \
-H "Authorization: Bearer $ADMIN" -H 'Content-Type: application/json' \
-d '{"name":"ci-canary","days":90}'
# -> {"id":"<token-hash>","token":"archie_pat_..."} -- store the token value as the CANARY_TOKEN secret
# 3. Install the grant pair, scoped to that identity. The policies' org is
# pinned to the caller's org (org-sys for the instance admin), so the
# bodies need no org field. The permit alone is not enough: service
# accounts created through the API are assigned the developer role, so a
# matching forbid (installed second) negates everything outside the
# permit's surface for that identity.
curl -X PUT "$CANARY_URL/api/access/policies" -H "Authorization: Bearer $ADMIN" \
-H 'Content-Type: application/json' \
-d '{"id":"org-canary-grant","level":"org","text":"permit(principal, action, resource) when {\n resource.org == principal.org &&\n principal == Archie::Identity::\"<canary-identity-id>\" &&\n (\n (action == Archie::Action::\"read\" && [\"dashboard\", \"task\"].contains(resource.kind)) ||\n (action == Archie::Action::\"read\" && resource == Archie::Object::\"update-settings\") ||\n (action == Archie::Action::\"update\" && resource == Archie::Object::\"update\") ||\n (action == Archie::Action::\"manage_identities\" && resource == Archie::Object::\"update-settings\")\n )\n};"}'
```
The second policy forbids the canary identity from everything the permit does
not name, so its developer role cannot widen the grant:
```bash
curl -X PUT "$CANARY_URL/api/access/policies" -H "Authorization: Bearer $ADMIN" \
-H 'Content-Type: application/json' \
-d '{"id":"org-canary-grant-forbid","level":"org","text":"forbid(principal, action, resource) when {\\n resource.org == principal.org &&\\n principal == Archie::Identity::\\\"<canary-identity-id>\\\" &&\\n !(\\n (action == Archie::Action::\\\"read\\\" && [\\\"dashboard\\\", \\\"task\\\"].contains(resource.kind)) ||\\n (action == Archie::Action::\\\"read\\\" && resource == Archie::Object::\\\"update-settings\\\") ||\\n (action == Archie::Action::\\\"update\\\" && resource == Archie::Object::\\\"update\\\") ||\\n (action == Archie::Action::\\\"manage_identities\\\" && resource == Archie::Object::\\\"update-settings\\\")\\n )\\n};"}'
```
The policy texts are exactly `access.CanaryGrantPolicy` and
`access.CanaryGrantForbidPolicy` from `internal/domain/access/canary.go` with
the identity id filled in. The canary needs no other rights: `GET
/health/detailed` is unauthenticated, and every other call it makes is covered
by the grant pair.
The runner must reach `CANARY_URL`. Without a canary a release stays on `next`
until promoted by hand, under the same refusals:
+7
View File
@@ -221,6 +221,13 @@ tasks:
cmds:
- node e2e/run.cjs {{.CLI_ARGS}}
canary:rehearse:
# Local rehearsal only: spins up its own registry, database and host, and
# is deliberately absent from check and CI.
desc: Rehearse the release-canary loop on a throwaway local host (needs docker; never part of the gate)
cmds:
- sh tools/canary-rehearse.sh
build:
desc: Build archie services and agent binaries
deps: [ui]
+9
View File
@@ -156,6 +156,15 @@ _needs a repository._
| `push` | bool | Push the branch after committing. |
| `reference` | `Fixes` \| `Implements` \| `Refs` | How the commit links to the task issue. |
Hooks never run. The commit is created by go-git, which ignores `.git/hooks`
and `core.hooksPath`, and the agent never runs git, so `pre-commit`,
`commit-msg` and `prepare-commit-msg` in the checkout are inert files. A
repository whose rules live only in a hook — a formatter, a secret scanner,
commitlint, a DCO trailer — gets a commit that does not satisfy them: the run
reports success and the pull request fails the check afterwards. Put the same
commands in `command.run` or the repository gate, which both run in the task
container before this step.
### `repo.open-pr`
_needs a repository._
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="112" fill="#0e0f10"/><g fill="#51a580" transform="translate(96 96) scale(13.333) translate(-0 -0)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g></svg>

After

Width:  |  Height:  |  Size: 319 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#51a580"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></svg>

After

Width:  |  Height:  |  Size: 194 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630"><rect width="1200" height="630" fill="#0e0f10"/><svg x="320" y="209.6153846153846" width="560" height="150.76923076923077" viewBox="-4 21.4 312 84"><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#e8e6e1" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg><g fill="#a8a59f" transform="translate(224.91199999999998 460.38461538461536)"><path transform="translate(0.00 0)" d="M18.70-23.73L18.70-21.22L11.15-21.22L11.15 0L8.30 0L8.30-21.22L0.75-21.22L0.75-23.73"/><path transform="translate(19.45 0)" d="M5.61 0L2.89 0L2.89-25.16L5.61-25.16L5.61-14.69L5.75-14.69Q6.39-16.18 7.57-17.07Q8.74-17.95 10.71-17.95Q13.43-17.95 15.01-16.20Q16.59-14.45 16.59-11.25L16.59 0L13.87 0L13.87-10.78Q13.87-13.12 12.87-14.31Q11.87-15.50 9.89-15.50Q8.81-15.50 7.82-15.15Q6.83-14.79 6.22-14.04Q5.61-13.29 5.61-12.17"/><path transform="translate(38.76 0)" d="M9.49 0.41Q7.11 0.41 5.34-0.73Q3.57-1.87 2.58-3.93Q1.60-5.98 1.60-8.77Q1.60-11.56 2.58-13.62Q3.57-15.67 5.34-16.81Q7.11-17.95 9.49-17.95Q11.83-17.95 13.53-16.85Q15.23-15.74 16.15-13.80Q17.07-11.87 17.07-9.38L17.07-8.09L4.45-8.09L4.45-7.28Q4.45-5 5.83-3.49Q7.21-1.97 9.66-1.97Q11.32-1.97 12.56-2.75Q13.80-3.54 14.48-5L16.42-3.60Q15.57-1.84 13.77-0.71Q11.97 0.41 9.49 0.41M9.49-15.67Q8.02-15.67 6.89-14.99Q5.75-14.31 5.10-13.11Q4.45-11.90 4.45-10.37L4.45-10.13L14.14-10.13L14.14-10.51Q14.14-12.07 13.57-13.23Q12.99-14.38 11.93-15.03Q10.88-15.67 9.49-15.67"/><path transform="translate(57.43 0)" d=""/><path transform="translate(65.45 0)" d="M17.17-2.38L17.17 0L15.64 0Q14.55 0 13.87-0.46Q13.19-0.92 12.89-1.73Q12.68-2.24 12.61-2.86L12.44-2.86Q11.90-1.26 10.56-0.42Q9.21 0.41 7.38 0.41Q4.59 0.41 3.04-1.02Q1.50-2.45 1.50-4.90Q1.50-6.56 2.31-7.70Q3.13-8.84 4.78-9.44Q6.43-10.03 8.98-10.03L12.44-10.03L12.44-11.76Q12.44-13.63 11.42-14.62Q10.40-15.61 8.30-15.61Q6.73-15.61 5.64-14.89Q4.56-14.18 3.84-12.99L2.21-14.52Q2.92-15.91 4.49-16.93Q6.05-17.95 8.43-17.95Q11.59-17.95 13.38-16.39Q15.16-14.82 15.16-12.04L15.16-2.38L17.17-2.38M12.44-5.10L12.44-7.99L8.84-7.99Q6.53-7.99 5.44-7.31Q4.35-6.63 4.35-5.34L4.35-4.62Q4.35-3.33 5.30-2.62Q6.26-1.90 7.82-1.90Q9.18-1.90 10.22-2.33Q11.25-2.75 11.85-3.49Q12.44-4.22 12.44-5.10"/><path transform="translate(83.61 0)" d="M17.68 1.94Q17.68 3.74 16.73 4.91Q15.78 6.09 13.89 6.65Q12 7.21 9.18 7.21Q6.46 7.21 4.74 6.70Q3.03 6.19 2.24 5.22Q1.46 4.25 1.46 2.89Q1.46 1.46 2.21 0.65Q2.96-0.17 4.25-0.51L4.25-0.88Q3.50-1.26 3.09-1.85Q2.69-2.45 2.69-3.33Q2.69-4.66 3.54-5.36Q4.39-6.05 5.71-6.39L5.71-6.53Q4.15-7.28 3.28-8.67Q2.41-10.06 2.41-11.90Q2.41-13.70 3.23-15.06Q4.05-16.42 5.54-17.19Q7.04-17.95 9.01-17.95Q9.96-17.95 10.79-17.78Q11.63-17.61 12.34-17.27L12.34-17.58Q12.34-18.60 12.82-19.26Q13.29-19.92 14.38-19.92L17-19.92L17-17.54L13.67-17.54L13.67-16.42Q14.62-15.61 15.15-14.45Q15.67-13.29 15.67-11.90Q15.67-Line truncated

After

Width:  |  Height:  |  Size: 20 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#e8e6e1" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="currentColor" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="currentColor" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 21.40 312 84" role="img" aria-label="Archie"><title>Archie</title><g fill="#51a580" transform="translate(-7.7555555555555555 18.56666666666667) scale(3.8777777777777778)"><path d="M2 21h4l8-18h-4z"/><path d="M14.9 5.03 22 21h-4l-5.1-11.47z"/><path d="M10.47 15h3.06l1.11 2.5H9.36z"/></g><path fill="#1f1f1d" d="M99.76 68L99.76 100L86.96 100L86.96 47.80L99.76 47.80L99.76 58.60L100.26 58.60Q100.96 55.80 102.61 53.35Q104.26 50.90 107.11 49.35Q109.96 47.80 114.06 47.80L116.86 47.80L116.86 59.90L112.86 59.90Q108.56 59.90 105.61 60.75Q102.66 61.60 101.21 63.35Q99.76 65.10 99.76 68M145.86 101.20Q134.26 101.20 128.01 93.80Q121.76 86.40 121.76 73.80Q121.76 61.30 128.01 53.95Q134.26 46.60 145.86 46.60Q153.76 46.60 158.91 50.10Q164.06 53.60 166.36 59.80L155.86 64.50Q154.96 61.20 152.46 59.05Q149.96 56.90 145.86 56.90Q140.56 56.90 137.86 60.25Q135.16 63.60 135.16 69.20L135.16 78.70Q135.16 84.10 137.86 87.50Q140.56 90.90 145.86 90.90Q150.36 90.90 152.91 88.55Q155.46 86.20 156.86 82.70L166.66 87.40Q164.16 94.30 158.81 97.75Q153.46 101.20 145.86 101.20M188.36 100L175.56 100L175.56 26L188.36 26L188.36 56.50L188.86 56.50Q190.46 52.30 193.91 49.45Q197.36 46.60 203.46 46.60Q211.46 46.60 215.81 51.95Q220.16 57.30 220.16 67L220.16 100L207.36 100L207.36 68.30Q207.36 62.80 205.36 59.95Q203.36 57.10 198.76 57.10Q196.16 57.10 193.76 58.05Q191.36 59 189.86 60.85Q188.36 62.70 188.36 65.50M239.76 40.20Q235.86 40.20 234.06 38.35Q232.26 36.50 232.26 33.80L232.26 31.80Q232.26 29 234.06 27.20Q235.86 25.40 239.76 25.40Q243.66 25.40 245.46 27.20Q247.26 29 247.26 31.80L247.26 33.80Q247.26 36.50 245.46 38.35Q243.66 40.20 239.76 40.20M246.16 100L233.36 100L233.36 47.80L246.16 47.80M280.96 101.20Q273.26 101.20 267.76 97.85Q262.26 94.50 259.31 88.35Q256.36 82.20 256.36 73.80Q256.36 65.60 259.26 59.45Q262.16 53.30 267.56 49.95Q272.96 46.60 280.56 46.60Q288.76 46.60 294.01 50.20Q299.26 53.80 301.81 59.75Q304.36 65.70 304.36 72.90L304.36 77.10L269.66 77.10L269.66 78.40Q269.66 84 272.86 87.50Q276.06 91 282.36 91Q287.06 91 290.16 88.95Q293.26 86.90 295.66 83.90L302.56 91.60Q299.36 95.90 293.81 98.55Q288.26 101.20 280.96 101.20M280.76 56.20Q277.36 56.20 274.86 57.75Q272.36 59.30 271.01 62.05Q269.66 64.80 269.66 68.40L269.66 69.20L291.06 69.20L291.06 68.30Q291.06 64.60 289.86 61.95Q288.66 59.30 286.36 57.75Q284.06 56.20 280.76 56.20"/></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+17 -3
View File
@@ -19,9 +19,6 @@ bot_user = "vectis-labs-archie"
type = "github"
host = "https://github.com"
token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
# intake = "poll" # "poll", "webhook" or "both"
# webhook_secret = { engine = "env", key = "ARCHIE_WEBHOOK_SECRET" }
# webhook_addr = "0.0.0.0:8645"
[dispatch]
trigger = "assignee" # "assignee", "label" or "either"
@@ -94,3 +91,20 @@ target = "127.0.0.1:9090"
# releases_key = "base64 public key"
# catalogue = "registry.example/owner/archipelago/catalogue"
# catalogue_key = "base64 public key"
# Long-running agent loops that maintain memory, skills and — in dry run —
# file follow-up issues from recent runs. Definitions are data: the server
# validates them and the gateway applies them live.
# [[curators]]
# name = "self-intake"
# interval = "1h"
# tools = ["run_list", "run_events", "issue_list"]
# instructions = """
# You are archie's self-intake curator, in dry run. Each pass: list recent
# task runs with run_list, inspect anything parked or failed with run_events,
# check issue_list for each repo so nothing already open is repeated, then
# report candidate follow-up issues, each tied to the run that produced it.
# Do not create issues.
# """
# To let it file: add "issue_create" to tools and tell it to file each
# candidate (citing the run) instead of only reporting it.
+11
View File
@@ -45,3 +45,14 @@ listen = "127.0.0.1:8585"
[services.daemon]
target = "127.0.0.1:8587"
listen = "127.0.0.1:8587"
# Dry-run self-intake curator (#1770): surveys recent runs and reports
# candidate follow-up issues as pass summaries; declares no issue-creating
# tool, so it cannot file. Needs a chat model configured to run at all.
[[curators]]
name = "self-intake"
interval = "1h"
tools = ["run_list", "run_events", "issue_list"]
instructions = """
You are archie's self-intake curator, in dry run. Each pass: list recent task runs with run_list, inspect anything parked or failed with run_events, check issue_list for each repo so nothing already open is repeated, then report candidate follow-up issues — concrete, each tied to the run that produced it. Do not create issues; this pass reports only (no issue-creating tool is declared, so it cannot). End your reply with the report.
"""
+14
View File
@@ -87,7 +87,14 @@
"/news/archie/1.56.0/": "/news/1.56.0/",
"/news/archie/1.57.0/": "/news/1.57.0/",
"/news/archie/1.58.0/": "/news/1.58.0/",
"/news/archie/1.58.1/": "/news/1.58.1/",
"/news/archie/1.59.0/": "/news/1.59.0/",
"/news/archie/1.6.0/": "/news/1.6.0/",
"/news/archie/1.60.0/": "/news/1.60.0/",
"/news/archie/1.61.0/": "/news/1.61.0/",
"/news/archie/1.61.1/": "/news/1.61.1/",
"/news/archie/1.61.2/": "/news/1.61.2/",
"/news/archie/1.61.3/": "/news/1.61.3/",
"/news/archie/1.7.0/": "/news/1.7.0/",
"/news/archie/1.8.0/": "/news/1.8.0/",
"/news/archie/1.9.0/": "/news/1.9.0/",
@@ -190,7 +197,14 @@
"/news/archied/1.56.0/": "/news/1.56.0/",
"/news/archied/1.57.0/": "/news/1.57.0/",
"/news/archied/1.58.0/": "/news/1.58.0/",
"/news/archied/1.58.1/": "/news/1.58.1/",
"/news/archied/1.59.0/": "/news/1.59.0/",
"/news/archied/1.6.0/": "/news/1.6.0/",
"/news/archied/1.60.0/": "/news/1.60.0/",
"/news/archied/1.61.0/": "/news/1.61.0/",
"/news/archied/1.61.1/": "/news/1.61.1/",
"/news/archied/1.61.2/": "/news/1.61.2/",
"/news/archied/1.61.3/": "/news/1.61.3/",
"/news/archied/1.7.0/": "/news/1.7.0/",
"/news/archied/1.8.0/": "/news/1.8.0/",
"/news/archied/1.9.0/": "/news/1.9.0/",
+35
View File
@@ -1,4 +1,39 @@
[
{
"version": "1.61.3",
"date": "2026-11-08",
"body": "### archie-ui\n\n- Issue, pull request and repository links on tasks open on the forge the repository's connection points at, instead of GitHub.\n\n- Settings: the Harness page is now part of Agent profiles. The setup terminal and the credential sign-in status sit on the same page as the Kit profiles they target, so a profile with a Kit can be signed in from the page that defines it."
},
{
"version": "1.61.2",
"date": "2026-11-07",
"body": "### archied\n\n- archied no longer gets killed by the systemd watchdog when a restart or update leaves many tasks to resume. Each resumed task used to cost a full queue poll before the next was picked up, so a dozen of them outlasted the 30-second watchdog; an update that hit this was rolled back."
},
{
"version": "1.61.1",
"date": "2026-11-07",
"body": "### archie-gateway\n\n- An image or voice attachment that arrives as a link is now checked against what the link serves, the same as an uploaded one. A link whose content is not the declared type, or that cannot be read, is refused.\n\n### archie-ui\n\n- A workflow created on the canvas now saves the agent it runs as, so it runs instead of parking with \"declares no identity to run as\".\n\n### archie-state-store\n\n- A workflow that no longer validates after an upgrade (for example it names a step type that was removed) is repaired at startup instead of breaking every workflow. A shipped workflow is restored from this release's copy; a workflow you created is removed and logged, and its earlier revision stays in the resource history. Valid workflows you created or edited are kept."
},
{
"version": "1.61.0",
"date": "2026-11-07",
"body": "### archied\n\n- A `workflow.handoff` now finishes its run and starts a separate, linked run of the next workflow on the same issue, instead of continuing as another attempt. The task page links each run to the one before and after it; attempts count only retries of one run.\n\n- A task no longer fails to prepare its worktree with \"some refs were not updated\" after a tag or branch moves on the forge.\n\n### archie-ui\n\n- The task page no longer flashes its loading state on every live update while a task runs.\n\n### archie-state-store\n\n- The extension catalogue lists and installs again. Its default signing key has changed; an instance that set its own catalogue signing key in Extension settings keeps using that key."
},
{
"version": "1.60.0",
"date": "2026-11-02",
"body": "### archied\n\n- Curators can list a repository's open issues and file new ones with the `issue_list` and `issue_create` tools, which reach the forge through the daemon. A curator files only when its definition declares `issue_create`; the shipped self-intake example runs in dry run with `issue_list` for deduplication. Listing every open issue needs the forge extensions from the archipelago release after 1.2.0."
},
{
"version": "1.59.0",
"date": "2026-11-02",
"body": "### archied\n\n- Forge extensions can open issues: the forge surface gains `CreateIssue` alongside list, comment and close, and the bundled Gitea and GitHub extensions implement it."
},
{
"version": "1.58.1",
"date": "2026-11-01",
"body": "### archied\n\n- The systemd watchdog now also watches the task intake loop, and its warning names the loop that stalled.\n- archied no longer restarts about a minute after it starts. Under systemd, the watchdog never saw a poll pass and killed it on every start since 1.56.0."
},
{
"version": "1.58.0",
"date": "2026-11-01",
+68
View File
@@ -0,0 +1,68 @@
# Self-development loop: archie develops its own codebase
**Status:** Decided, not yet built (2026-11-03, sam) **Scope:** how archie
persistently takes on development of archie-core itself. This file records a
desired state, not an implementation or a product: nothing below exists unless
the "Built today" section says so. The plan is tracked as epic #1769 with child
issues #1770–#1775. This file is a record, not a mechanism: agents only see
what is in their context, so verify every claim here against the code before
acting on it — where they disagree, the code wins. The boundary below is
load-bearing only where it is enforced (the gate, access control, the daemon's
git monopoly) and stated in `AGENTS.md`; everywhere else this file is a pointer.
## Built today
The machinery the loop will reuse exists: shipped triage/implement/pr-review
workflows, the adversarial self-review stage before a PR opens (epic #1348,
closed), the prbench judge for review quality with its acceptance bar, canary
releases judged on the installed release (releaseupdate), and the curator
engine. What does not exist is the loop itself: no self-intake curator, no
approved-issue auto-run, no judge for diffs, no outcome distillation, no
canary routing specific to self-directed changes.
## Decision
Archie improves its own codebase through a closed loop, built in stages:
1. **Self-intake** (#1770): a curator pass reads run outcomes, step transcripts,
gate failures and alerts, dedupes against open issues, and files new issues.
Archie files its own work; the maintainer approves priority.
2. **Approved-issue loop** (#1771): an approved issue runs the shipped
triage/implement workflows end to end — read-only plan, gated build,
adversarial self-review, daemon commits and opens a green PR. The maintainer
still merges at this stage.
3. **Implementation judge** (#1772): the prbench judge pattern scores diffs,
calibrated against the maintainer's merge decisions; auto-merge applies only
when the gate is green, the review stage is clean, and the judge is above the
calibrated bar.
4. **Outcome distillation** (#1773): a curator turns merged-run postmortems into
proposals for the repo's agent instructions, each added only because it
changes a decision; rules that stop changing decisions are removed.
5. **Canary** (#1774): self-directed changes ship through the canary release
window and are judged on the installed release before promotion. Rollback is
a plain revert, because every self-directed change is one gated commit.
## Boundary
Enforcement lives in the harness, never in the prompt (#1775). Changes to the
commit gate, the invariants in `AGENTS.md`, access control and grant scoping,
the daemon-only git path, and webhook HMAC verification may be proposed by
archie but are never merged by archie — they require a maintainer merge.
Everything else (workflows, curators, memory, docs, the dashboard) is fair game
for the loop.
## Why
Self-improvement degrades when it relies on the model choosing to follow rules.
Gates, scoped grants and the daemon's monopoly on git cannot be argued with; a
prompt can. Keeping quality measurable — a judge bar and a canary verdict as
numbers, tests guarding the protected seams — is what lets the loop widen
without turning the codebase to garbage.
## Consequences
- One issue → one small PR applies doubly to self-directed work: past about 100
lines or any new mechanism, the change stops and reassesses.
- Every self-directed commit cites the issue that authorized it.
- Rule proposals from the distillation curator must name the run that triggered
them, and `AGENTS.md` stays short enough to read in full every session.
+1 -1
View File
@@ -78,7 +78,7 @@ accounts by unverified email, or create an administrator.
| Chat downloads: `webui/api_chat_files.go` | Offered file token expires and is bound to the initiating person; requests cannot supply a filesystem path. | `TestChatFileDownload` |
| Per-person memory: `archiegateway/chat_identity.go`, gateway memory tools, `sessioncurator` | Verified web sender identity scopes reads/writes. Curator refuses unidentified or mixed participants instead of guessing a person. | Gateway memory and session-curator tests |
| Workflow/task actions: `webui/api_tasks.go`, `domain/taskactions`, `staterpc` | Policy and stored workspace before action; domain transition, authority and durable dispatch guards remain in force. | HTTP deny matrix, task action/domain tests, task grant tests |
| Incoming webhooks: `forge/webhook`, `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Webhook/capture tests, `TestAuthorizeDelivery` |
| Incoming webhooks: `captureintake`, access delivery engine | Verify HMAC before parsing; derive source/org from stored source; evaluate source delivery policies and egress rules. No browser-user credential is inferred. | Capture tests, `TestAuthorizeDelivery` |
| Control-plane configuration, secrets, harness and extensions | Browser policy and instance-only restrictions where registered; service contracts carry principal/org; task grants cannot invoke administrative RPCs. | HTTP deny matrix, `TestAdministrationRoutes`, `TestChannelReloadRoute`, `TestConfineHarnessOrg` |
| Audit feed: `webui/api_audit.go`, `domain/audit` | `read_audit` on the `audit` resource; org scope and the instance-wide exception come from the authenticated principal, never the query string. Export carries the same grant, needs an explicit range of at most a year, and is rate-limited per identity, one at a time. Redaction runs in the State Store adapter before an entry crosses gRPC. | `TestReadAuditRoleBoundary`, `TestAuditRoutesFollowTheReadAuditRole`, `TestHTTPPolicyCannotBeBypassed`, `TestAuditErrorMapping`, `TestAuditCSVCellNeutralisesFormulas` |
| Live HTTP/SSE and diagnostics | Authenticated policy gate applies before stream creation; org-scoped event reads; instance logs require administrative visibility. | HTTP deny matrix, instance-only tests, `TestServiceLogsRequireInstanceCredential` |
+126 -3
View File
@@ -1,9 +1,14 @@
// Keyboard and phone access: the task dialog fits and tabs in order, pages
// title correctly, the skip link and palette focus main content, and
// query-only tab switches keep focus where it is.
// query-only tab switches keep focus where it is. Then the audit's two
// static sweeps (#1767): no unnamed controls on any route, and every keyboard
// focus stop's indicator clears 3:1 against the background behind it.
const assert = require('node:assert/strict');
const { staticRoutes } = require('./helpers/routes.cjs');
module.exports = async ({ page, go, shot, settled }) => {
module.exports = async ({ page, go, shot, fail, settled, tolerate }) => {
// The extension catalogue 502 is a stack-environment issue, not this check.
tolerate(/extensions\/catalogue/);
await page.setViewportSize({ width: 390, height: 844 });
await go('/tasks');
await page.getByRole('button', { name: 'Jump to', exact: true }).click();
@@ -35,7 +40,7 @@ module.exports = async ({ page, go, shot, settled }) => {
assert.ok(await skip.evaluate(el => el === document.activeElement), 'Skip link is not the first keyboard stop');
await page.keyboard.press('Enter');
assert.equal(await page.evaluate(() => document.activeElement?.id), 'main-content');
await page.getByRole('button', { name: 'Sections', exact: true }).click();
await page.getByRole('button', { name: 'Toggle Sidebar', exact: true }).click();
await page.getByRole('navigation', { name: 'Sections', exact: true }).getByRole('link', { name: 'Tasks', exact: true }).click();
await page.waitForFunction(() => document.activeElement?.id === 'main-content', null, { timeout: 5000 }).catch(() => {});
assert.equal(await page.evaluate(() => document.activeElement?.id), 'main-content', 'route navigation did not focus main');
@@ -50,4 +55,122 @@ module.exports = async ({ page, go, shot, settled }) => {
const tab = page.getByRole('tab', { name: /^Map/ });
await tab.click();
assert.ok(await tab.evaluate(el => el === document.activeElement), 'query-only navigation stole focus');
await page.setViewportSize({ width: 1440, height: 900 });
// Unnamed controls: every visible input, textarea, select, button or
// widget role on each static route needs an accessible name (accname
// order: labelledby, label, content, value, placeholder, title).
for (const r of staticRoutes()) {
await go(r);
const unnamed = await page.evaluate(() => {
const name = (el) => {
const by = el.getAttribute('aria-labelledby');
if (by) {
const t = by.split(/\s+/).map((id) => (document.getElementById(id)?.textContent || '')).join(' ').trim();
if (t) return t;
}
const al = el.getAttribute('aria-label');
if (al && al.trim()) return al.trim();
if (el.id) {
const l = document.querySelector(`label[for="${CSS.escape(el.id)}"]`);
if (l && l.textContent.trim()) return l.textContent.trim();
}
const wrap = el.closest('label');
if (wrap && wrap.textContent.trim()) return wrap.textContent.trim();
if (el.tagName === 'BUTTON' || el.getAttribute('role') === 'button' || el.getAttribute('role') === 'tab' || el.getAttribute('role') === 'switch') return el.textContent.trim();
if (el.tagName === 'INPUT') {
const t = (el.getAttribute('type') || 'text').toLowerCase();
if (t === 'submit' || t === 'button' || t === 'reset') return el.value.trim();
if (t === 'image') return (el.getAttribute('alt') || '').trim();
}
return (el.getAttribute('placeholder') || el.getAttribute('title') || '').trim();
};
return [...document.querySelectorAll('button, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [role="checkbox"]')]
.filter((el) => el.type !== 'hidden' && el.getClientRects().length)
.filter((el) => !name(el))
.map((el) => `${el.tagName.toLowerCase()}${el.id ? '#' + el.id : ''}: ${el.outerHTML.slice(0, 120)}`);
});
for (const u of unnamed) fail(`unnamed control on ${r}: ${u}`);
}
// Focus contrast: Tab through each static route; the focused element's
// outline or ring must clear 3:1 against the effective background behind it.
const focusProbe = () => page.evaluate(() => {
const el = document.activeElement;
if (!el || el === document.body || el === document.documentElement) return null;
const cs = getComputedStyle(el);
const parse = (c) => {
c = String(c).trim();
let m = c.match(/rgba?\(([^)]+)\)/);
if (m) {
const p = m[1].split(',').map(Number);
return { r: p[0], g: p[1], b: p[2], a: p.length > 3 ? p[3] : 1 };
}
m = c.match(/^#([0-9a-f]{3,8})$/i);
if (m) {
let h = m[1];
if (h.length === 3 || h.length === 4) h = [...h].map((x) => x + x).join('');
const n = parseInt(h.slice(0, 6), 16);
return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255, a: h.length === 8 ? parseInt(h.slice(6, 8), 16) / 255 : 1 };
}
return null;
};
const bgBehind = (start) => {
for (let n = start; n; n = n.parentElement) {
const c = parse(getComputedStyle(n).backgroundColor);
if (c && c.a > 0) return c;
}
return { r: 255, g: 255, b: 255, a: 1 };
};
// An outer ring or outline is painted over the parent's background; an
// inset one over the element's own. Score against whichever is higher.
const bgSelf = bgBehind(el);
const bgParent = bgBehind(el.parentElement);
const over = (fg, bg) => {
const a = fg.a + bg.a * (1 - fg.a);
if (a === 0) return { r: 0, g: 0, b: 0 };
return { r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / a, g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / a, b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / a };
};
const lum = (c) => {
const f = (v) => { v /= 255; return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); };
return 0.2126 * f(c.r) + 0.7152 * f(c.g) + 0.0722 * f(c.b);
};
const ratio = (c1, c2) => {
const l1 = lum(c1), l2 = lum(c2);
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
};
let fg = null;
// The ring lives in --tw-ring-shadow on :focus-visible; read the var
// directly, then fall back to outline, any shadow layer, focus border.
if (el.matches(':focus-visible')) {
const m = cs.getPropertyValue('--tw-ring-shadow').match(/rgba?\([^)]+\)|#[0-9a-f]{3,8}\b/i);
if (m) { const c = parse(m[0]); if (c && c.a > 0) fg = c; }
}
if (!fg && cs.outlineStyle !== 'none' && parseFloat(cs.outlineWidth) > 0) fg = parse(cs.outlineColor === 'currentcolor' ? cs.color : cs.outlineColor);
if (!fg && cs.boxShadow && cs.boxShadow !== 'none') {
for (const m of cs.boxShadow.matchAll(/rgba?\([^)]+\)|#[0-9a-f]{3,8}\b/gi)) {
const c = parse(m[0]);
if (c && c.a > 0) { fg = c; break; }
}
}
if (!fg && el.matches(':focus-visible') && parseFloat(cs.borderTopWidth) > 0) {
const c = parse(cs.borderTopColor);
if (c && c.a > 0) fg = c;
}
const sig = `${el.tagName}#${el.id}:${(el.textContent || '').trim().slice(0, 30)}`;
if (!fg) return { sig, ratio: 0 };
return { sig, ratio: Math.max(ratio(over(fg, bgSelf), bgSelf), ratio(over(fg, bgParent), bgParent)) };
});
for (const r of staticRoutes()) {
await go(r);
let prev = '';
for (let i = 0; i < 40; i++) {
await page.keyboard.press('Tab');
const info = await focusProbe();
if (!info || info.sig === prev) break;
prev = info.sig;
if (info.ratio < 3) fail(`focus indicator under 3:1 on ${r} at ${info.sig} (ratio ${info.ratio.toFixed(2)})`);
}
}
};
+19
View File
@@ -0,0 +1,19 @@
// The dashboard's static routes, read from the router source so a new page is
// swept automatically. Parameterised and redirect routes are skipped.
const fs = require('fs');
const path = require('path');
function staticRoutes() {
const src = fs.readFileSync(path.join(__dirname, '../../../ui/src/router/index.ts'), 'utf8');
const out = [];
for (const line of src.split('\n')) {
if (/redirect:/.test(line)) continue;
const m = line.match(/path: "([^"]*)"/);
if (!m || m[1].includes(':')) continue;
if (m[1].startsWith('/')) out.push(m[1]);
else if (m[1]) out.push('/org/' + m[1]);
}
return [...new Set(out)];
}
module.exports = { staticRoutes };
+18 -1
View File
@@ -1,5 +1,7 @@
const assert=require('node:assert/strict');
module.exports=async({page,go,shot})=>{
module.exports=async({page,go,shot,tolerate})=>{
// The extension catalogue 502 is a stack-environment issue, not this check.
tolerate(/extensions\/catalogue/);
await page.route('**/api/access/policies',async route=>{await new Promise(r=>setTimeout(r,2200));await route.continue()});
await go('/access/policies');
assert.equal(await page.getByText('No policies yet.',{exact:true}).count(),0);
@@ -16,4 +18,19 @@ module.exports=async({page,go,shot})=>{
await page.getByRole('button',{name:'Retry runs',exact:true}).click();
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor({state:'hidden'});
await shot('recovered');
// A failed list read is an error, never the empty state (#1767): force each
// page's list API to 500 and check its empty-state copy stays hidden.
const failList = async (pattern,path,emptyTexts,errorSel='[role=alert]')=>{
await page.route(pattern,route=>route.fulfill({status:200,contentType:'application/json',body:'unreadable response'}));
await go(path);
await page.locator(errorSel).first().waitFor();
for(const text of emptyTexts) assert.equal(await page.getByText(text,{exact:true}).count(),0,`${path} shows its empty state ("${text}") while the list read fails`);
await page.unroute(pattern);
};
await failList('**/api/tasks*','/tasks',['No tasks yet'],'text=Archie is not responding');
await failList('**/api/captures*','/events',['No captures yet']);
await failList('**/api/event-types*','/events',['No event types yet']);
await failList('**/api/tokens*','/account',['No tokens yet']);
await failList('**/api/access/policies*','/org/policies',['No policies yet']);
await shot('failed-reads-show-errors');
};
+6 -5
View File
@@ -1,4 +1,4 @@
// The topbar org selector: choosing a member org reloads the dashboard into it,
// The sidebar org switcher: choosing a member org reloads the dashboard into it,
// Tasks and Workflows then show only that org's work, and the API refuses an
// org the caller is not a member of.
const assert = require('node:assert/strict');
@@ -8,11 +8,12 @@ module.exports = async ({ page, go, shot, settled, tolerate }) => {
tolerate(ABSENT);
await go('/tasks');
await page.getByText('Fix flaky login test').first().waitFor();
const picker = page.getByRole('combobox', { name: 'Organisation' });
const picker = page.getByRole('button', { name: /^Organisation: / });
await picker.waitFor();
const offered = await (async () => {
await picker.click();
const names = await page.getByRole('option').allInnerTexts();
await page.getByRole('menuitem').first().waitFor();
const names = (await page.getByRole('menuitem').allInnerTexts()).map(t => t.trim().split('\n').pop().trim());
await page.keyboard.press('Escape');
return names;
})();
@@ -22,9 +23,9 @@ module.exports = async ({ page, go, shot, settled, tolerate }) => {
await shot('home-org-workflows');
await picker.click();
await Promise.all([page.waitForEvent('load'), page.getByRole('option', { name: 'Beta', exact: true }).click()]);
await Promise.all([page.waitForEvent('load'), page.getByRole('menuitem', { name: 'Beta' }).click()]);
await settled('/workflows');
await page.getByRole('combobox', { name: 'Organisation' }).waitFor();
await page.getByRole('button', { name: /^Organisation: / }).waitFor();
assert.equal(await page.getByText('Parked', { exact: true }).count(), 0, 'workflow run counts leaked across orgs');
await shot('beta-workflows');
await go('/tasks');
+69
View File
@@ -0,0 +1,69 @@
// Phone-width sweep of the views the November audit flagged (#1757): at
// 390x844 each must fit without horizontal scroll or clipped controls. The
// topbar (with its instance badge) is on every page; /account holds the
// token form, /org/agents the agent rows and the grants card, /events the
// sources table, the event-type rule editor and the mapping editor dialog.
const assert = require('node:assert/strict');
const { staticRoutes } = require('./helpers/routes.cjs');
module.exports = async ({ page, go, shot, fail, settled, tolerate }) => {
// The extension catalogue 502 is a stack-environment issue, not this check.
tolerate(/extensions\/catalogue/);
await page.setViewportSize({ width: 390, height: 844 });
const assertNoOverflow = async (label) => {
const { scrollWidth, innerWidth } = await page.evaluate(() => ({
scrollWidth: document.documentElement.scrollWidth,
innerWidth: window.innerWidth,
}));
if (scrollWidth > innerWidth) {
fail(`${label} overflows 390px: scrollWidth=${scrollWidth} > innerWidth=${innerWidth}`);
}
};
const visit = async (path, label, waitFor) => {
await go(path);
if (waitFor) await settled(waitFor);
await assertNoOverflow(label);
await shot(label);
};
await visit('/account', 'account-tokens', 'text=API tokens');
await visit('/org/agents', 'org-agents', 'text=Credential grants');
await go('/events');
await settled('[role=tab]');
await assertNoOverflow('events');
await shot('events');
// The seeded event type's rule editor (RuleEditor's condition row) opens
// from the Edit button on its row.
const editType = page.locator('button[aria-label^="Edit "]').first();
if (await editType.count()) {
await editType.click();
await page.getByRole('dialog').first().waitFor();
await settled();
await assertNoOverflow('event-type rule editor');
await shot('rule-editor');
await page.keyboard.press('Escape');
await settled();
}
// The mappings tab's editor dialog carries the payload tree.
await page.getByRole('tab', { name: 'Map' }).click();
await settled('text=New mapping');
await assertNoOverflow('mappings list');
const editMapping = page.locator('button', { hasText: 'Edit' }).first();
if (await editMapping.count()) {
await editMapping.click();
await page.getByRole('dialog').first().waitFor();
await settled();
await assertNoOverflow('mapping editor dialog');
await shot('mapping-editor');
}
// Every static route fits 390px (#1767): horizontal scroll fails.
for (const r of staticRoutes()) {
await visit(r, `route ${r}`, null);
}
};
+2 -16
View File
@@ -1,24 +1,10 @@
// Every static route loads without errors, renders, and shows no text with
// stray leading, trailing or doubled spaces.
const fs = require('fs');
const path = require('path');
function routes() {
const src = fs.readFileSync(path.join(__dirname, '../../ui/src/router/index.ts'), 'utf8');
const out = [];
for (const line of src.split('\n')) {
if (/redirect:/.test(line)) continue;
const m = line.match(/path: "([^"]*)"/);
if (!m || m[1].includes(':')) continue;
if (m[1].startsWith('/')) out.push(m[1]);
else if (m[1]) out.push('/org/' + m[1]);
}
return [...new Set(out)];
}
const { staticRoutes } = require('./helpers/routes.cjs');
module.exports = async ({ page, go, shot, fail }) => {
const stray = new Map();
for (const r of routes()) {
for (const r of staticRoutes()) {
await go(r);
await shot(r);
// Log lines are data, not copy.
+2 -2
View File
@@ -35,7 +35,6 @@ require (
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.3 // indirect
github.com/kevinburke/ssh_config v1.6.0 // indirect
github.com/klauspost/compress v1.20.3 // indirect
github.com/mattn/go-colorable v0.1.16 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/mfridman/interpolate v0.0.2 // indirect
@@ -79,14 +78,15 @@ require (
github.com/go-git/go-billy/v6 v6.0.0-beta.1
github.com/go-git/go-git/v6 v6.0.0-beta.1
github.com/go-jose/go-jose/v4 v4.1.6
github.com/go-telegram/bot v1.27.0
github.com/go-webauthn/webauthn v0.18.2
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/jsonschema-go v0.4.3
github.com/google/uuid v1.6.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.8.0
github.com/hiddeco/sshsig v0.2.0
github.com/jackc/pgx/v5 v5.11.0
github.com/klauspost/compress v1.20.3
github.com/moby/moby/api v1.56.1
github.com/moby/moby/client v0.6.2
github.com/modelcontextprotocol/go-sdk v1.8.0
+2 -2
View File
@@ -76,8 +76,6 @@ github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-telegram/bot v1.27.0 h1:PG9yBDzM8O26oUerE9SZwWlHon4RpH8WcNslZ7CEZmE=
github.com/go-telegram/bot v1.27.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM=
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-webauthn/webauthn v0.18.2 h1:0BeftmEHU7i3Dv0VFwBtidy/ba37Vcdjvqst9EYu8Sk=
@@ -106,6 +104,8 @@ github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/
github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8=
github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8=
github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns=
github.com/hiddeco/sshsig v0.2.0 h1:gMWllgKCITXdydVkDL+Zro0PU96QI55LwUwebSwNTSw=
github.com/hiddeco/sshsig v0.2.0/go.mod h1:nJc98aGgiH6Yql2doqH4CTBVHexQA40Q+hMMLHP4EqE=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
+7 -11
View File
@@ -10,6 +10,7 @@ import (
"io"
"os"
"sync"
"sync/atomic"
"github.com/modelcontextprotocol/go-sdk/mcp"
@@ -41,14 +42,6 @@ func AcceptCapture(spec agentrun.CaptureTool, accepted int, value json.RawMessag
return spec.Name + " recorded", true
}
// ServeCaptureMCP serves a stage's capture tools over MCP and appends each
// accepted call to sink as one JSON line. A rejected call is answered with
// its rejection, so the agent can correct it, and is not recorded.
func ServeCaptureMCP(ctx context.Context, specs []agentrun.CaptureTool, sink io.Writer, t mcp.Transport) error {
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
return serveHarnessMCP(ctx, specs, sink, t, server, false)
}
func serveHarnessMCP(ctx context.Context, specs []agentrun.CaptureTool, sink io.Writer, t mcp.Transport, server *mcp.Server, central bool) error {
if central {
cleanup, err := addCentralTools(ctx, server, specs)
@@ -142,12 +135,15 @@ func ServeCaptureFiles(ctx context.Context, specPath, capturesPath string, t mcp
}
defer sink.Close()
server := mcp.NewServer(&mcp.Implementation{Name: "archie", Version: "1"}, nil)
var ready atomic.Bool
server.AddReceivingMiddleware(func(next mcp.MethodHandler) mcp.MethodHandler {
return func(ctx context.Context, method string, req mcp.Request) (mcp.Result, error) {
result, err := next(ctx, method, req)
if err == nil && (method == "tools/list" || method == "tools/call") {
if err := os.WriteFile(capturesPath+".ready", nil, 0o600); err != nil {
return nil, fmt.Errorf("record MCP initialization: %w", err)
if err == nil && (method == "tools/list" || method == "tools/call") && !ready.Load() {
// A call is already recorded by now, so a failed marker must not
// turn it into a tool error; the runner reports the missing marker.
if os.WriteFile(capturesPath+".ready", nil, 0o600) == nil {
ready.Store(true)
}
}
return result, err
+1 -1
View File
@@ -34,7 +34,7 @@ func TestHarnessRequiresMCPInitialization(t *testing.T) {
if !central {
req.CaptureTools = []agentrun.CaptureTool{{Name: "capture_result", Parameters: json.RawMessage(`{"type":"object"}`)}}
}
result, err := NewHarnessRunner(nil).Run(t.Context(), workspace, req, agentrun.Reporter{})
result, err := NewHarnessRunner().Run(t.Context(), workspace, req, agentrun.Reporter{})
if err != nil {
t.Fatal(err)
}
+2 -2
View File
@@ -44,7 +44,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
switch event.Type {
case "assistant":
o.assistant(event.Message, report)
o.assistant(event.Message)
case "user":
o.user(event.Message, report)
case "result":
@@ -55,7 +55,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
}
}
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.Reporter) {
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage) {
var message struct {
ID string `json:"id"`
Usage json.RawMessage `json:"usage"`
+3
View File
@@ -11,6 +11,9 @@ import (
// process groups are unavailable.
func setProcessGroup(*exec.Cmd) {}
// reapGroup has nothing to do where process groups are unavailable.
func reapGroup(*exec.Cmd) {}
// runAsHarnessUser refuses a named harness user where user switching is
// unavailable, rather than running the harness as the worker.
func runAsHarnessUser(_ *exec.Cmd, name string) error {
+8
View File
@@ -22,6 +22,14 @@ func setProcessGroup(cmd *exec.Cmd) {
cmd.Cancel = func() error { return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) }
}
// reapGroup kills whatever the command left running in its process group, so a
// daemonised child cannot outlive the invocation that started it.
func reapGroup(cmd *exec.Cmd) {
if cmd.Process != nil {
_ = syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL)
}
}
// runAsHarnessUser drops the invocation to the Kit's user. A worker running
// as root refuses to start a harness with no user, because the harness would
// then share the worker's user and could read its credentials.
+40 -30
View File
@@ -54,18 +54,11 @@ type HarnessOutput interface {
// guarantees do not depend on the CLI obeying its prompt: the runner checks
// the worktree and the repository's refs and configuration after every
// invocation, runs the gate itself, and owns the process's lifetime.
type HarnessRunner struct {
newOutput func() HarnessOutput
// mcpCommand starts archie's MCP server; it defaults to this binary's
// own "mcp" subcommand.
mcpCommand []string
}
type HarnessRunner struct{}
// NewHarnessRunner returns a runner using newOutput to read each
// invocation. A nil newOutput reads with the adapter the request names.
func NewHarnessRunner(newOutput func() HarnessOutput) *HarnessRunner {
return &HarnessRunner{newOutput: newOutput}
}
// NewHarnessRunner returns a runner that reads each invocation with the
// adapter the request names.
func NewHarnessRunner() *HarnessRunner { return &HarnessRunner{} }
func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
if err := validateHarness(req); err != nil {
@@ -133,7 +126,7 @@ func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.
return res, err
}
gateOutput, gateErr := runHarnessGate(runCtx, req.Gate.Commands, workspace)
gateOutput, gateErr := runHarnessGate(runCtx, req.Harness, req.Gate.Commands, workspace)
if gateErr == nil {
res.Status = agentrun.StatusPassed
return res, nil
@@ -144,7 +137,11 @@ func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.
if res.Iterations >= maxIterations {
return park(res, StopGate, gateOutput), nil
}
verb, prompt = resumeVerb(req.Harness, session), "The quality gate failed. Fix the cause, then stop.\n\n"+gateOutput
verb = resumeVerb(req.Harness, session)
if len(verb) == 0 {
return park(res, StopGate, gateOutput), nil
}
prompt = "The quality gate failed. Fix the cause, then stop.\n\n" + gateOutput
}
}
@@ -171,9 +168,6 @@ func settle(runCtx context.Context, workspace string, before repoState, req agen
}
func (r *HarnessRunner) output(adapter string) HarnessOutput {
if r.newOutput != nil {
return r.newOutput()
}
if a, ok := LookupHarnessAdapter(adapter); ok {
return a.NewOutput()
}
@@ -230,7 +224,9 @@ func harnessArgv(h *agentrun.HarnessSpec, verb []string, prompt, session, mcpCon
}
// resumeVerb continues the session the last invocation reported, falling
// back to the most recent session when the CLI reported none.
// back to the most recent session when the CLI reported none. It returns nil
// when neither is possible: resuming with an empty session ID would start a
// broken command.
func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
if len(h.Resume) > 0 && sessionID != "" {
return slices.Clone(h.Resume)
@@ -238,7 +234,7 @@ func resumeVerb(h *agentrun.HarnessSpec, sessionID string) []string {
if len(h.Continue) > 0 {
return slices.Clone(h.Continue)
}
return slices.Clone(h.Resume)
return nil
}
// invoke runs one harness invocation in its own process group, feeding
@@ -270,8 +266,16 @@ func invoke(ctx context.Context, workspace string, h *agentrun.HarnessSpec, argv
for scanner.Scan() {
out.Line(scanner.Bytes(), report)
}
_, _ = io.Copy(io.Discard, output)
if err := cmd.Wait(); err != nil {
if err := scanner.Err(); err != nil {
// Stop the CLI rather than leave it writing into a pipe nobody parses.
_ = cmd.Cancel()
_, _ = io.Copy(io.Discard, output)
_ = cmd.Wait()
return fmt.Errorf("read harness output: %w", err)
}
waitErr := cmd.Wait()
reapGroup(cmd)
if err := waitErr; err != nil {
if ctx.Err() != nil {
return ctx.Err()
}
@@ -304,14 +308,24 @@ func harnessPrompt(workspace string, req agentrun.Request) string {
return b.String()
}
func runHarnessGate(ctx context.Context, commands []agentrun.Command, workspace string) (string, error) {
// runHarnessGate runs the gate commands confined like the harness: they
// execute code the harness just wrote, so they get its user, its environment
// and its process group rather than the worker's.
func runHarnessGate(ctx context.Context, h *agentrun.HarnessSpec, commands []agentrun.Command, workspace string) (string, error) {
for _, c := range commands {
if len(c.Argv) == 0 {
continue
}
cmd := exec.CommandContext(ctx, c.Argv[0], c.Argv[1:]...)
cmd.Dir = workspace
cmd.WaitDelay = killGrace
cmd.Env = append([]string{}, h.Env...)
setProcessGroup(cmd)
if err := runAsHarnessUser(cmd, h.User); err != nil {
return "", err
}
output, err := cmd.CombinedOutput()
reapGroup(cmd)
switch {
case c.ExpectFailure && err == nil:
return fmt.Sprintf("[%s] expected this command to fail, but it passed:\n%s", c.Name, clipGate(output)),
@@ -507,18 +521,14 @@ func (r *HarnessRunner) prepareCaptures(req agentrun.Request) (config, captures
return fail(err)
}
specPath, capturesPath, configPath := filepath.Join(dir, "tools.json"), filepath.Join(dir, "captures.jsonl"), filepath.Join(dir, "mcp.json")
command := r.mcpCommand
if len(command) == 0 {
self, err := os.Executable()
if err != nil {
return fail(err)
}
command = []string{self}
self, err := os.Executable()
if err != nil {
return fail(err)
}
server := map[string]any{
"env": harnessMCPEnvironment(req.Harness.Env),
"command": command[0],
"args": slices.Concat(command[1:], []string{"mcp", "-spec", specPath, "-captures", capturesPath}),
"command": self,
"args": []string{"mcp", "-spec", specPath, "-captures", capturesPath},
}
cfg, err := json.Marshal(map[string]any{"mcpServers": map[string]any{"archie": server}})
if err != nil {
+7 -3
View File
@@ -7,6 +7,7 @@ import (
"path/filepath"
"slices"
"strings"
"unicode/utf8"
"github.com/google/jsonschema-go/jsonschema"
@@ -15,15 +16,18 @@ import (
// toolCallDetailBytes caps the summary ToolCallReport.Detail carries. This
// rides on every task's observability event stream, so one large file read
// must not dominate it the way baselineMissionBytes-sized content is allowed
// to dominate a builder's own context.
// must not dominate it.
const toolCallDetailBytes = 300
func ClipToolCallDetail(s string) string {
if len(s) <= toolCallDetailBytes {
return s
}
return s[:toolCallDetailBytes] + "…"
cut := toolCallDetailBytes
for cut > 0 && !utf8.RuneStart(s[cut]) {
cut--
}
return s[:cut] + "…"
}
func ProjectScopedRules(workspace, extra string) string {
+6 -12
View File
@@ -36,24 +36,22 @@ func (l ToolLimits) EnsureSpillDir() error {
return nil
}
// Options builds the tool-set options for a single turn or stage.
// There is no aggregate turn output budget; only per-result caps apply.
// Options builds the tool-set options for a single turn or stage. Only
// per-result caps apply; there is no aggregate turn output budget.
func (l ToolLimits) Options(excludeToolsets ...string) ToolSetOptions {
opts := ToolSetOptions{
return ToolSetOptions{
MaxResultChars: l.MaxResultChars,
ExcludeToolsets: excludeToolsets,
SpillDir: l.SpillDir,
}
return opts
}
// ToolSetOptions bounds what a built tool set may do and return.
//
// The zero value builds every available tool with no result limits, which is
// the behaviour this package had before the options existed.
// The zero value builds every available tool with no result limits.
type ToolSetOptions struct {
// SpillDir receives complete results displaced by the per-tool cap. Empty
// selects inline truncation. There is deliberately no aggregate turn cap.
// selects inline truncation.
SpillDir string
// MaxResultChars caps a single tool result. Entries setting
@@ -78,8 +76,7 @@ type ToolSetOptions struct {
}
// reportToolCallCompletion notifies opts.OnToolCall, if set, of one
// completed call. Factored out of toolExecute's closure so the branching
// here doesn't add to that function's own cognitive-complexity budget.
// completed call.
func reportToolCallCompletion(opts ToolSetOptions, entry tools.ToolEntry, result string, err error) {
if opts.OnToolCall == nil {
return
@@ -241,9 +238,6 @@ func toolExecute(entry tools.ToolEntry, opts ToolSetOptions) func(context.Contex
// requireApproval blocks until entry's approval is granted, returning an
// error if it is denied, times out, or the approver misbehaves.
func requireApproval(ctx context.Context, entry tools.ToolEntry, opts ToolSetOptions, args map[string]any) error {
if opts.Approval == nil {
return fmt.Errorf("tool %s requires approval but no approver is configured", entry.Name)
}
approveCtx, cancel := context.WithTimeout(ctx, tools.ToolApprovalTimeout)
defer cancel()
desc := entry.Description
+4 -3
View File
@@ -1,6 +1,7 @@
package agentexec
import (
"context"
"encoding/json"
"log/slog"
@@ -14,16 +15,16 @@ type EventPublisher interface {
// ForwardTaskEvents publishes every event from sub to SubjectForEvents(taskID)
// until sub closes. Failures are logged.
func ForwardTaskEvents(sub *events.Sub, pub EventPublisher, taskID int64, log *slog.Logger) {
func ForwardTaskEvents(ctx context.Context, sub *events.Sub, pub EventPublisher, taskID int64, log *slog.Logger) {
subject := SubjectForEvents(taskID)
for e := range sub.C {
data, err := json.Marshal(e)
if err != nil {
log.Warn("task event marshal failed", "task", taskID, "kind", e.Kind, "err", err)
log.WarnContext(ctx, "task event marshal failed", "task", taskID, "kind", e.Kind, "err", err)
continue
}
if err := pub.Publish(subject, data); err != nil {
log.Warn("task event publish failed", "task", taskID, "kind", e.Kind, "err", err)
log.WarnContext(ctx, "task event publish failed", "task", taskID, "kind", e.Kind, "err", err)
}
}
}
@@ -1,15 +0,0 @@
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
-17
View File
@@ -1,17 +0,0 @@
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
{"type":"assistant","message":{"content":[{"type":"tool_use"
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
{"duration_api_ms": 7263, "stop_reason": "end_turn", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "total_cost_usd": 0.21507700000000002, "usage": {"input_tokens": 6, "cache_creation_input_tokens": 24309, "cache_read_input_tokens": 78105, "output_tokens": 248, "output_tokens_details": {"thinking_tokens": 0}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 24309, "ephemeral_5m_input_tokens": 0}, "inference_geo": "not_available", "iterations": [{"input_tokens": 2, "output_tokens": 89, "cache_read_input_tokens": 34283, "cache_creation_input_tokens": 145, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "type": "message"}], "speed": "standard"}, "modelUsage": {"claude-opus-5-5": {"inputTokens": 6, "outputTokens": 248, "cacheReadInputTokens": 78105, "cacheCreationInputTokens": 24309, "webSearchRequests": 0, "costUSD": 0.21507700000000002, "contextWindow": 1000000, "maxOutputTokens": 128000, "thinkingTokens": 0, "canonicalModel": "claude-opus-5-5", "provider": "firstParty", "costBasis": "list"}}, "permission_denials": [], "terminal_reason": "completed", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "subagent_stats": {"spawned": 0, "requested": {"background": 0, "foreground": 0, "unset": 0}, "started_in_background": 0, "max_depth": 0, "spawned_by_subagents": 0, "completed": 0, "failed": 0, "killed": {"parent": 0, "user": 0, "system": 0}, "refused": {"depth_limit": 0, "concurrency_limit": 0, "budget": 0}, "by_type": {}}, "is_error": false, "num_turns": 3, "subtype": "success", "api_error_status": null, "result": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session.", "ttft_ms": 3229, "type": "result", "duration_ms": 7717, "uuid": "d0b46ba2-f8ff-49eb-b35e-b4eb6b9b272b", "ttft_stream_ms": 2833, "time_to_request_ms": 102, "first_content_frame_ms": 2834, "queued_turn_count": 0, "result_index": 0}
-16
View File
@@ -1,16 +0,0 @@
{"type": "system", "subtype": "hook_started", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "959d5b3d-d376-4416-9abb-71e0b8a36047", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "1f5ed274-0baa-4558-b00f-36ef98d28ebc", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "5aa154a9-9315-4a6c-8de0-750cb35139cf", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_started", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "uuid": "ef74547a-736e-4bb9-bd68-16cc1592b2a3", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "3364ed13-2659-4abb-bda4-58243f1eb065", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "398b087e-942b-4d67-904c-1778d3b20063", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "04acf4c4-0c8d-4dd5-9d3a-a7a6df371224", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "ecbfdcf2-446c-4386-a89f-eeaf43e48b46", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "4c58406e-b5f0-49d7-af88-483c14212e0d", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "c10b3042-e990-49db-8937-954b6fe11570", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "hook_response", "hook_id": "a0cb320b-0bdd-45b5-90b5-451add28d1ed", "hook_name": "SessionStart:startup", "hook_event": "SessionStart", "output": "", "stdout": "", "stderr": "", "exit_code": 0, "outcome": "success", "uuid": "3a3327f8-ad24-46d7-a194-e0ce68f9f871", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "system", "subtype": "init", "cwd": "/workspace", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "tools": ["Task", "Bash", "Edit", "Read", "Write"], "mcp_servers": [], "model": "claude-opus-5-5", "permissionMode": "bypassPermissions", "slash_commands": [], "terminal_slash_commands": [], "apiKeySource": "none", "claude_code_version": "2.1.282", "output_style": "default", "agents": [], "skills": [], "plugins": [], "capabilities": ["interrupt_receipt_v1", "interrupt_cancel_queued_v1", "msg_lifecycle_v1", "mcp_read_resource_v1", "mcp_tool_ui_meta_v1"], "analytics_disabled": false, "product_feedback_disabled": false, "uuid": "0ad7c54e-a817-406b-af22-8f647b4e0021", "memory_paths": {}, "messaging_socket_path": "", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "per_turn_effort_active": true, "view_mode": "default"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZ2iQ3sZ59vJ9CCae9", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "name": "Bash", "input": {"command": "echo hello", "description": "Print hello"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 23584, "cache_read_input_tokens": 10119, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 23584}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "b4c3b51e-0a58-4b28-8c5a-20a2ff2aaadb", "timestamp": "2026-09-25T17:22:54.134Z", "request_id": "req_011CfQYZ2Ddp5YubZj8vB9Fb", "wire_tool_inputs": {"toolu_01P8qrSZwqH1jjZXfrZETjKz": {"command": "echo hello", "description": "Print hello"}}}
{"type": "rate_limit_event", "rate_limit_info": {"status": "allowed_warning", "resetsAt": 1790377200, "rateLimitType": "seven_day", "utilization": 0.98, "isUsingOverage": false, "surpassedThreshold": 0.75, "unifiedWindows": {"five_hour": {"utilization": 0.76, "resetsAt": 1790366400}, "seven_day": {"utilization": 0.98, "resetsAt": 1790377200}}}, "uuid": "a91b2340-329e-4c73-8e1a-307860859743", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92"}
{"type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01P8qrSZwqH1jjZXfrZETjKz", "type": "tool_result", "content": "hello", "is_error": false}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "6beae671-52a0-499a-b72b-f9321c1d9e14", "timestamp": "2026-09-25T17:22:54.460Z", "tool_use_result": {"stdout": "hello", "stderr": "", "interrupted": false, "isImage": false, "noOutputExpected": false}}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZHW9AJ164FSYj39uG", "type": "message", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01YNNETbc61jN44ATXrmHdEC", "name": "Bash", "input": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}, "caller": {"type": "direct"}}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 580, "cache_read_input_tokens": 33703, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 580}, "output_tokens": 16, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "3b14941d-c8eb-45f4-b555-829e06119f19", "timestamp": "2026-09-25T17:22:56.420Z", "request_id": "req_011CfQYZH18nwJgBYNZs8XGq", "wire_tool_inputs": {"toolu_01YNNETbc61jN44ATXrmHdEC": {"command": "cat /nonexistent-file", "description": "Read a nonexistent file"}}}
{"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "content": "Exit code 1\ncat: /nonexistent-file: No such file or directory", "is_error": true, "tool_use_id": "toolu_01YNNETbc61jN44ATXrmHdEC"}]}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "395dc93d-0e4f-40b5-854b-77a128aa0990", "timestamp": "2026-09-25T17:22:56.442Z", "tool_use_result": "Error: Exit code 1\ncat: /nonexistent-file: No such file or directory"}
{"type": "assistant", "message": {"model": "claude-opus-5-5", "id": "msg_011CfQYZRy8qPUaVcnVs9CQD", "type": "message", "role": "assistant", "content": [{"type": "text", "text": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session."}], "container": null, "stop_reason": null, "stop_sequence": null, "stop_details": null, "usage": {"input_tokens": 2, "cache_creation_input_tokens": 145, "cache_read_input_tokens": 34283, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "output_tokens": 89, "service_tier": "standard", "inference_geo": "not_available"}, "input_transformations": [], "diagnostics": null, "context_management": null}, "parent_tool_use_id": null, "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "uuid": "8f97a329-c76c-4b90-b154-bda9468b969d", "timestamp": "2026-09-25T17:22:58.580Z", "request_id": "req_011CfQYZRSdq9mNMbE7n8okT"}
{"duration_api_ms": 7263, "stop_reason": "end_turn", "session_id": "9c22c15c-80ef-42c6-a503-8d087ec47d92", "total_cost_usd": 0.21507700000000002, "usage": {"input_tokens": 6, "cache_creation_input_tokens": 24309, "cache_read_input_tokens": 78105, "output_tokens": 248, "output_tokens_details": {"thinking_tokens": 0}, "server_tool_use": {"web_search_requests": 0, "web_fetch_requests": 0}, "service_tier": "standard", "cache_creation": {"ephemeral_1h_input_tokens": 24309, "ephemeral_5m_input_tokens": 0}, "inference_geo": "not_available", "iterations": [{"input_tokens": 2, "output_tokens": 89, "cache_read_input_tokens": 34283, "cache_creation_input_tokens": 145, "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 145}, "type": "message"}], "speed": "standard"}, "modelUsage": {"claude-opus-5-5": {"inputTokens": 6, "outputTokens": 248, "cacheReadInputTokens": 78105, "cacheCreationInputTokens": 24309, "webSearchRequests": 0, "costUSD": 0.21507700000000002, "contextWindow": 1000000, "maxOutputTokens": 128000, "thinkingTokens": 0, "canonicalModel": "claude-opus-5-5", "provider": "firstParty", "costBasis": "list"}}, "permission_denials": [], "terminal_reason": "completed", "fast_mode_state": "off", "fast_mode_disabled_reason": "sdk_opt_in_required", "subagent_stats": {"spawned": 0, "requested": {"background": 0, "foreground": 0, "unset": 0}, "started_in_background": 0, "max_depth": 0, "spawned_by_subagents": 0, "completed": 0, "failed": 0, "killed": {"parent": 0, "user": 0, "system": 0}, "refused": {"depth_limit": 0, "concurrency_limit": 0, "budget": 0}, "by_type": {}}, "is_error": false, "num_turns": 3, "subtype": "success", "api_error_status": null, "result": "done\n\nThe first command printed `hello`. The second failed with \"No such file or directory\".\n\nGoogle Drive, exa and intercom still need authorizing. Google Drive is set up in its claude.ai connector settings. For exa and intercom, run `/mcp` in an interactive session.", "ttft_ms": 3229, "type": "result", "duration_ms": 7717, "uuid": "d0b46ba2-f8ff-49eb-b35e-b4eb6b9b272b", "ttft_stream_ms": 2833, "time_to_request_ms": 102, "first_content_frame_ms": 2834, "queued_turn_count": 0, "result_index": 0}
-8
View File
@@ -1,8 +0,0 @@
{"type":"thread.started","thread_id":"01a0db19-f9d6-7ad2-870c-c29b7fd8ab0a"}
{"type":"turn.started"}
{"type":"item.started","item":{"id":"item_0","type":"mcp_tool_call","server":"archie","tool":"record_verdict","arguments":{"verdict":"ok"},"result":null,"error":null,"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_0","type":"mcp_tool_call","server":"archie","tool":"record_verdict","arguments":{"verdict":"ok"},"result":{"content":[{"type":"text","text":"record_verdict recorded"}],"structured_content":null},"error":null,"status":"completed"}}
{"type":"item.started","item":{"id":"item_1","type":"file_change","changes":[{"path":"/tmp/hfx/note.txt","kind":"add"}],"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_1","type":"file_change","changes":[{"path":"/tmp/hfx/note.txt","kind":"add"}],"status":"completed"}}
{"type":"item.completed","item":{"id":"item_2","type":"agent_message","text":"done"}}
{"type":"turn.completed","usage":{"input_tokens":96397,"cached_input_tokens":80896,"cache_write_input_tokens":0,"output_tokens":203,"reasoning_output_tokens":87}}
-9
View File
@@ -1,9 +0,0 @@
{"type":"thread.started","thread_id":"01a0db18-e119-7872-bf13-3644369044fb"}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"I’ll run the two requested shell commands in order, exactly as written."}}
{"type":"item.started","item":{"id":"item_1","type":"command_execution","command":"/usr/bin/bash -lc 'echo hello'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_1","type":"command_execution","command":"/usr/bin/bash -lc 'echo hello'","aggregated_output":"hello\n","exit_code":0,"status":"completed"}}
{"type":"item.started","item":{"id":"item_2","type":"command_execution","command":"/usr/bin/bash -lc 'cat /nonexistent-file'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_2","type":"command_execution","command":"/usr/bin/bash -lc 'cat /nonexistent-file'","aggregated_output":"cat: /nonexistent-file: No such file or directory\n","exit_code":1,"status":"failed"}}
{"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"done"}}
{"type":"turn.completed","usage":{"input_tokens":72082,"cached_input_tokens":57600,"cache_write_input_tokens":0,"output_tokens":118,"reasoning_output_tokens":0}}
-12
View File
@@ -1,12 +0,0 @@
{"type":"user.message","data":{"content":"Call the archie record_verdict tool with verdict \"ok\", then reply done.","transformedContent":"<current_datetime>2026-09-26T10:24:51.899+10:00</current_datetime>\n\nCall the archie record_verdict tool with verdict \"ok\", then reply done.","messageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","supportedNativeDocumentMimeTypes":[],"delivery":"idle","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","parentAgentTaskId":"695a0eb0-7c9f-403f-bf8a-11b359bbd6ef"},"id":"e6d6b78e-25a8-4718-9ab5-21730e4c1930","timestamp":"2026-09-26T00:24:51.899Z","parentId":"cf961d42-16aa-496f-81d2-f205e525c341"}
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62"},"id":"43c30d9f-a78d-49ab-a73d-a5059d6a8f33","timestamp":"2026-09-26T00:24:51.951Z","parentId":"d0f5807a-db5a-4bf5-bfca-0a0df80eb3e1"}
{"type":"assistant.message","data":{"messageId":"10378468-f2b3-4f1f-bbca-876991380095","originatingMessageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","name":"archie-record_verdict","arguments":{"verdict":"ok"},"type":"function","toolTitle":"record_verdict","mcpServerName":"archie","mcpToolName":"record_verdict"}],"interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","rte":true,"apiCallId":"o4IeQmLtNQWeaj+YWo08mszPXOF1AP702ynApqaRloJ8MNMmCNuUlmqMMdwDx27Tz5AVPoX1PWYGPBcL7y+TQE22HWxuzkAPH8S8LdvfGV+ancUM6NM1SeWCj3Q3JzZNPxQUkRqNJ7D2vvMLcAVYOMHfOU9+Bu1dTI/+opLLn4L85IaRKa20wJ3cN5Lh0kRIoBYWrYQwImIBAkjaPlIOJRUNku2BLwFcBeNciBkvwBW6v0dUAE3GOvt8Wi8u2ierGofUYTmv4PNRZJnEjE69og/rOlP+b7x8Zf6amoEaZoFBET1Kw8Or57gcsdumstObCF+2MI8oFfnMg3igVm8/ZHMmTlUebjfNsc2PlzVyFWZfT5SwY+LjyzE22QTggIQwZ1kNUI7baA3JMqo5PQuoztdTWtJuz/u42q43kOLKhnj+P2YGP/I5FBvLbDcghIsS","serverTools":{"provider":"openai-responses"}},"id":"9adeb15a-b245-4b11-948e-9e688e7b1dad","timestamp":"2026-09-26T00:24:55.924Z","parentId":"43c30d9f-a78d-49ab-a73d-a5059d6a8f33"}
{"type":"tool.execution_start","data":{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","toolName":"archie-record_verdict","arguments":{"verdict":"ok"},"turnId":"0","model":"mai-code-1.1-flash","toolTitle":"record_verdict","mcpServerName":"archie","mcpConfigServerName":"archie","mcpTransport":"stdio","mcpConfigSource":"user","mcpToolName":"record_verdict"},"id":"fffc906a-39af-4eb1-91ba-80fa0f8cb7f7","timestamp":"2026-09-26T00:24:55.927Z","parentId":"9adeb15a-b245-4b11-948e-9e688e7b1dad"}
{"type":"tool.execution_complete","data":{"toolCallId":"call_SCpBb7giULn1ses3WUvaZ646","model":"mai-code-1.1-flash","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"0","rte":true,"success":true,"result":{"content":"record_verdict recorded","detailedContent":"record_verdict recorded","contents":[{"type":"text","text":"record_verdict recorded"}]},"toolTelemetry":{"metrics":{"mcp_result_content_bytes":23}}},"id":"97d661ef-f75b-4734-b358-c843a3e5543d","timestamp":"2026-09-26T00:24:55.931Z","parentId":"fffc906a-39af-4eb1-91ba-80fa0f8cb7f7"}
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"6a3adff0-7017-4c44-8d8d-b32d94442b7b","timestamp":"2026-09-26T00:24:55.936Z","parentId":"97d661ef-f75b-4734-b358-c843a3e5543d"}
{"type":"assistant.turn_start","data":{"turnId":"1","interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62"},"id":"20538fbe-354e-4c37-a66d-dd169baaae6c","timestamp":"2026-09-26T00:24:55.937Z","parentId":"6a3adff0-7017-4c44-8d8d-b32d94442b7b"}
{"type":"assistant.message_start","data":{"messageId":"fd2cd067-22f8-45a3-996e-5b5170455259","phase":"final_answer"},"ephemeral":true,"id":"0aa849db-670e-4d8c-bf28-4b67fedbfefd","timestamp":"2026-09-26T00:24:58.682Z","parentId":"20538fbe-354e-4c37-a66d-dd169baaae6c"}
{"type":"assistant.message","data":{"messageId":"fd2cd067-22f8-45a3-996e-5b5170455259","originatingMessageId":"6edfda87-baa7-43ae-9085-b35df7730a5b","model":"mai-code-1.1-flash","content":"done","toolRequests":[],"interactionId":"ffa78343-e6f5-42aa-aea1-867cf22d8c62","turnId":"1","phase":"final_answer","rte":true,"apiCallId":"rQ30ntxRLGIEBrvhcd/a8wMwoTOBA1A5DiGkpF5vfM/MXyIvo81P2W19LNGRYtko/DuDhi1S2NbJp2REVkOsV7QiReoS59ABuGoME9Jp5ccwWfjR4dtfrwZY7ARBkDjoE79/dt0e+73SvAIoP6Vc5DoJ1aBOlDb1Uo7sGxyPDUPNfnjFc0ZSSr1YHviwGcVOoSkB66IrY+zzdz+s43b+Kn9sDiFD/28bvxdH3o6tqmuuVYL35qGuyhoDUlRKk4JXTB8aAjw1IS+lXYVYHfoGhv6F+ZEIf9H/KOVioWCfW3wPEyNOiPyA0qH9gy8g6V1rminPG+6JgwPdZ3QVEuOddFQjj8OjpTLHYKyKVDRxwNq7p0WEH1Wgb8wPpSZpHtAHoHL5rlsSCWcZcoAKFU/Eh+pi9ms073CsMyjhwu+x93O5x8z/pv8CD8BRkJuT0lH6","serverTools":{"provider":"openai-responses"}},"id":"c1b6cb34-b547-4b09-a057-042129d8e8e6","timestamp":"2026-09-26T00:24:59.033Z","parentId":"20538fbe-354e-4c37-a66d-dd169baaae6c"}
{"type":"assistant.turn_end","data":{"turnId":"1"},"id":"ac711ef0-98c9-4903-8605-d0a075038156","timestamp":"2026-09-26T00:24:59.037Z","parentId":"c1b6cb34-b547-4b09-a057-042129d8e8e6"}
{"type":"assistant.idle","data":{},"ephemeral":true,"id":"3cdd0759-c01f-4670-bd89-1d7d265057c5","timestamp":"2026-09-26T00:24:59.042Z","parentId":"dde7674c-f216-47d1-99dc-b1a42340e3ab"}
{"type":"result","timestamp":"2026-09-26T00:24:59.048Z","sessionId":"46ce5d05-adf6-45ac-82bc-167a3c48a146","exitCode":0,"usage":{"premiumRequests":1,"totalApiDurationMs":7028,"sessionDurationMs":10510,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]}}}
-21
View File
@@ -1,21 +0,0 @@
{"type":"user.message","data":{"content":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file","transformedContent":"<current_datetime>2026-09-26T10:24:05.291+10:00</current_datetime>\n\nRun exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file","messageId":"592e4a25-4edd-4138-8428-04377528629d","supportedNativeDocumentMimeTypes":[],"delivery":"idle","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","parentAgentTaskId":"a7334356-386f-4883-a45b-c0202257c75e"},"id":"30170ef7-73c3-4ddc-b68a-420fa53126c5","timestamp":"2026-09-26T00:24:05.291Z","parentId":"c5779a53-653b-4d88-9a5d-5d04392191bc"}
{"type":"assistant.turn_start","data":{"turnId":"0","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"7eaf3f4d-f167-4458-87ee-3d5590b00c18","timestamp":"2026-09-26T00:24:05.334Z","parentId":"14d0190b-e039-42f9-a4b9-0a75ae807f1f"}
{"type":"assistant.message","data":{"messageId":"6b6bea7c-2344-47a1-95db-1f8d6e682666","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","name":"bash","arguments":{"command":"echo hello","description":"Run the first required shell command","mode":"sync","initial_wait":10},"type":"function","intentionSummary":"Run the first required shell command"}],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","rte":true,"apiCallId":"f62pmo58wYEiXCowGq2scylnq7Sl72p0HPwz/uzwyAxSnDimAMaUhplE5ob+c/7UI4GlY/FKov+OuTgP6cZYK7vKyWfmHE9irEusbHzDNwaNyfjyJzDuyko5LEHYhPYh4tVFCdob6X764KL1JPVls66S+KZU6pxGyqW5Z9SuYNl1pw/T/mtRZamdmejkxNtprl6c6SZjn//mGF8QAUE5TTHGCUf4ZVynuCu8OplI6+WU4ecM86bUgFHRxHdAml3UpXrLnhhqGf/24sMtIaZdm5XhxNYtpTn1HD5ZDHsyS0pJBAstHCT3zpdjkkg+oy+9I7cfZ8D/aE8tLJjRO36rY69+r2QhLB7gko41WnZhgeTlxtgIaUpEbA5RT325gzH2y70ryklfEwUfM3vecHLbSmBPBVo/2Si5tAMzaX9/fePrelVxJZmogzX2zFEM7oZH","serverTools":{"provider":"openai-responses"}},"id":"18daf5a9-28ad-4e32-a964-c7a7b2fa3561","timestamp":"2026-09-26T00:24:07.616Z","parentId":"7eaf3f4d-f167-4458-87ee-3d5590b00c18"}
{"type":"tool.execution_start","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","toolName":"bash","arguments":{"command":"echo hello","description":"Run the first required shell command","mode":"sync","initial_wait":10},"turnId":"0","model":"mai-code-1.1-flash","shellToolInfo":{"possiblePaths":[],"hasWriteFileRedirection":false}},"id":"495b5003-1cae-48ab-a3cf-299aebdbcd57","timestamp":"2026-09-26T00:24:07.617Z","parentId":"18daf5a9-28ad-4e32-a964-c7a7b2fa3561"}
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","partialOutput":"hello\n"},"ephemeral":true,"id":"bfa8c93e-8702-4405-9f34-fcf2e488a5f7","timestamp":"2026-09-26T00:24:07.671Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","partialOutput":"hello\n"},"ephemeral":true,"id":"f2a7773b-fc90-4dec-90a2-7f59a9703002","timestamp":"2026-09-26T00:24:07.671Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
{"type":"tool.execution_complete","data":{"toolCallId":"call_B7mfLIxqUZJ0U7TPuq7AICf6","model":"mai-code-1.1-flash","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"0","rte":true,"shellExecution":{"exitCode":0},"success":true,"result":{"content":"hello\n<shellId: 0 completed with exit code 0>","detailedContent":"hello\n<shellId: 0 completed with exit code 0>"},"toolTelemetry":{"properties":{"customTimeout":"true","executionMode":"sync","detached":"false","sandboxApplied":"false","sandboxOptOutRequested":"false"},"metrics":{"commandTimeout":30000}}},"id":"1998c4e2-5bc7-48ec-b25a-22e09e0b8c94","timestamp":"2026-09-26T00:24:07.676Z","parentId":"495b5003-1cae-48ab-a3cf-299aebdbcd57"}
{"type":"assistant.turn_end","data":{"turnId":"0"},"id":"5f5a4959-c817-4e68-b29b-393bc2489708","timestamp":"2026-09-26T00:24:07.681Z","parentId":"1998c4e2-5bc7-48ec-b25a-22e09e0b8c94"}
{"type":"assistant.turn_start","data":{"turnId":"1","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"e637d527-fe9a-40a3-b686-7d351233ac5e","timestamp":"2026-09-26T00:24:07.682Z","parentId":"5f5a4959-c817-4e68-b29b-393bc2489708"}
{"type":"assistant.message","data":{"messageId":"ee78bdc4-8346-4970-95ed-de15d5b92dbb","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"","toolRequests":[{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","name":"bash","arguments":{"command":"cat /nonexistent-file","description":"Run the second required shell command to trigger the expected error","mode":"sync","initial_wait":10},"type":"function","intentionSummary":"Run the second required shell command to trigger the expected error"}],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"1","rte":true,"apiCallId":"KG3rWA5KnDXtL/Ftwooj+JjuuS+L+ah1aYHMcnKw9dFSwz3o2iOv3slDRYSqE5e2KrWgrIFsDtMAgiXlXahwtf8vnIpJgcRQrv2dJqpiPx955GxFNfsv0y+LitYKH69Iv+707wPPOfekR97bhzfXA2QGjna6+0FzEW/ZHT8LfAIfiyqai9XiXiOhZOTKVxAJ5xmJSZqDTtt8V+Ut2EL/3LCl19/wYTTF0YAHEjSovoQP19hx3RAqXCMhnJd1Uy4q4mlsNNvbGIPbcZwLrfNVTnVa9BV4mECvecH9IeJ9axMUZS/lA/jU3Da5VNCEtsXOYnhk6DX8tSNQLB+NYumqzmk2X+dUq2Wb3Y8W/MoL7c0//NSYqYDbRjLkEpaaKZYiibA/KFE5XVp48Gdd+cnzODhH1K4O39xTwAHjQlflj1s39qRqMRw6CL6tDf/frGwU","serverTools":{"provider":"openai-responses"}},"id":"64c89fe7-be35-41f2-9127-034874b52d95","timestamp":"2026-09-26T00:24:09.954Z","parentId":"e637d527-fe9a-40a3-b686-7d351233ac5e"}
{"type":"tool.execution_start","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","toolName":"bash","arguments":{"command":"cat /nonexistent-file","description":"Run the second required shell command to trigger the expected error","mode":"sync","initial_wait":10},"turnId":"1","model":"mai-code-1.1-flash","shellToolInfo":{"possiblePaths":[],"hasWriteFileRedirection":false}},"id":"a240e698-9aaa-43d3-bdb8-517399bb9c2a","timestamp":"2026-09-26T00:24:09.956Z","parentId":"64c89fe7-be35-41f2-9127-034874b52d95"}
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","partialOutput":"cat: /nonexistent-file: No such file or directory\n"},"ephemeral":true,"id":"554fa3fb-6bb0-4b8d-b2ec-723131f48064","timestamp":"2026-09-26T00:24:09.966Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
{"type":"tool.execution_partial_result","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","partialOutput":"cat: /nonexistent-file: No such file or directory\n"},"ephemeral":true,"id":"94dae986-d597-40a5-831c-388182db7301","timestamp":"2026-09-26T00:24:09.966Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
{"type":"tool.execution_complete","data":{"toolCallId":"call_KOZ6Yo6H2tFaGF8JSeHhROJ1","model":"mai-code-1.1-flash","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"1","rte":true,"shellExecution":{"exitCode":1},"success":true,"result":{"content":"cat: /nonexistent-file: No such file or directory\n<shellId: 1 completed with exit code 1>","detailedContent":"cat: /nonexistent-file: No such file or directory\n<shellId: 1 completed with exit code 1>"},"toolTelemetry":{"properties":{"customTimeout":"true","executionMode":"sync","detached":"false","sandboxApplied":"false","sandboxOptOutRequested":"false","shell_error_category":"command_nonzero_exit"},"metrics":{"commandTimeout":30000,"exit_code":1}}},"id":"f22d0b04-9056-4d5c-b798-6a3eb26cc2b1","timestamp":"2026-09-26T00:24:09.971Z","parentId":"a240e698-9aaa-43d3-bdb8-517399bb9c2a"}
{"type":"assistant.turn_end","data":{"turnId":"1"},"id":"f823f0b3-33d8-4ca5-a111-733fa58c66e9","timestamp":"2026-09-26T00:24:09.975Z","parentId":"f22d0b04-9056-4d5c-b798-6a3eb26cc2b1"}
{"type":"assistant.turn_start","data":{"turnId":"2","interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a"},"id":"361e7d6b-7832-4137-9d71-b2ca66d90526","timestamp":"2026-09-26T00:24:09.975Z","parentId":"f823f0b3-33d8-4ca5-a111-733fa58c66e9"}
{"type":"assistant.message_start","data":{"messageId":"d92c3a5f-329a-4b84-8548-76a9f6acf6a9","phase":"final_answer"},"ephemeral":true,"id":"09bcf00a-0f8e-44c7-9539-98ac6b25f150","timestamp":"2026-09-26T00:24:11.613Z","parentId":"361e7d6b-7832-4137-9d71-b2ca66d90526"}
{"type":"assistant.message","data":{"messageId":"d92c3a5f-329a-4b84-8548-76a9f6acf6a9","originatingMessageId":"592e4a25-4edd-4138-8428-04377528629d","model":"mai-code-1.1-flash","content":"done","toolRequests":[],"interactionId":"6bd23866-01a9-4330-a002-3630c4c1fe7a","turnId":"2","phase":"final_answer","rte":true,"apiCallId":"HnNPE0K4S9Sfzu3aBEKNBu0bN71YXywM7Iou7HJYeGMBSegpo3BPJcfUERt8oGnSgEpfS5aEntUzNMfpuS91+3QbHxfDkApmOYcWeU/YXFlpQkgeT8bhYmNQ0g+Lpo7Zf45jMikQQ23xdX7r4zQHEXBud6cWLde+ujXNZ4Tc3mq1fPTvsa2Z4qD9gCRKwFksOqOQR4UeRuRRxIr2qWEXs61qj4xfH7BM0IAbm07zCyv6arLfHHhtbe/wXkv7fBWCbtQufB+KRW8Z5Wo+6peGgEi4x9ayQETTUG3K/q6nUY3wbHVquOI/UYHZewJFwPDfleQq2l6Okim8ftIIvoNfyvIy1GRDS/n/UnrUpDG1NNmgJDDcDIManTx9wpywEGR/K8gzfl98ddcd5N+6RC4G678wPu9AQef65ztQyKJB5jFLzkhI1LPc5+yTY0V8gZMA","serverTools":{"provider":"openai-responses"}},"id":"4657559f-58ec-4922-bed9-7fc89cdc7de9","timestamp":"2026-09-26T00:24:11.832Z","parentId":"361e7d6b-7832-4137-9d71-b2ca66d90526"}
{"type":"assistant.turn_end","data":{"turnId":"2"},"id":"b5ad8a1e-47f2-460b-ac09-0fe63f266271","timestamp":"2026-09-26T00:24:11.833Z","parentId":"4657559f-58ec-4922-bed9-7fc89cdc7de9"}
{"type":"assistant.idle","data":{},"ephemeral":true,"id":"1bcbd91f-9903-4b9a-8c22-cfea0d567a80","timestamp":"2026-09-26T00:24:11.838Z","parentId":"e800bf25-1659-4023-8e1c-55270f374526"}
{"type":"result","timestamp":"2026-09-26T00:24:11.847Z","sessionId":"bdf5531e-b8a4-4baf-bed2-d914242fa387","exitCode":0,"usage":{"premiumRequests":1,"totalApiDurationMs":6371,"sessionDurationMs":14653,"codeChanges":{"linesAdded":0,"linesRemoved":0,"filesModified":[]}}}
-29
View File
@@ -1,29 +0,0 @@
{"type":"session","version":3,"id":"01a0db18-e4a1-7000-9cbe-7467b0385e65","timestamp":"2026-09-26T00:23:56.833Z","cwd":"/tmp/hfx"}
{"type":"agent_start"}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"attribution":"user","timestamp":1790382237281}}
{"type":"message_end","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"attribution":"user","timestamp":1790382237281}}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple","thinkingSignature":"reasoning_content"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple: run echo hello, then cat /nonexistent-file. One at a time.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"call_00_nr3UPjdQx9tkGIlERsCP4300","name":"bash","arguments":{"command":"echo hello","i":"Running echo hello"},"partialArgs":"{\"command\": \"echo hello\", \"i\": \"Running echo hello\"}","streamIndex":0,"intent":"Running echo hello"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":25222,"output":75,"cacheRead":0,"cacheWrite":0,"totalTokens":25297,"reasoningTokens":19,"cost":{"input":0.0037833,"output":0.000044999999999999996,"cacheRead":0,"cacheWrite":0,"total":0.0038282999999999998}},"stopReason":"toolUse","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b","duration":1472.9358650000001,"ttft":1164.486779,"completedAt":1790382238970}}
{"type":"tool_execution_start","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"intent":"Running echo hello"}
{"type":"tool_execution_update","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n"}],"details":{}}}
{"type":"tool_execution_update","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038}}}
{"type":"tool_execution_end","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","result":{"content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038}},"isError":false}
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}}
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Simple: run echo hello, then cat /nonexistent-file. One at a time.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"call_00_nr3UPjdQx9tkGIlERsCP4300","name":"bash","arguments":{"command":"echo hello","i":"Running echo hello"},"partialArgs":"{\"command\": \"echo hello\", \"i\": \"Running echo hello\"}","streamIndex":0,"intent":"Running echo hello"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":25222,"output":75,"cacheRead":0,"cacheWrite":0,"totalTokens":25297,"reasoningTokens":19,"cost":{"input":0.0037833,"output":0.000044999999999999996,"cacheRead":0,"cacheWrite":0,"total":0.0038282999999999998}},"stopReason":"toolUse","timestamp":1790382237472,"responseId":"065106e6-b09d-48f7-b6c6-e4e85fde221b","duration":1472.9358650000001,"ttft":1164.486779},"toolResults":[{"role":"toolResult","toolCallId":"call_00_nr3UPjdQx9tkGIlERsCP4300","toolName":"bash","content":[{"type":"text","text":"hello\n\n\nWall time: 0.03 seconds"}],"details":{"timeoutSeconds":300,"wallTimeMs":28.820365000000038},"isError":false,"timestamp":1790382239011}]}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0,"intent":"Reading nonexistent file"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":231,"output":61,"cacheRead":25088,"cacheWrite":0,"totalTokens":25380,"cost":{"input":0.000034649999999999995,"output":0.000036599999999999995,"cacheRead":0.000075264,"cacheWrite":0,"total":0.000146514}},"stopReason":"toolUse","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949","duration":1915.5203490000004,"completedAt":1790382240956}}
{"type":"tool_execution_start","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"intent":"Reading nonexistent file"}
{"type":"tool_execution_update","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n"}],"details":{}}}
{"type":"tool_execution_update","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1}}}
{"type":"tool_execution_end","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","result":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true},"isError":true}
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}}
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","name":"bash","arguments":{"command":"cat /nonexistent-file","i":"Reading nonexistent file"},"partialArgs":"{\"command\": \"cat /nonexistent-file\", \"i\": \"Reading nonexistent file\"}","streamIndex":0,"intent":"Reading nonexistent file"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":231,"output":61,"cacheRead":25088,"cacheWrite":0,"totalTokens":25380,"cost":{"input":0.000034649999999999995,"output":0.000036599999999999995,"cacheRead":0.000075264,"cacheWrite":0,"total":0.000146514}},"stopReason":"toolUse","timestamp":1790382239018,"responseId":"d232767b-4ac0-4264-b166-1234dd27e949","duration":1915.5203490000004},"toolResults":[{"role":"toolResult","toolCallId":"call_00_ET_2IFtDySsuHmiOftiTqJg7979","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nWall time: 0.00 seconds\n\nCommand exited with code 1"}],"details":{"timeoutSeconds":300,"wallTimeMs":2.267550999999912,"exitCode":1},"isError":true,"timestamp":1790382240960}]}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n("}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n(2) exited 1: `cat: /nonexistent-file: No such file or directory`"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":205,"output":25,"cacheRead":25216,"cacheWrite":0,"totalTokens":25446,"cost":{"input":0.000030749999999999995,"output":0.000014999999999999999,"cacheRead":0.000075648,"cacheWrite":0,"total":0.00012139799999999999}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22","duration":1189.6723079999992,"ttft":1106.6433019999995,"completedAt":1790382242178}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"text","text":"done\n\n(2) exited 1: `cat: /nonexistent-file: No such file or directory`"}],"api":"openai-completions","provider":"deepseek","model":"deepseek-flash","usage":{"input":205,"output":25,"cacheRead":25216,"cacheWrite":0,"totalTokens":25446,"cost":{"input":0.000030749999999999995,"output":0.000014999999999999999,"cacheRead":0.000075648,"cacheWrite":0,"total":0.00012139799999999999}},"stopReason":"stop","timestamp":1790382240964,"responseId":"5183f0c3-4531-44b6-b80a-61b6290dfb22","duration":1189.6723079999992,"ttft":1106.6433019999995},"toolResults":[]}
{"type":"agent_end","messages":[],"isTerminal":true}
-30
View File
@@ -1,30 +0,0 @@
{"type":"session","version":3,"id":"01a0db18-e183-7432-9e4b-4b16bfc83856","timestamp":"2026-09-26T00:23:56.037Z","cwd":"/tmp/hfx"}
{"type":"agent_start"}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"timestamp":1790382237711}}
{"type":"message_end","message":{"role":"user","content":[{"type":"text","text":"Run exactly these two shell commands, one at a time, then reply \"done\": 1) echo hello 2) cat /nonexistent-file"}],"timestamp":1790382237711}}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"},"partialArgs":"{\"command\":\"echo hello\"}","streamIndex":0}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382237724,"responseId":"chatcmpl-176"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":36426,"output":12,"cacheRead":0,"cacheWrite":0,"reasoning":0,"totalTokens":36438,"cost":{"input":0.0054639,"output":0.000006,"cacheRead":0,"cacheWrite":0,"total":0.0054699}},"stopReason":"toolUse","timestamp":1790382237724,"responseId":"chatcmpl-176","rawStopReason":"tool_calls"}}
{"type":"tool_execution_start","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"}}
{"type":"tool_execution_update","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[]}}
{"type":"tool_execution_update","toolCallId":"call_4w3gr4ma","toolName":"bash","args":{"command":"echo hello"},"partialResult":{"content":[{"type":"text","text":"hello\n"}],"details":{}}}
{"type":"tool_execution_end","toolCallId":"call_4w3gr4ma","toolName":"bash","result":{"content":[{"type":"text","text":"hello\n"}]},"isError":false}
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}}
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_4w3gr4ma","name":"bash","arguments":{"command":"echo hello"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":36426,"output":12,"cacheRead":0,"cacheWrite":0,"reasoning":0,"totalTokens":36438,"cost":{"input":0.0054639,"output":0.000006,"cacheRead":0,"cacheWrite":0,"total":0.0054699}},"stopReason":"toolUse","timestamp":1790382237724,"responseId":"chatcmpl-176","rawStopReason":"tool_calls"},"toolResults":[{"role":"toolResult","toolCallId":"call_4w3gr4ma","toolName":"bash","content":[{"type":"text","text":"hello\n"}],"isError":false,"timestamp":1790382240554}]}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"},"partialArgs":"{\"command\":\"cat /nonexistent-file\"}","streamIndex":0}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382240561,"responseId":"chatcmpl-207"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5007,"output":15,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36382,"cost":{"input":0.00075105,"output":0.000007499999999999999,"cacheRead":0,"cacheWrite":0,"total":0.00075855}},"stopReason":"toolUse","timestamp":1790382240561,"responseId":"chatcmpl-207","rawStopReason":"tool_calls"}}
{"type":"tool_execution_start","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"}}
{"type":"tool_execution_update","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[]}}
{"type":"tool_execution_update","toolCallId":"call_cta082t7","toolName":"bash","args":{"command":"cat /nonexistent-file"},"partialResult":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n"}],"details":{}}}
{"type":"tool_execution_end","toolCallId":"call_cta082t7","toolName":"bash","result":{"content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{}},"isError":true}
{"type":"message_start","message":{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}}
{"type":"message_end","message":{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"toolCall","id":"call_cta082t7","name":"bash","arguments":{"command":"cat /nonexistent-file"}}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5007,"output":15,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36382,"cost":{"input":0.00075105,"output":0.000007499999999999999,"cacheRead":0,"cacheWrite":0,"total":0.00075855}},"stopReason":"toolUse","timestamp":1790382240561,"responseId":"chatcmpl-207","rawStopReason":"tool_calls"},"toolResults":[{"role":"toolResult","toolCallId":"call_cta082t7","toolName":"bash","content":[{"type":"text","text":"cat: /nonexistent-file: No such file or directory\n\n\nCommand exited with code 1"}],"details":{},"isError":true,"timestamp":1790382242598}]}
{"type":"turn_start"}
{"type":"message_start","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both","thinkingSignature":"reasoning"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"totalTokens":0,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"stopReason":"pending","timestamp":1790382242606,"responseId":"chatcmpl-491"}}
{"type":"message_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both commands run. Reply \"done\".","thinkingSignature":"reasoning"},{"type":"text","text":"done"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5045,"output":11,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36416,"cost":{"input":0.0007567499999999999,"output":0.0000055,"cacheRead":0,"cacheWrite":0,"total":0.0007622499999999999}},"stopReason":"stop","timestamp":1790382242606,"responseId":"chatcmpl-491","rawStopReason":"stop"}}
{"type":"turn_end","message":{"role":"assistant","content":[{"type":"thinking","thinking":"Both commands run. Reply \"done\".","thinkingSignature":"reasoning"},{"type":"text","text":"done"}],"api":"openai-completions","provider":"ollama-cloud","model":"glm-5.3-flash","usage":{"input":5045,"output":11,"cacheRead":31360,"cacheWrite":0,"reasoning":0,"totalTokens":36416,"cost":{"input":0.0007567499999999999,"output":0.0000055,"cacheRead":0,"cacheWrite":0,"total":0.0007622499999999999}},"stopReason":"stop","timestamp":1790382242606,"responseId":"chatcmpl-491","rawStopReason":"stop"},"toolResults":[]}
{"type":"agent_end","messages":[],"willRetry":false}
{"type":"agent_settled"}
+6 -2
View File
@@ -33,6 +33,7 @@ import (
// worktreerpc; local git operations run on the bind-mounted worktree.
type remoteTrees interface {
Push(ctx context.Context) error
workflow.BaselineLedger
}
type hybridTrees struct {
@@ -185,7 +186,7 @@ func applyToolLimits(agent agentrun.Runner, policy config.ToolPolicy, allow []st
func stageRunners(req taskrun.Request, mcpSet *taskmcp.Set, newRunner runnerFactory, llm *runtime.Runtime, log *slog.Logger) (agentrun.Runner, error) {
if req.Harness != nil {
// The built-in loop has no route to a model from a Kit container.
return agentexec.HarnessStages{Runner: agentexec.NewHarnessRunner(nil), Spec: *req.Harness}, nil
return agentexec.HarnessStages{Runner: agentexec.NewHarnessRunner(), Spec: *req.Harness}, nil
}
var agent agentrun.Runner
if mcpSet != nil && mcpSet.Registry != nil {
@@ -246,7 +247,7 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
bus = events.NewBus()
sub := bus.Subscribe(64)
defer sub.Close()
go agentexec.ForwardTaskEvents(sub, dependencies.events, req.Task.ID, log)
go agentexec.ForwardTaskEvents(ctx, sub, dependencies.events, req.Task.ID, log)
}
tc := &workflow.TaskContext{
@@ -263,6 +264,9 @@ func runTask(ctx context.Context, req taskrun.Request, dependencies taskDependen
Log: log,
Guardrails: dependencies.guardrails,
}
if dependencies.trees != nil {
tc.Baseline = dependencies.trees
}
tc.Instructions = req.Instructions
configureTaskContext(tc, workDir)
-16
View File
@@ -3,25 +3,18 @@ package agentworker
import (
"context"
"errors"
"log/slog"
"net/http"
"strconv"
"time"
"github.com/samcharles93/archie-core/internal/agentexec"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/presence"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/infrastructure/agentboot"
"github.com/samcharles93/archie-core/internal/infrastructure/agentgit"
agentnats "github.com/samcharles93/archie-core/internal/infrastructure/agenttransport/nats"
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
"github.com/samcharles93/archie-core/internal/infrastructure/readiness"
"github.com/samcharles93/archie-core/internal/infrastructure/workflowsteps"
"github.com/samcharles93/archie-core/internal/installtype"
"github.com/samcharles93/archie-core/internal/logging"
"github.com/samcharles93/archie-core/internal/storage"
"github.com/samcharles93/archie-core/internal/taskrun"
@@ -67,8 +60,6 @@ type workerTransport interface {
Close()
LogPublisher() agentexec.LogPublisher
SubscribeTasks(context.Context, int64, agentnats.TaskHandler, *slog.Logger) (agentnats.Subscription, error)
PutPresence(context.Context, storecontract.Presence) error
BrokerReady() bool
}
type workerDependencies struct {
@@ -174,13 +165,6 @@ func run(ctx context.Context, settings Settings, log *slog.Logger, dependencies
}
}()
registry := health.NewRegistry(readiness.NewContractProbe("nats", 0, func(context.Context) error {
if !transport.BrokerReady() {
return errors.New("broker disconnected")
}
return nil
}))
go presence.Run(ctx, presence.Agent, presence.Build{InstanceID: strconv.FormatInt(taskID, 10), Version: Version(), InstallType: installtype.Type()}, transport, registry, log)
log.InfoContext(ctx, "archie-agent ready", "nats", settings.NATSURL)
dependencies.wait(ctx, log)
return nil
+2 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
"github.com/samcharles93/archie-core/internal/infrastructure/publicnet"
"github.com/samcharles93/archie-core/internal/releaseupdate"
)
@@ -301,7 +302,7 @@ func (b *boot) recheckAlerts(ctx context.Context) {
// as skipped; one that fails is retried by the store on its schedule.
func (b *boot) deliverAlerts(store alert.Deliverer) func(context.Context) {
client := &http.Client{Timeout: 15 * time.Second}
public := alertwebhook.PublicClient()
public := publicnet.Client(10*time.Second, 15*time.Second)
// The system org's webhook may sit on the instance's own network; another
// org's reaches the public internet only.
clientFor := func(owner org.OrgID) *http.Client {
+22 -40
View File
@@ -11,7 +11,6 @@ import (
"errors"
"fmt"
"log/slog"
"net/http"
"net/url"
"os"
"os/signal"
@@ -43,13 +42,13 @@ import (
"github.com/samcharles93/archie-core/internal/domain/workintake"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/forge"
forgewebhook "github.com/samcharles93/archie-core/internal/forge/webhook"
"github.com/samcharles93/archie-core/internal/gateway"
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
"github.com/samcharles93/archie-core/internal/infrastructure/eventbus/nats"
"github.com/samcharles93/archie-core/internal/infrastructure/extension"
"github.com/samcharles93/archie-core/internal/infrastructure/issuerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/kitrun"
"github.com/samcharles93/archie-core/internal/infrastructure/logrpc"
"github.com/samcharles93/archie-core/internal/infrastructure/messagingrpc"
@@ -587,9 +586,30 @@ func (b *boot) registerNATSRPC() error {
return err
}
b.addCleanup(unsubscribeTaskActions)
unsubscribeIssues, err := (&issuerpc.Server{Forge: b.issueForge, Allowed: b.managedRepository, Log: log}).Register(coreConn)
if err != nil {
log.Error("issue RPC register failed", "err", err)
return err
}
b.addCleanup(unsubscribeIssues)
return nil
}
// issueForge is the instance forge, or nil while none is configured.
func (b *boot) issueForge() forge.IssueForge {
if b.forgeClient == nil {
return nil
}
return b.forgeClient
}
// managedRepository refuses a repository the organisation has not added.
func (b *boot) managedRepository(ctx context.Context, owner, repo string) error {
_, err := b.repositoryBinding(ctx, owner, repo)
return err
}
func (b *boot) buildDaemon() {
log := b.log
b.d = &daemon.Daemon{
@@ -658,7 +678,6 @@ func (b *boot) buildDaemon() {
b.d.Denials = denials
}
b.d.PlaybookLedger = playbookLedger(b.stateStore, b.log)
b.setupForgeWebhook()
}
func playbookLedger(source any, log *slog.Logger) storecontract.PlaybookDispatcher {
@@ -669,43 +688,6 @@ func playbookLedger(source any, log *slog.Logger) storecontract.PlaybookDispatch
return nil
}
func (b *boot) setupForgeWebhook() {
cfg, log := b.cfg, b.log
if cfg.Forge.Intake != config.ForgeIntakeWebhook && cfg.Forge.Intake != config.ForgeIntakeBoth {
return
}
parser, ok := b.forgeClient.(forge.WebhookParser)
if !ok {
log.Error("forge webhook disabled: the forge cannot parse webhooks", "forge_type", cfg.Forge.Type)
return
}
secretValue, err := b.secrets.Resolve(cfg.Forge.WebhookSecret)
if err != nil || secretValue == "" {
log.Error("forge webhook disabled: secret unavailable",
"engine", cfg.Forge.WebhookSecret.Engine, "key", cfg.Forge.WebhookSecret.Key, "err", err)
return
}
receiver := forgewebhook.New(secretValue, parser, cfg.Dispatch.Trigger, cfg.Label, cfg.BotUser, b.d.PublishTask, b.d.PublishReaction, b.withdrawIssue, log)
host, port := parseListenAddr(cfg.Forge.WebhookAddr, "0.0.0.0", 8645)
addr := fmt.Sprintf("%s:%d", host, port)
srv := &http.Server{Addr: addr, Handler: receiver, ReadHeaderTimeout: 5 * time.Second}
b.startGateways = append(b.startGateways, func() {
go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Error("forge webhook server stopped", "err", err)
}
}()
log.Info("forge webhook listening", "addr", addr)
})
b.addCleanup(func() {
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_ = srv.Shutdown(shutdownCtx)
})
}
func (b *boot) publishConfig(ctx context.Context, cfg config.Config) {
b.cfgHolder.Set(cfg)
// The daemon owns the published configuration view.
+1 -20
View File
@@ -12,11 +12,9 @@ import (
"flag"
"fmt"
"log/slog"
"net"
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
@@ -253,23 +251,6 @@ func persistEvents(ctx context.Context, sink *events.Sub, st storecontract.TaskS
}
}
// parseListenAddr splits "host:port" into components, using defaults
// when the input is empty or missing a part.
func parseListenAddr(addr, defaultHost string, defaultPort int) (string, int) {
if addr == "" {
return defaultHost, defaultPort
}
host, portStr, err := net.SplitHostPort(addr)
if err != nil {
return defaultHost, defaultPort
}
port, err := strconv.Atoi(portStr)
if err != nil || port < 0 {
return host, defaultPort
}
return host, port
}
// subscribeSystemLogs subscribes to every task's system log subject at once.
// archie-agent's own log lines ship here (agentexec.SubjectForSystem) rather
// than staying on its stderr, and this is where they land: one wildcard
@@ -362,7 +343,7 @@ func registerTaskRPCServers(nc *natsio.Conn, resolve func(context.Context, *work
resolved, err := resolve(ctx, t, config.OperationPR)
return resolved.Forge, err
}}
trees := &worktreerpc.Server{Runs: runs, Log: log, Resolve: func(ctx context.Context, t *workflow.Task) (*worktree.Manager, error) {
trees := &worktreerpc.Server{Runs: runs, Log: log, Baselines: worktreerpc.NewBaselineClaims(), Resolve: func(ctx context.Context, t *workflow.Task) (*worktree.Manager, error) {
resolved, err := resolve(ctx, t, config.OperationPush)
return resolved.Trees, err
}}
+5 -2
View File
@@ -19,8 +19,11 @@ const releaseUsage = `usage: archied release <command>
keygen -seed FILE write a new signing key's seed to FILE and print its public key
publish sign a release and push it to a release source's next channel
promote -version V point stable at a published release by hand
canary start point the canary at next and install a release on it
canary check judge the release on next and promote it or roll the canary back`
canary status show the canary's channel, installed release, window and verdict (read-only)
canary start point the canary at next and install a release on it, queued behind one being judged
canary check judge the release the canary runs: promote it, pick up a newer next, or roll back
canary promote promote the release the canary runs now, if its signals pass
canary unpin return the canary to the next channel from any pin`
// RunRelease is the publisher's side of a release source: it makes the key
// a source signs with and pushes signed releases to it.
+588 -92
View File
@@ -1,6 +1,7 @@
package archied
import (
"bytes"
"context"
"errors"
"flag"
@@ -8,6 +9,7 @@ import (
"io"
"os"
"os/exec"
"strings"
"time"
"oras.land/oras-go/v2/errdef"
@@ -25,136 +27,630 @@ const canaryInstallWait = 20 * time.Minute
const migrationsDir = "internal/infrastructure/postgres/migrations"
func runReleaseCanary(args []string, out, stderr io.Writer) int {
if len(args) == 0 || (args[0] != "start" && args[0] != "check") {
if len(args) == 0 {
fmt.Fprintln(stderr, releaseUsage)
return 2
}
flags := flag.NewFlagSet("release canary "+args[0], flag.ContinueOnError)
switch args[0] {
case "status":
return runCanaryStatus(args[1:], out, stderr)
case "start":
return runCanaryStart(args[1:], out, stderr)
case "check":
return runCanaryCheck(args[1:], out, stderr)
case "promote":
return runCanaryPromote(args[1:], out, stderr)
case "unpin":
return runCanaryUnpin(args[1:], out, stderr)
default:
fmt.Fprintln(stderr, releaseUsage)
return 2
}
}
// addCanaryFlags registers the flags every canary subcommand takes.
func addCanaryFlags(flags *flag.FlagSet) (dashboardURL, tokenEnv *string) {
dashboardURL = flags.String("dashboard", "", "canary dashboard URL")
tokenEnv = flags.String("token-env", "ARCHIE_CANARY_TOKEN", "environment variable holding a dashboard API token for the canary")
return dashboardURL, tokenEnv
}
// addSourceFlags registers the flags naming the release source.
func addSourceFlags(flags *flag.FlagSet) (reference, key *string) {
reference = flags.String("source", "", "OCI repository releases are published to; blank is the official releases")
key = flags.String("key", "", "base64 ed25519 public key the source signs with")
return reference, key
}
func canaryDashboard(url, tokenEnv string) (releaseupdate.CanaryDashboard, error) {
if url == "" {
return releaseupdate.CanaryDashboard{}, errors.New("-dashboard is required")
}
return releaseupdate.CanaryDashboard{URL: url, Token: os.Getenv(tokenEnv)}, nil
}
func canarySource(reference, key string) (distribution.Source, error) {
return distribution.Parse(reference, key, distribution.DefaultReleases())
}
// fetchChannel fetches a channel tag; found is false when the channel has no
// release yet.
func fetchChannel(ctx context.Context, source distribution.Source, tag string) (release releaseupdate.Release, found bool, err error) {
release, err = releaseupdate.Fetch(ctx, source, tag)
if errors.Is(err, errdef.ErrNotFound) {
return releaseupdate.Release{}, false, nil
}
return release, err == nil, err
}
// publishedChannels are the releases the source currently publishes.
type publishedChannels struct {
next, stable releaseupdate.Release
hasNext, hasStable bool
}
func fetchChannels(ctx context.Context, source distribution.Source) (publishedChannels, error) {
var channels publishedChannels
var err error
if channels.next, channels.hasNext, err = fetchChannel(ctx, source, "next"); err != nil {
return channels, err
}
if channels.stable, channels.hasStable, err = fetchChannel(ctx, source, "stable"); err != nil {
return channels, err
}
return channels, nil
}
// canaryRun is the release the canary actually runs: its version, when it was
// installed and its fetched release statement.
type canaryRun struct {
version string
installedAt time.Time
release releaseupdate.Release
found bool
}
// readCanaryRun reads what the canary runs. A host that doesn't record install
// times (it updated before they were tracked) degrades to the release
// statement's issue time.
func readCanaryRun(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source) (canaryRun, error) {
var run canaryRun
version, installedAt, _, err := dashboard.Installed(ctx)
if err != nil {
return run, err
}
run.version, run.installedAt = version, installedAt
release, found, err := fetchChannel(ctx, source, releaseupdate.Tag("exact-pin", version))
if err != nil {
return run, err
}
run.release, run.found = release, found
if run.installedAt.IsZero() && found {
run.installedAt = release.Statement.IssuedAt
}
return run, nil
}
// newerIssued reports whether release a was issued after b. IssuedAt, not
// semver order: Promote refuses a release issued before the one stable names,
// so the judge must agree with that replay rule.
func newerIssued(a, b releaseupdate.Release) bool {
return a.Statement.IssuedAt.After(b.Statement.IssuedAt)
}
func displayVersion(version string) string {
if version == "" {
return "unknown"
}
return version
}
func displayRelease(release releaseupdate.Release, found bool) string {
if !found {
return "none"
}
return release.Statement.Version
}
func printVerdict(out io.Writer, version string, verdict releaseupdate.CanaryVerdict) {
fmt.Fprintf(out, "%s: %s\n", displayVersion(version), verdict.Decision)
for _, reason := range verdict.Reasons {
fmt.Fprintf(out, " %s\n", reason)
}
}
func runCanaryStatus(args []string, out, stderr io.Writer) int {
flags := flag.NewFlagSet("release canary status", flag.ContinueOnError)
flags.SetOutput(stderr)
dashboardURL := flags.String("dashboard", "", "canary dashboard URL")
tokenEnv := flags.String("token-env", "ARCHIE_CANARY_TOKEN", "environment variable holding a dashboard API token for the canary")
version := flags.String("version", "", "release to install (start)")
reference := flags.String("source", "", "OCI repository releases are published to; blank is the official releases (check)")
key := flags.String("key", "", "base64 ed25519 public key the source signs with (check)")
latest := flags.String("latest", "", "comma-separated image repositories whose v<version> tag becomes latest on promotion (check)")
checkout := flags.String("checkout", ".", "repository checkout with release tags, to see whether a release migrated the database (check)")
if err := flags.Parse(args[1:]); err != nil {
dashboardURL, tokenEnv := addCanaryFlags(flags)
reference, key := addSourceFlags(flags)
window := flags.Duration("window", releaseupdate.CanaryWindow, "window a release is judged over, counted from its install")
if err := flags.Parse(args); err != nil {
return 2
}
dashboard := releaseupdate.CanaryDashboard{URL: *dashboardURL, Token: os.Getenv(*tokenEnv)}
if *dashboardURL == "" {
fmt.Fprintln(stderr, "release canary: -dashboard is required")
return 2
}
ctx := context.Background()
if args[0] == "start" {
if *version == "" {
fmt.Fprintln(stderr, "release canary start: -version is required")
return 2
}
if err := startCanary(ctx, dashboard, *version); err != nil {
fmt.Fprintln(stderr, err)
return 1
}
fmt.Fprintf(out, "canary follows next and runs %s\n", *version)
return 0
}
source, err := distribution.Parse(*reference, *key, distribution.DefaultReleases())
dashboard, err := canaryDashboard(*dashboardURL, *tokenEnv)
if err != nil {
fmt.Fprintln(stderr, "release canary check:", err)
fmt.Fprintln(stderr, "release canary status:", err)
return 2
}
rolledBack, err := checkCanary(ctx, dashboard, source, splitList(*latest), *checkout, out)
source, err := canarySource(*reference, *key)
if err != nil {
fmt.Fprintln(stderr, err)
return 1
fmt.Fprintln(stderr, "release canary status:", err)
return 2
}
if rolledBack {
if err := printCanaryStatus(context.Background(), dashboard, source, *window, out); err != nil {
fmt.Fprintln(stderr, "release canary status:", err)
return 1
}
return 0
}
func startCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, version string) error {
if err := dashboard.Follow(ctx, "next", ""); err != nil {
return fmt.Errorf("point the canary at next: %w", err)
}
return dashboard.Install(ctx, version, canaryInstallWait)
}
// checkCanary judges the release on the next channel once and acts on the
// result. It reports rolledBack so that the caller can fail the run.
func checkCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, latest []string, checkout string, out io.Writer) (rolledBack bool, err error) {
next, err := releaseupdate.Fetch(ctx, source, "next")
if err != nil {
return false, err
}
stable, err := releaseupdate.Fetch(ctx, source, "stable")
hasStable := err == nil
if err != nil && !errors.Is(err, errdef.ErrNotFound) {
return false, err
}
release := next.Statement
if release.Prerelease || (hasStable && !release.IssuedAt.After(stable.Statement.IssuedAt)) {
fmt.Fprintf(out, "nothing to judge: next is %s and isn't a newer release than stable\n", release.Version)
return false, nil
}
// printCanaryStatus reports the canary's channel, installed release, the
// published channels, window progress and the verdict the current signals
// would give, without acting on anything.
func printCanaryStatus(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, window time.Duration, out io.Writer) error {
channel, pin, err := dashboard.Channel(ctx)
if err != nil {
return false, err
return err
}
if channel != "next" {
fmt.Fprintf(out, "nothing to judge: the canary is held on %s %s\n", channel, pin)
return false, nil
channels, err := fetchChannels(ctx, source)
if err != nil {
return err
}
run, err := readCanaryRun(ctx, dashboard, source)
if err != nil {
return err
}
printCanaryState(out, channel, pin, run, channels, window)
return printCanaryVerdict(ctx, dashboard, run, window, out)
}
func printCanaryState(out io.Writer, channel, pin string, run canaryRun, channels publishedChannels, window time.Duration) {
fmt.Fprintf(out, "channel: %s\n", channelDisplay(channel, pin))
fmt.Fprintf(out, "installed: %s", displayVersion(run.version))
if run.installedAt.IsZero() {
fmt.Fprintln(out, " (installed_at not reported)")
} else {
fmt.Fprintf(out, " since %s\n", run.installedAt.Format(time.RFC3339))
}
fmt.Fprintf(out, "stable: %s\n", displayRelease(channels.stable, channels.hasStable))
fmt.Fprintf(out, "next: %s\n", displayRelease(channels.next, channels.hasNext))
if run.installedAt.IsZero() {
fmt.Fprintln(out, "window: unknown, no install time to count from")
} else {
elapsed := time.Since(run.installedAt)
fmt.Fprintf(out, "window: %s of %s elapsed since the install\n", elapsed.Round(time.Minute), window)
}
}
func printCanaryVerdict(ctx context.Context, dashboard releaseupdate.CanaryDashboard, run canaryRun, window time.Duration, out io.Writer) error {
if run.installedAt.IsZero() {
fmt.Fprintln(out, "verdict: unknown, no install time to judge from")
return nil
}
now := time.Now().UTC()
signals, err := dashboard.Signals(ctx, release.IssuedAt, now)
signals, err := dashboard.Signals(ctx, run.installedAt, now, window)
if err != nil {
return false, fmt.Errorf("read canary signals: %w", err)
return fmt.Errorf("read canary signals: %w", err)
}
verdict := releaseupdate.JudgeCanary(release.Version, now.Sub(release.IssuedAt), signals)
fmt.Fprintf(out, "%s: %s\n", release.Version, verdict.Decision)
printSignals(out, signals)
verdict := releaseupdate.JudgeCanary(run.version, run.installedAt, now, window, signals)
fmt.Fprintf(out, "verdict on %s: %s (read-only)\n", displayVersion(run.version), verdict.Decision)
for _, reason := range verdict.Reasons {
fmt.Fprintf(out, " %s\n", reason)
}
switch verdict.Decision {
case releaseupdate.CanaryPromote:
if _, err := releaseupdate.Promote(ctx, source.Reference, source.Key, release.Version, latest); err != nil {
return false, fmt.Errorf("promote %s: %w", release.Version, err)
return nil
}
func printSignals(out io.Writer, s releaseupdate.CanarySignals) {
fmt.Fprintf(out, "signals: runs %q, ready=%t, new action alerts=%d\n", s.Installed, s.Ready, len(s.NewActionAlerts))
fmt.Fprintf(out, " tasks finished %d, parked or died %d (baseline %d, %d)\n",
s.Canary.Finished, s.Canary.Bad, s.Baseline.Finished, s.Baseline.Bad)
fmt.Fprintf(out, " error lines %d, log covers %s (baseline %d, covers %s)\n",
s.Canary.Errors, s.Canary.Covered.Round(time.Minute), s.Baseline.Errors, s.Baseline.Covered.Round(time.Minute))
}
func channelDisplay(channel, pin string) string {
if pin != "" {
return channel + " (pinned to " + pin + ")"
}
return channel
}
func runCanaryStart(args []string, out, stderr io.Writer) int {
flags := flag.NewFlagSet("release canary start", flag.ContinueOnError)
flags.SetOutput(stderr)
dashboardURL, tokenEnv := addCanaryFlags(flags)
reference, key := addSourceFlags(flags)
version := flags.String("version", "", "release to install on the canary")
force := flags.Bool("force", false, "install even when the canary is still judging a newer release")
if err := flags.Parse(args); err != nil {
return 2
}
dashboard, err := canaryDashboard(*dashboardURL, *tokenEnv)
if err != nil {
fmt.Fprintln(stderr, "release canary start:", err)
return 2
}
if *version == "" {
fmt.Fprintln(stderr, "release canary start: -version is required")
return 2
}
source, err := canarySource(*reference, *key)
if err != nil {
fmt.Fprintln(stderr, "release canary start:", err)
return 2
}
if err := startCanary(context.Background(), dashboard, source, *version, *force, out); err != nil {
fmt.Fprintln(stderr, "release canary start:", err)
return 1
}
return 0
}
// startCanary points the canary at next — clearing any rollback pin — and
// installs version on it. A release published while the canary still judges a
// newer one queues behind it, so the running window isn't restarted under a
// different release.
func startCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, version string, force bool, out io.Writer) error {
// The channel is read before following next: a canary already on next is
// judging the release it runs, and a new release queues behind that one.
channel, _, err := dashboard.Channel(ctx)
if err != nil {
return err
}
if err := dashboard.Follow(ctx, "next", ""); err != nil {
return fmt.Errorf("point the canary at next: %w", err)
}
if !force {
queued, err := queuedBehind(ctx, dashboard, source, channel, version, out)
if err != nil {
return err
}
fmt.Fprintf(out, "stable is %s\n", release.Version)
if queued {
return nil
}
}
if err := dashboard.Install(ctx, version, canaryInstallWait); err != nil {
return err
}
fmt.Fprintf(out, "the canary follows next and runs %s\n", version)
return nil
}
// queuedBehind reports whether version must wait: the canary already follows
// next and is still judging the release it runs (a judgeable one), which is a
// different release from version.
func queuedBehind(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, channel, version string, out io.Writer) (bool, error) {
if channel != "next" {
return false, nil
case releaseupdate.CanaryRollBack:
return true, rollBackCanary(ctx, dashboard, release.Version, stable.Statement.Version, hasStable, checkout, out)
}
run, err := readCanaryRun(ctx, dashboard, source)
if err != nil {
return false, err
}
if run.version == version {
return false, nil
}
channels, err := fetchChannels(ctx, source)
if err != nil {
return false, err
}
if judgeable(run, channels) {
fmt.Fprintf(out, "%s is queued behind %s, which the canary is still judging\n", version, run.version)
return true, nil
}
return false, nil
}
// rollBackCanary pins the canary to the stable release and reinstalls it.
// Going back past a migration needs the pre-update database snapshot, which
// loses every write since, so a release that migrated is held instead.
func rollBackCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, failed, stable string, hasStable bool, checkout string, out io.Writer) error {
if !hasStable || migrated(ctx, checkout, stable, failed) {
if err := dashboard.Follow(ctx, "exact-pin", failed); err != nil {
return fmt.Errorf("hold the canary on %s: %w", failed, err)
func runCanaryCheck(args []string, out, stderr io.Writer) int {
flags := flag.NewFlagSet("release canary check", flag.ContinueOnError)
flags.SetOutput(stderr)
dashboardURL, tokenEnv := addCanaryFlags(flags)
reference, key := addSourceFlags(flags)
latest := flags.String("latest", "", "comma-separated image repositories whose v<version> tag becomes latest on promotion")
checkout := flags.String("checkout", ".", "repository checkout with release tags, to see whether a release migrated the database")
window := flags.Duration("window", releaseupdate.CanaryWindow, "window the installed release is judged over, counted from its install")
if err := flags.Parse(args); err != nil {
return 2
}
dashboard, err := canaryDashboard(*dashboardURL, *tokenEnv)
if err != nil {
fmt.Fprintln(stderr, "release canary check:", err)
return 2
}
source, err := canarySource(*reference, *key)
if err != nil {
fmt.Fprintln(stderr, "release canary check:", err)
return 2
}
code, err := checkCanary(context.Background(), dashboard, source, splitList(*latest), *checkout, *window, out)
if err != nil {
fmt.Fprintln(stderr, "release canary check:", err)
return 1
}
return code
}
// checkCanary judges the release the canary actually runs — not the moving
// next tag — and acts on the verdict. The exit code is 1 when the run should
// show red: a rollback happened, or the canary is held on a pin that can no
// longer be installed.
func checkCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, latest []string, checkout string, window time.Duration, out io.Writer) (int, error) {
channels, err := fetchChannels(ctx, source)
if err != nil {
return 1, err
}
channel, pin, err := dashboard.Channel(ctx)
if err != nil {
return 1, err
}
if channel != "next" {
return heldCanary(ctx, source, channel, pin, out)
}
run, err := readCanaryRun(ctx, dashboard, source)
if err != nil {
return 1, err
}
if !judgeable(run, channels) {
fmt.Fprintf(out, "nothing to judge: the canary runs %s\n", displayVersion(run.version))
return pickupNext(ctx, dashboard, channels, run.version, out)
}
return judgeInstalled(ctx, dashboard, source, run, channels, latest, checkout, window, out)
}
// judgeable reports whether the installed release is one the canary judges: a
// published, non-prerelease release issued after stable's.
func judgeable(run canaryRun, channels publishedChannels) bool {
if !run.found || run.release.Statement.Prerelease {
return false
}
return !channels.hasStable || newerIssued(run.release, channels.stable)
}
func judgeInstalled(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, run canaryRun, channels publishedChannels, latest []string, checkout string, window time.Duration, out io.Writer) (int, error) {
now := time.Now().UTC()
signals, err := dashboard.Signals(ctx, run.installedAt, now, window)
if err != nil {
return 1, fmt.Errorf("read canary signals: %w", err)
}
verdict := releaseupdate.JudgeCanary(run.version, run.installedAt, now, window, signals)
printVerdict(out, run.version, verdict)
switch verdict.Decision {
case releaseupdate.CanaryPromote:
return 0, promoteJudged(ctx, dashboard, source, run, channels, latest, out)
case releaseupdate.CanaryRollBack:
return 1, rollBackCanary(ctx, dashboard, source, run, channels, checkout, out)
default:
return 0, nil
}
}
// promoteJudged moves stable to the judged release, then picks up a newer next
// queued behind it.
func promoteJudged(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, run canaryRun, channels publishedChannels, latest []string, out io.Writer) error {
if _, err := releaseupdate.Promote(ctx, source.Reference, source.Key, run.version, latest); err != nil {
return fmt.Errorf("promote %s: %w", run.version, err)
}
fmt.Fprintf(out, "stable is %s\n", run.version)
fresh := channels
fresh.stable, fresh.hasStable = run.release, true
_, err := pickupNext(ctx, dashboard, fresh, run.version, out)
return err
}
// pickupNext installs the next release when it is newer than stable and the
// canary doesn't already run it.
func pickupNext(ctx context.Context, dashboard releaseupdate.CanaryDashboard, channels publishedChannels, installed string, out io.Writer) (int, error) {
if !channels.hasNext || channels.next.Statement.Version == installed {
return 0, nil
}
if channels.hasStable && !newerIssued(channels.next, channels.stable) {
return 0, nil
}
if err := dashboard.Install(ctx, channels.next.Statement.Version, canaryInstallWait); err != nil {
return 1, err
}
fmt.Fprintf(out, "the canary picks up %s from next\n", channels.next.Statement.Version)
return 0, nil
}
// heldCanary reports a canary that isn't following next. Its pin must still be
// installable: a stranded pin fails the run instead of looking green.
func heldCanary(ctx context.Context, source distribution.Source, channel, pin string, out io.Writer) (int, error) {
if pin != "" {
err := checkPin(ctx, source, pin)
if errors.Is(err, errStrandedPin) {
fmt.Fprintf(out, "ERROR: the canary is held on %s %s, which is stranded: %v; unpin it or republish the release\n", channel, pin, err)
return 1, nil
}
fmt.Fprintf(out, "%s changed the database schema or there's no stable release to return to: the canary is held on %s and stable is unchanged; fix forward\n", failed, failed)
return nil
if err != nil {
return 1, err
}
fmt.Fprintf(out, "held on %s %s, nothing to judge\n", channel, pin)
return 0, nil
}
if err := dashboard.Follow(ctx, "exact-pin", stable); err != nil {
return fmt.Errorf("pin the canary to %s: %w", stable, err)
fmt.Fprintf(out, "held on %s, nothing to judge\n", channel)
return 0, nil
}
// errStrandedPin marks a held pin that can no longer be installed.
var errStrandedPin = errors.New("pin is stranded")
// checkPin fails when a held pin can no longer be installed: the release is
// gone from the source, or its artifacts are.
func checkPin(ctx context.Context, source distribution.Source, pin string) error {
release, found, err := fetchChannel(ctx, source, releaseupdate.Tag("exact-pin", pin))
if err != nil {
return err
}
if err := dashboard.Install(ctx, stable, canaryInstallWait); err != nil {
return fmt.Errorf("return the canary to %s: %w", stable, err)
if !found {
return fmt.Errorf("%w: no release %s in the source", errStrandedPin, releaseupdate.Tag("exact-pin", pin))
}
if err := releaseupdate.Installable(ctx, source, release); err != nil {
return fmt.Errorf("%w: %w", errStrandedPin, err)
}
fmt.Fprintf(out, "the canary is back on %s and stable is unchanged\n", stable)
return nil
}
// rollBackCanary returns the canary to stable after a failed verdict. stable
// is checked installable before the canary is pinned to it: a pin whose
// artifacts are gone would strand the canary, so the run fails loudly and the
// canary stays on next. A release that changed the migrations is held on the
// failed version instead, because going back past a migration needs the
// pre-update database snapshot.
func rollBackCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, run canaryRun, channels publishedChannels, checkout string, out io.Writer) error {
failed := run.version
if !channels.hasStable {
return holdCanary(ctx, dashboard, failed, "there's no stable release to return to", out)
}
stable := channels.stable
if err := releaseupdate.Installable(ctx, source, stable); err != nil {
return fmt.Errorf("stable %s is not installable, the canary stays on next: %w", stable.Statement.Version, err)
}
changed, err := migrated(ctx, checkout, stable.Statement.Version, failed)
if err != nil {
return holdCanary(ctx, dashboard, failed, err.Error(), out)
}
if changed {
return holdCanary(ctx, dashboard, failed, failed+" changed the database schema", out)
}
if err := dashboard.Follow(ctx, "exact-pin", stable.Statement.Version); err != nil {
return fmt.Errorf("pin the canary to %s: %w", stable.Statement.Version, err)
}
if err := dashboard.Install(ctx, stable.Statement.Version, canaryInstallWait); err != nil {
return fmt.Errorf("return the canary to %s: %w", stable.Statement.Version, err)
}
fmt.Fprintf(out, "the canary is back on %s and stable is unchanged\n", stable.Statement.Version)
return nil
}
func holdCanary(ctx context.Context, dashboard releaseupdate.CanaryDashboard, version, why string, out io.Writer) error {
if err := dashboard.Follow(ctx, "exact-pin", version); err != nil {
return fmt.Errorf("hold the canary on %s: %w", version, err)
}
fmt.Fprintf(out, "%s: the canary is held on %s and stable is unchanged; fix forward\n", why, version)
return nil
}
// runGitDiff runs git diff --quiet between two release tags and reports its
// exit code and stderr. It is a variable so tests can drive the three
// outcomes without a repository.
var runGitDiff = func(ctx context.Context, checkout, from, to string) (int, string, error) {
cmd := exec.CommandContext(ctx, "git", "-C", checkout, "diff", "--quiet", "v"+from, "v"+to, "--", migrationsDir)
var buf bytes.Buffer
cmd.Stderr = &buf
err := cmd.Run()
if err == nil {
return 0, "", nil
}
if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
return exitErr.ExitCode(), buf.String(), err
}
return -1, buf.String(), err
}
// migrated reports whether the migrations differ between two release tags.
// If it can't tell, it says they differ, so the canary is held rather than
// rolled back.
func migrated(ctx context.Context, checkout, from, to string) bool {
err := exec.CommandContext(ctx, "git", "-C", checkout, "diff", "--quiet", "v"+from, "v"+to, "--", migrationsDir).Run()
return err != nil
// It returns true, nil when they differ, false, nil when they are identical,
// and true, err when git could not answer, with the reason in err. Every
// non-identical outcome holds the canary rather than rolls it back.
func migrated(ctx context.Context, checkout, from, to string) (bool, error) {
code, stderr, runErr := runGitDiff(ctx, checkout, from, to)
switch code {
case 0:
return false, nil
case 1:
return true, nil
}
reason := strings.TrimSpace(stderr)
if reason == "" && runErr != nil {
reason = runErr.Error()
}
return true, fmt.Errorf("could not tell whether %s changed the database schema: %s", to, reason)
}
func runCanaryPromote(args []string, out, stderr io.Writer) int {
flags := flag.NewFlagSet("release canary promote", flag.ContinueOnError)
flags.SetOutput(stderr)
dashboardURL, tokenEnv := addCanaryFlags(flags)
reference, key := addSourceFlags(flags)
latest := flags.String("latest", "", "comma-separated image repositories whose v<version> tag becomes latest on promotion")
version := flags.String("version", "", "release expected on the canary; must match what it runs")
window := flags.Duration("window", releaseupdate.CanaryWindow, "window the signals are read over, counted from the install")
if err := flags.Parse(args); err != nil {
return 2
}
dashboard, err := canaryDashboard(*dashboardURL, *tokenEnv)
if err != nil {
fmt.Fprintln(stderr, "release canary promote:", err)
return 2
}
source, err := canarySource(*reference, *key)
if err != nil {
fmt.Fprintln(stderr, "release canary promote:", err)
return 2
}
code, err := promoteCanaryNow(context.Background(), dashboard, source, *version, splitList(*latest), *window, out)
if err != nil {
fmt.Fprintln(stderr, "release canary promote:", err)
return 1
}
return code
}
// promoteCanaryNow promotes the release the canary runs right now, without
// waiting out the window: the signals must show no hard failure and no
// relative breach. It refuses, with exit 1, when anything fails.
func promoteCanaryNow(ctx context.Context, dashboard releaseupdate.CanaryDashboard, source distribution.Source, expectVersion string, latest []string, window time.Duration, out io.Writer) (int, error) {
run, err := readCanaryRun(ctx, dashboard, source)
if err != nil {
return 1, err
}
channel, pin, err := dashboard.Channel(ctx)
if err != nil {
return 1, err
}
fmt.Fprintf(out, "channel: %s\n", channelDisplay(channel, pin))
if expectVersion != "" && expectVersion != run.version {
return 1, fmt.Errorf("the canary runs %s, not %s", displayVersion(run.version), expectVersion)
}
if !run.found {
return 1, fmt.Errorf("no release %s in the source to promote", displayVersion(run.version))
}
now := time.Now().UTC()
signals, err := dashboard.Signals(ctx, run.installedAt, now, window)
if err != nil {
return 1, fmt.Errorf("read canary signals: %w", err)
}
verdict := releaseupdate.JudgeCanaryNow(run.version, now, window, signals)
printVerdict(out, run.version, verdict)
if verdict.Decision == releaseupdate.CanaryRollBack {
fmt.Fprintln(out, "refusing to promote: the canary's signals fail")
return 1, nil
}
if _, err := releaseupdate.Promote(ctx, source.Reference, source.Key, run.version, latest); err != nil {
return 1, fmt.Errorf("promote %s: %w", run.version, err)
}
fmt.Fprintf(out, "stable is %s\n", run.version)
return 0, nil
}
func runCanaryUnpin(args []string, out, stderr io.Writer) int {
flags := flag.NewFlagSet("release canary unpin", flag.ContinueOnError)
flags.SetOutput(stderr)
dashboardURL, tokenEnv := addCanaryFlags(flags)
if err := flags.Parse(args); err != nil {
return 2
}
dashboard, err := canaryDashboard(*dashboardURL, *tokenEnv)
if err != nil {
fmt.Fprintln(stderr, "release canary unpin:", err)
return 2
}
if err := dashboard.Follow(context.Background(), "next", ""); err != nil {
fmt.Fprintln(stderr, "release canary unpin:", err)
return 1
}
fmt.Fprintln(out, "the canary follows next again, with no pin")
return 0
}
@@ -0,0 +1,57 @@
package archied
import (
"context"
"strings"
"testing"
)
func TestMigrated(t *testing.T) {
tests := []struct {
name string
code int
stderr string
wantChanged bool
wantErr bool
wantSubstr string
}{
{
name: "identical migrations",
code: 0,
wantChanged: false,
},
{
name: "migrations differ",
code: 1,
wantChanged: true,
},
{
name: "git cannot answer",
code: 128,
stderr: "fatal: bad revision 'v1.0.0'\n",
wantChanged: true,
wantErr: true,
wantSubstr: "fatal: bad revision 'v1.0.0'",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
old := runGitDiff
runGitDiff = func(context.Context, string, string, string) (int, string, error) {
return tt.code, tt.stderr, nil
}
t.Cleanup(func() { runGitDiff = old })
changed, err := migrated(context.Background(), ".", "1.0.0", "1.1.0")
if changed != tt.wantChanged {
t.Fatalf("changed = %v, want %v", changed, tt.wantChanged)
}
if (err != nil) != tt.wantErr {
t.Fatalf("err = %v, want err %v", err, tt.wantErr)
}
if tt.wantErr && !strings.Contains(err.Error(), tt.wantSubstr) {
t.Fatalf("err = %q, want substring %q", err, tt.wantSubstr)
}
})
}
}
+62 -3
View File
@@ -3,15 +3,19 @@ package archied
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"github.com/go-git/go-git/v6"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/daemon"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/forge"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
"github.com/samcharles93/archie-core/internal/worktree"
)
@@ -98,16 +102,34 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
if !strings.Contains(host, "://") {
host = "https://" + host
}
out.Forge = b.connectionForge(ctx, connection, principal.Org, token)
cfg := b.cfgHolder.Get()
username := connection.Account
gitToken := token
var minted forge.GitCredential
if issuer, ok := out.Forge.(forge.GitCredentialIssuer); ok {
minted, err = issuer.GitCredential(ctx, repository.Owner, repository.Name)
switch {
case errors.Is(err, errors.ErrUnsupported):
case err != nil:
b.log.WarnContext(ctx, "git credential unavailable", "connection", connection.ID, "error", err)
return failure("credential_unavailable", fmt.Sprintf("%s could not issue a credential for %s/%s. Check the app is installed on it.", connection.Name, repository.Owner, repository.Name))
default:
username, gitToken = minted.Username, minted.Token
}
}
if username == "" && connection.Type == "gitea" {
username, err = connectionAccount(ctx, connection.Type, host, token)
if err != nil {
return failure("account_unverified", "The forge account could not be verified. Check the credential and its permissions.")
}
}
cfg := b.cfgHolder.Get()
out.Trees = &worktree.Manager{WorkDir: worktree.OrgWorkDir(cfg.WorkDir, string(principal.Org)), Token: token, AuthUser: username, BaseURL: host, BotUser: cfg.BotUser, BotEmail: cfg.BotEmail, Log: b.log}
out.Forge = b.connectionForge(ctx, connection, principal.Org, token)
botUser, botEmail := commitIdentity(cfg, connection, minted, username)
signer, code, message := b.connectionSigner(connection)
if code != "" {
return failure(code, message)
}
out.Trees = &worktree.Manager{WorkDir: worktree.OrgWorkDir(cfg.WorkDir, string(principal.Org)), Token: gitToken, AuthUser: username, BaseURL: host, BotUser: botUser, BotEmail: botEmail, Signer: signer, Log: b.log}
if operation == config.OperationPR {
if _, disabled := out.Forge.(*forge.NoopForge); disabled {
return failure("forge_unavailable", "Enable the forge extension for this connection.")
@@ -115,3 +137,40 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
}
return out, nil
}
// commitIdentity is the author of commits made through a connection: its
// configured commit identity, else the identity the forge minted with the
// credential, else the root bot fields, else its account.
func commitIdentity(cfg config.Config, connection config.ForgeConnection, minted forge.GitCredential, account string) (string, string) {
if connection.CommitName != "" {
return connection.CommitName, configuration.DefaultBotEmail(connection.Type, connection.CommitName, connection.CommitEmail)
}
if minted.CommitName != "" {
return minted.CommitName, minted.CommitEmail
}
if cfg.BotUser != "" {
return cfg.BotUser, cfg.BotEmail
}
user := account
if user == "" {
user = "archie"
}
return user, configuration.DefaultBotEmail(connection.Type, user, connection.CommitEmail)
}
// connectionSigner resolves the connection's SSH signing key. It returns nil
// when none is configured, or a failure code and message.
func (b *boot) connectionSigner(connection config.ForgeConnection) (git.Signer, string, string) {
if connection.SigningKey.Key == "" {
return nil, "", ""
}
key, err := b.secrets.Resolve(connection.SigningKey)
if err != nil || key == "" {
return nil, "signing_key_unavailable", fmt.Sprintf("The signing key for %s is unavailable. Check its secret reference.", connection.Name)
}
signer, err := worktree.NewSSHSigner([]byte(key))
if err != nil {
return nil, "signing_key_invalid", fmt.Sprintf("The signing key for %s is not an OpenSSH private key.", connection.Name)
}
return signer, "", ""
}
+2 -2
View File
@@ -7,7 +7,7 @@
// because archie-messaging, a separate process that cannot import this
// package, is the next process that must be able to announce itself.
// What stays here is what is the daemon's own: which
// marker counts as progress (daemon.LastPollAt) and how long the loop may go
// marker counts as progress (daemon.StalestLoop) and how long a loop may go
// without beginning a poll pass.
//
// Nothing here is fatal -- a process with no NOTIFY_SOCKET (a plain terminal,
@@ -53,7 +53,7 @@ func (b *boot) startWatchdog(ctx context.Context) {
sampler := sdnotify.Watchdog{
Interval: interval,
Cadence: b.loopCadence,
Progress: b.d.LastPollAt,
Progress: b.d.StalestLoop,
Beat: func() { n.Send(sdnotify.WatchdogState) },
Log: b.log,
}
+7 -9
View File
@@ -29,15 +29,6 @@ func (b *boot) taskActions() taskactions.Service {
)
}
// withdrawIssue declines the task an issue queued, if it has one.
func (b *boot) withdrawIssue(ctx context.Context, owner, repo string, number int, reason string) error {
task, err := b.stateStore.TaskByIssue(ctx, owner, repo, number)
if err != nil || task == nil {
return err
}
return b.taskActions().Withdraw(ctx, task.ID, reason)
}
func (b *boot) cancelTask(id int64) bool {
if b.d == nil {
return false
@@ -77,6 +68,13 @@ func (b *boot) removeTaskWorktree(task *taskactions.Task) error {
if b.d == nil {
return nil
}
// A run that handed off shares the work item's worktree with its
// successor; archiving the old run must not remove it.
if current, err := b.stateStore.TaskByIssue(context.Background(), task.Owner, task.Repo, task.IssueNumber); err != nil {
return err
} else if current != nil && current.ID != task.ID {
return nil
}
return b.d.RemoveWorktree(&workflow.Task{Owner: task.Owner, Repo: task.Repo, Identity: task.Identity, IssueNumber: task.IssueNumber, Org: task.Org})
}
+1
View File
@@ -35,6 +35,7 @@ func (b taskBroker) TaskSubjects(ctx context.Context, taskID int64, credential s
agentexec.SubjectForEvents(taskID),
spanrelay.Subject(taskID),
worktreerpc.SubjectFor(task.Identity, worktreerpc.SubjectPush),
worktreerpc.SubjectFor(task.Identity, worktreerpc.SubjectBaseline),
messagerpc.SubjectFor(task.Identity),
}, forgerpc.Subjects(task.Identity)...)
return nats.TaskSubjects{Publish: publish, Subscribe: []string{agentnats.SubjectForTask(taskID)}}, nil
+1 -4
View File
@@ -295,10 +295,7 @@ func hasConfigSection(document map[string]any, section string) bool {
}
func updateStateDir() string {
if dir := os.Getenv("ARCHIE_UPDATE_STATE_DIR"); dir != "" {
return dir
}
return configuration.DefaultUpdateStateDir()
return configuration.UpdateStateDir()
}
// resumeUpdate hands an interrupted transaction to the frozen watchdog and
+46 -5
View File
@@ -12,7 +12,9 @@ import (
"github.com/samcharles93/archie-core/internal/agentexec/modelloop"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/usage"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
@@ -22,12 +24,12 @@ import (
"github.com/samcharles93/archie-core/internal/infrastructure/toolbuilder"
)
func (b *server) setupCurators(ctx context.Context) bool {
func (b *server) setupCurators(ctx context.Context) error {
log := b.log.With("component", "curator")
model, err := b.chatModels.ModelFor(ctx)
if err != nil {
log.WarnContext(ctx, "curators disabled: chat model unavailable; configure a chat model and restart the gateway", "err", err)
return false
return fmt.Errorf("curators disabled until the gateway restarts with a chat model: %w", err)
}
skillsRoot := b.cfg.SkillsDir
if skillsRoot == "" {
@@ -40,7 +42,7 @@ func (b *server) setupCurators(ctx context.Context) bool {
MemoryEngines: b.memEngines,
Skills: skillcurator.NewStore(skillsRoot),
Conversations: sessioncurator.NewAdapter(b.chatSessionStore, b.cfg.BotUser),
LLM: curatorLLMRunner{llm: b.chatLLM, outcomes: b.providerOutcomes, usage: b.usage},
LLM: actingPrincipalRunner{inner: curatorLLMRunner{llm: b.chatLLM, outcomes: b.providerOutcomes, usage: b.usage}, resolve: b.actingPrincipal},
Model: model,
})
@@ -58,7 +60,7 @@ func (b *server) setupCurators(ctx context.Context) bool {
b.addCleanup(shutdownCuratorRuntime(rt, log))
reg := b.curatorRegistry
b.addCleanup(shutdownCuratorRegistry(reg, log))
return true
return nil
}
//nolint:contextcheck // shutdown runs after the parent context is cancelled
@@ -95,6 +97,42 @@ func (s curatorEventSink) Emit(kind, detail string, data map[string]any) {
s.b.Publish(context.Background(), events.Event{Kind: kind, Detail: detail, Data: data})
}
// actingPrincipal resolves the identity the instance acts as for automated
// work (the default chat identity, falling back to the bot user), so curator
// passes authorize guarded tools exactly as that identity would.
func (b *server) actingPrincipal(ctx context.Context) (access.Principal, error) {
name := b.defaultChatIdentity
if name == "" {
name = b.cfg.BotUser
}
if name == "" {
return access.Principal{}, fmt.Errorf("no acting identity configured (chat identity or bot user)")
}
idn, err := b.stateStore.ResolveLegacyName(ctx, name)
if err != nil {
return access.Principal{}, fmt.Errorf("resolve acting identity %q: %w", name, err)
}
return b.stateStore.PrincipalFor(ctx, idn.ID)
}
// actingPrincipalRunner attaches the acting principal to every curator model
// call. Tool handlers run in the call's context, so guarded tools see the
// curator as the instance's identity, never as an anonymous or caller-supplied
// one; a pass that cannot resolve the principal fails closed.
type actingPrincipalRunner struct {
inner curator.LLMRunner
resolve func(context.Context) (access.Principal, error)
}
func (r actingPrincipalRunner) Chat(ctx context.Context, req curator.ChatRequest) (curator.ChatResult, error) {
p, err := r.resolve(ctx)
if err != nil {
return curator.ChatResult{}, fmt.Errorf("curator pass: %w", err)
}
ctx = org.WithScope(org.WithOrg(access.WithPrincipal(ctx, p), p.Org), p.Org)
return r.inner.Chat(ctx, req)
}
// curatorLLMRunner adapts the shared ai-sdk runtime to the curator
// family's narrow LLMRunner contract: one model reference, plain
// messages, and the declared tool set -- no streaming. Tools are built
@@ -180,7 +218,10 @@ func (b *server) watchCurators(ctx context.Context, version int64) error {
func (b *server) startCurators(ctx context.Context) error {
// Curators wake on this process's turns and read its conversations.
if !b.setupCurators(ctx) {
// A disabled runtime is reported, so the dashboard shows why curators do
// not apply rather than a process that never reported.
if err := b.setupCurators(ctx); err != nil {
b.applyStatus.Report(ctx, controlplanestore.CuratorsKind, 0, err)
return nil
}
if err := b.curatorRuntime.Start(ctx); err != nil {
+9
View File
@@ -18,6 +18,7 @@ import (
"github.com/samcharles93/archie-core/internal/gateway"
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/issuerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/infrastructure/taskmcp"
"github.com/samcharles93/archie-core/internal/plugin"
@@ -109,6 +110,14 @@ func (b *server) registerWorkflowTools(ctx context.Context) {
authz := infraaccess.StartLive(ctx, b.stateStore.ListPolicies, b.stateStore.PoliciesVersion, b.log)
workflows := controlplanerpc.NewWorkflows(b.stateStore.ControlPlane())
entries := append(gateway.WorkflowTools(workflows, authz), gateway.IntegrationTools(integrationSource{Workflows: workflows, store: b.stateStore}, authz)...)
// Run-inspection tools back long-running curators (self-intake first);
// the State Store client satisfies the source directly.
entries = append(entries, gateway.RunTools(b.stateStore, authz)...)
// Issue tools reach the forge through the daemon, which alone holds its
// credentials; without the broker connection they are not registered.
if b.taskActionsConn != nil {
entries = append(entries, gateway.IssueTools(issuerpc.Client{Conn: b.taskActionsConn, Timeout: 30 * time.Second}, authz)...)
}
for _, entry := range entries {
if err := b.toolReg.Register(entry); err != nil {
b.log.WarnContext(ctx, "workflow tool registration failed", "tool", entry.Name, "err", err)
+4 -2
View File
@@ -64,6 +64,9 @@ type channelInstance struct {
chat messaging.ChatContract
// plan is what an org's channel was built from.
plan *orgChannelPlan
// needs names the required settings an enabled channel lacks; such a
// channel is reported stopped with it rather than started to fail.
needs string
mu sync.Mutex
channel channels.Channel
@@ -168,8 +171,7 @@ func compose(ctx context.Context, d deps) (*Service, error) {
}
// composeChannels builds the configured channel set: the installed channel
// extensions that extension settings (or a [chat.telegram] file
// configuration) enable. Each instance carries the factory a restart uses to
// extensions that extension settings enable. Each instance carries the factory a restart uses to
// build a replacement from a new resolved configuration.
func composeChannels(ctx context.Context, d deps) ([]*channelInstance, error) {
instances := make([]*channelInstance, 0, len(d.ExtensionChannels))
+1 -8
View File
@@ -17,11 +17,7 @@ import (
type ResolvedConfig struct {
Options Options
// Identity is this process's certificate; nil is plaintext, loopback only.
Identity *rpctls.Identity
// Telegram is the [chat.telegram] configuration. It does not compose a
// channel in this process: it enables the telegram channel extension, with
// the same keys, through openExtensionChannels.
Telegram config.TelegramConfig
Identity *rpctls.Identity
ShowToolCalls bool
Logging config.Config
}
@@ -31,7 +27,6 @@ type projection struct {
stateStore ServiceTarget
messaging config.ServiceConnection
tls config.TLS
telegram config.TelegramConfig
showToolCalls bool
logging config.Config
}
@@ -64,7 +59,6 @@ func Resolve(o Options, log *slog.Logger) (ResolvedConfig, error) {
return ResolvedConfig{
Options: o,
Identity: id,
Telegram: proj.telegram,
ShowToolCalls: proj.showToolCalls,
Logging: proj.logging,
}, nil
@@ -87,7 +81,6 @@ func project(cfg config.Config) projection {
stateStore: ServiceTarget{Target: cfg.Services.Get(config.ServiceNameState).Target},
messaging: cfg.Services.Get(config.ServiceNameMessaging),
tls: cfg.TLS,
telegram: cfg.Chat.Telegram,
showToolCalls: cfg.Chat.ShowToolCalls,
logging: config.Config{StateDir: cfg.StateDir, Log: cfg.Log, Telemetry: cfg.Telemetry},
}
@@ -12,7 +12,6 @@ import (
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/secret"
)
// servingChannel reports itself running once it starts, which is what an
@@ -214,34 +213,3 @@ func TestReconcileAppliesShowToolCalls(t *testing.T) {
t.Fatalf("reconcile stale: %v", err)
}
}
// TestTelegramFileSetting pins the mapping that keeps an existing
// [chat.telegram] file configuration working through the channel extension:
// the token stays a secret reference for the host to resolve, the allowlist
// joins the same way the extension parses it, and no token means no setting.
func TestTelegramFileSetting(t *testing.T) {
setting, ok := telegramFileSetting(config.TelegramConfig{
Token: secret.SecretRef{Engine: "env", Key: "ARCHIE_TELEGRAM_TOKEN"},
AllowedUserIDs: []int64{111, 222},
}, true)
if !ok {
t.Fatal("setting not produced for a configured token")
}
if setting.Name != "telegram" || !setting.Enabled {
t.Fatalf("setting = %+v, want name telegram enabled", setting)
}
want := map[string]string{
"token_ref": "env:ARCHIE_TELEGRAM_TOKEN",
"allowed_user_ids": "111,222",
"show_tool_calls": "true",
}
for key, value := range want {
if setting.Settings[key] != value {
t.Errorf("settings[%q] = %q, want %q", key, setting.Settings[key], value)
}
}
if _, ok := telegramFileSetting(config.TelegramConfig{}, false); ok {
t.Fatal("empty token produced a setting, want none")
}
}
@@ -2,6 +2,7 @@ package archiemessaging
import (
"context"
"errors"
"fmt"
"log/slog"
"maps"
@@ -12,11 +13,9 @@ import (
"github.com/samcharles93/archie-core/internal/app/servicekit"
"github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storepkg"
"github.com/samcharles93/archie-core/internal/infrastructure/channelext"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/extension"
"github.com/samcharles93/archie-core/internal/secret"
)
@@ -25,7 +24,7 @@ import (
const refSuffix = "_ref"
// telegramChannel is the package name the Telegram channel extension installs
// under, and the config keys [chat.telegram] that enable it.
// under.
const telegramChannel = "telegram"
// channelFactory builds extension channel instances on demand, so channels
@@ -71,12 +70,11 @@ func (f *channelFactory) channelPackage(ctx context.Context, name string) (store
}
// openExtensionChannels builds a channel for each installed channel package
// whose authority is accepted and that extension-settings enables. A
// [chat.telegram] file configuration enables the telegram package the same
// way, with the same config keys, so an existing config keeps working without
// a server login. Changing the set takes a restart, as every channel binding
// does. Running extensions stop with ctx.
func openExtensionChannels(ctx context.Context, source extension.Source, secrets *secret.Registry, log *slog.Logger, telegram config.TelegramConfig, showToolCalls bool) ([]*channelInstance, *channelFactory) {
// whose authority is accepted and that extension-settings enables. The
// host passes the telegram channel the show_tool_calls session default.
// Changing the set takes a restart, as every channel binding does. Running
// extensions stop with ctx.
func openExtensionChannels(ctx context.Context, source extension.Source, secrets *secret.Registry, log *slog.Logger, showToolCalls bool) ([]*channelInstance, *channelFactory) {
cache, err := configuration.DefaultCacheDir()
if err != nil {
log.WarnContext(ctx, "channel extensions unavailable: no cache directory", "err", err)
@@ -92,15 +90,6 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
log.WarnContext(ctx, "channel extensions unavailable: installed packages", "err", err)
return nil, nil
}
if file, ok := telegramFileSetting(telegram, showToolCalls); ok {
stored := settings[telegramChannel]
if stored.Settings == nil {
stored.Settings = map[string]string{}
}
maps.Copy(stored.Settings, file.Settings)
stored.Name, stored.Enabled = telegramChannel, true
settings[telegramChannel] = stored
}
host := extension.NewHost(log)
factory := &channelFactory{host: host, source: source, cacheDir: filepath.Join(cache, "extensions", "channels"), secrets: secrets}
var instances []*channelInstance
@@ -114,7 +103,26 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
if index < 0 {
continue
}
ch, err := factory.build(ctx, pkg, pkg.Descriptor.Contributes.Extensions[index].Path, pkg.Name, setting.Settings)
if missing := pkg.Descriptor.MissingSettings(setting.Settings); len(missing) > 0 {
needs := "Missing " + strings.Join(missing, ", ")
log.WarnContext(ctx, "channel extension not started: required settings missing", "channel", pkg.Name, "missing", missing)
instances = append(instances, &channelInstance{
name: pkg.Name,
needs: needs,
rebuild: func(ResolvedConfig) (channels.Channel, error) { return nil, errors.New(needs) },
})
built[pkg.Name] = true
continue
}
values := setting.Settings
if pkg.Name == telegramChannel {
values = maps.Clone(values)
if values == nil {
values = map[string]string{}
}
values["show_tool_calls"] = strconv.FormatBool(showToolCalls)
}
ch, err := factory.build(ctx, pkg, pkg.Descriptor.Contributes.Extensions[index].Path, pkg.Name, values)
if err != nil {
log.WarnContext(ctx, "channel extension not started", "channel", pkg.Name, "err", err)
continue
@@ -126,8 +134,18 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
rebuild: func(ResolvedConfig) (channels.Channel, error) { return ch, nil },
})
}
if _, ok := telegramFileSetting(telegram, showToolCalls); ok && !built[telegramChannel] {
log.WarnContext(ctx, "chat.telegram is configured but the telegram channel package is not installed; install the telegram channel extension to enable the bot")
if setting := settings[telegramChannel]; setting.Enabled && !slices.ContainsFunc(installed, func(pkg storepkg.Installed) bool { return pkg.Name == telegramChannel }) {
// Report it as a channel, so the dashboard shows why the enabled
// bot is not running instead of showing nothing.
const needs = "The Telegram channel extension is not installed"
log.WarnContext(ctx, "telegram is enabled but its channel extension is not installed")
instances = append(instances, &channelInstance{
name: telegramChannel,
needs: needs,
rebuild: func(ResolvedConfig) (channels.Channel, error) {
return nil, errors.New("telegram channel extension is not installed")
},
})
}
go func() {
<-ctx.Done()
@@ -136,29 +154,6 @@ func openExtensionChannels(ctx context.Context, source extension.Source, secrets
return instances, factory
}
// telegramFileSetting renders [chat.telegram] as the extension setting that
// enables the telegram channel package. The token stays a reference: the host
// resolves token_ref through the secret registry, so this process never holds
// the bot credential.
func telegramFileSetting(cfg config.TelegramConfig, showToolCalls bool) (controlplanerpc.ExtensionSetting, bool) {
if cfg.Token == (secret.SecretRef{}) {
return controlplanerpc.ExtensionSetting{}, false
}
ids := make([]string, 0, len(cfg.AllowedUserIDs))
for _, id := range cfg.AllowedUserIDs {
ids = append(ids, strconv.FormatInt(id, 10))
}
return controlplanerpc.ExtensionSetting{
Name: telegramChannel,
Enabled: true,
Settings: map[string]string{
"token_ref": cfg.Token.Engine + ":" + cfg.Token.Key,
"allowed_user_ids": strings.Join(ids, ","),
"show_tool_calls": strconv.FormatBool(showToolCalls),
},
}, true
}
func buildExtensionChannel(ctx context.Context, host *extension.Host, source extension.Source, cacheDir string, pkg storepkg.Installed, file, name string, settings map[string]string, secrets *secret.Registry) (channels.Channel, error) {
binary, sum, err := extension.Materialize(ctx, source.Packages, cacheDir, pkg, file)
if err != nil {
+2 -2
View File
@@ -118,7 +118,7 @@ func (s *Service) planOrgChannel(ctx context.Context, entry controlplanerpc.OrgC
switch {
case settings.Agent == "":
return orgChannelPlan{}, errors.New("no agent named")
case len(settings.Telegram.AllowedUserIDs) == 0:
case len(settings.AllowedUserIDs) == 0:
return orgChannelPlan{}, errors.New("no allowed telegram users")
case binding == (secret.SecretRef{}):
return orgChannelPlan{}, fmt.Errorf("no credential binding %q", telegramCredential)
@@ -130,7 +130,7 @@ func (s *Service) planOrgChannel(ctx context.Context, entry controlplanerpc.OrgC
if string(principal.Org) != entry.Org || !principal.Kind.Agent() {
return orgChannelPlan{}, errors.New("agent is not an agent of this org")
}
return orgChannelPlan{org: entry.Org, binding: binding, allowed: settings.Telegram.AllowedUserIDs, show: settings.ShowToolCalls, agent: principal}, nil
return orgChannelPlan{org: entry.Org, binding: binding, allowed: settings.AllowedUserIDs, show: settings.ShowToolCalls, agent: principal}, nil
}
// telegramBindings maps each org to the secret its Telegram bot token is bound
+2 -4
View File
@@ -41,9 +41,7 @@ func (s *Service) reconcileOnce(ctx context.Context) error {
if err != nil {
return err
}
layered, version, err := s.settingsSource.RuntimeChatConfig(ctx, config.ChatConfig{
Telegram: base.Telegram, ShowToolCalls: base.ShowToolCalls,
})
layered, version, err := s.settingsSource.RuntimeChatConfig(ctx, config.ChatConfig{ShowToolCalls: base.ShowToolCalls})
if err != nil {
return err
}
@@ -51,7 +49,7 @@ func (s *Service) reconcileOnce(ctx context.Context) error {
return nil
}
next := base
next.Telegram, next.ShowToolCalls = layered.Telegram, layered.ShowToolCalls
next.ShowToolCalls = layered.ShowToolCalls
if next.ShowToolCalls != base.ShowToolCalls {
s.applyShowToolCalls(next.ShowToolCalls)
}
+3 -5
View File
@@ -77,17 +77,15 @@ func Run(ctx context.Context, o Options) error {
reporter := applystatus.New(applystatus.Messaging, stateStore, log)
extensions := extension.Source{Query: controlPlaneClient, Packages: stateStore}
defer superviseSecretEngines(ctx, extensions, secrets, reporter, log)()
chatSettings, channelVersion, settingsErr := controlPlaneClient.RuntimeChatConfig(ctx, config.ChatConfig{
Telegram: cfg.Telegram, ShowToolCalls: cfg.ShowToolCalls,
})
chatSettings, channelVersion, settingsErr := controlPlaneClient.RuntimeChatConfig(ctx, config.ChatConfig{ShowToolCalls: cfg.ShowToolCalls})
if settingsErr != nil {
return fmt.Errorf("load channel settings: %w", settingsErr)
}
reporter.Report(ctx, controlplanerpc.ChannelSettingsKind, channelVersion, nil)
go reporter.Run(ctx)
go presence.Run(ctx, presence.Messaging, servicekit.Build(), stateStore, health, log)
cfg.Telegram, cfg.ShowToolCalls = chatSettings.Telegram, chatSettings.ShowToolCalls
extensionChannels, extensionFactory = openExtensionChannels(ctx, extensions, secrets, log, cfg.Telegram, cfg.ShowToolCalls)
cfg.ShowToolCalls = chatSettings.ShowToolCalls
extensionChannels, extensionFactory = openExtensionChannels(ctx, extensions, secrets, log, cfg.ShowToolCalls)
channelStatusStore = stateStore
settingsSource, applyReporter, appliedVersion, orgChannels = controlPlaneClient, reporter, channelVersion, &orgChannelDeps{Source: controlPlaneClient, Principals: stateStore}
}
+1 -1
View File
@@ -26,7 +26,7 @@ func (s *Service) runChannel(ctx context.Context, c *channelInstance) {
if ch == nil {
// Disabled: there is no channel to run until an enable builds one.
c.mu.Unlock()
s.status.MarkStopped(c.name, "")
s.status.MarkStopped(c.name, c.needs)
if s.awaitChannel(ctx, c, 0) == channelShutdown {
return
}
+7 -5
View File
@@ -28,13 +28,15 @@ const (
// serviceWatch remembers since when each service has been unhealthy.
type serviceWatch struct {
since map[string]time.Time
booted time.Time
since map[string]time.Time
}
// unhealthy returns the services that have been down or degraded for longer
// than serviceGrace, and forgets those that recovered. A service gone silent
// counts from its last report, which is stored, so a restart of this store does
// not restart the grace; one that never reported counts from first sight.
// counts from its last report, but never from before this store booted: the
// whole stack usually restarts together, and every peer's last report predates
// the restart until it reports again.
func (w *serviceWatch) unhealthy(mesh []presence.Service, now time.Time) []string {
if w.since == nil {
w.since = map[string]time.Time{}
@@ -51,7 +53,7 @@ func (w *serviceWatch) unhealthy(mesh []presence.Service, now time.Time) []strin
since, ok := w.since[service.Service]
if !ok {
since = now
if service.State == presence.StateDown && !service.ReportedAt.IsZero() {
if service.State == presence.StateDown && service.ReportedAt.After(w.booted) {
since = service.ReportedAt
}
w.since[service.Service] = since
@@ -95,7 +97,7 @@ func (b *server) sweepAlerts(ctx context.Context, store alert.Store) {
ListPresence(context.Context) ([]storecontract.Presence, error)
})
reporter := alert.Reporter{Raiser: store, Log: b.log, By: "state-store"}
var watch serviceWatch
watch := serviceWatch{booted: time.Now()}
ticker := time.NewTicker(alertSweepInterval)
defer ticker.Stop()
for {
+6 -1
View File
@@ -202,6 +202,11 @@ func (b *server) seedAndValidatePolicies(ctx context.Context) error {
// not to the sequence that triggers it.
func (b *server) reportUnseededResources(skipped []controlplanestore.SeedSkip) {
for _, skip := range skipped {
if len(skip.Removed) > 0 {
b.log.Warn("removed stored entries that no longer validate; their earlier revision is in the resource history",
"kind", skip.Kind, "removed", skip.Removed)
continue
}
b.log.Error("control-plane resource not seeded; the kind stays absent and the file's value is the one in effect",
"kind", skip.Kind, "err", skip.Err)
}
@@ -385,7 +390,7 @@ func (b *server) runCredentials(ctx context.Context) (*staterpc.TaskGrants, erro
if !ok {
return nil, fmt.Errorf("state store does not support run credentials")
}
grants := &staterpc.TaskGrants{Store: store}
grants := &staterpc.TaskGrants{Store: store, Log: b.log}
if err := grants.Sweep(ctx); err != nil {
return nil, fmt.Errorf("sweep expired run credentials: %w", err)
}
-21
View File
@@ -1,21 +0,0 @@
package config
// ChatFrontEnd is one conversational front-end [chat] can enable. ID is its
// stable identifier.
type ChatFrontEnd struct {
ID string
Name string
Configured bool
}
// FrontEnds returns every chat front-end this configuration enables, in
// dashboard order. Whitespace-only values do not count as configured.
func (c ChatConfig) FrontEnds() []ChatFrontEnd {
return []ChatFrontEnd{
{
ID: "telegram",
Name: "Telegram",
Configured: c.Telegram.Token != (SecretRef{}),
},
}
}
+18 -26
View File
@@ -64,25 +64,32 @@ func ValidOperation(op string) bool { return slices.Contains(Operations(), op) }
// instance's root configuration.
type ForgeConnection struct {
// ID is the stable reference a repository binding and a permission name.
ID string `toml:"id" json:"id" yaml:"id"`
ID string `json:"id"`
// Name is the operator-facing label.
Name string `toml:"name" json:"name" yaml:"name"`
Name string `json:"name"`
// Type selects the forge implementation: the name of an enabled forge
// extension, or the compiled-in forge of that name.
Type string `toml:"type" json:"type" yaml:"type"`
Type string `json:"type"`
// Host is the forge's host, e.g. "github.com".
Host string `toml:"host" json:"host" yaml:"host"`
Host string `json:"host"`
// Account is the external account the credential authenticates as. It is
// recorded, and checked against the account a verification actually
// reached; it is never used to infer authority.
Account string `toml:"account" json:"account" yaml:"account"`
Account string `json:"account"`
// Token references the credential. The connection records the reference,
// never a token value.
Token SecretRef `toml:"token" json:"token" yaml:"token"`
Token SecretRef `json:"token"`
// CommitName and CommitEmail author commits made through the connection.
// Empty falls back to the account and the forge's default email.
CommitName string `json:"commit_name,omitempty"`
CommitEmail string `json:"commit_email,omitempty"`
// SigningKey references an OpenSSH private key that signs those commits.
// Unset leaves them unsigned.
SigningKey SecretRef `json:"signing_key,omitzero"`
// Permits names, per execution identity ID, the operations that identity
// may perform through this connection. An identity with no entry may
// perform none: the connection itself is not a grant.
Permits map[string][]string `toml:"permits" json:"permits,omitempty" yaml:"permits"`
Permits map[string][]string `json:"permits,omitempty"`
}
// Permitted reports whether the identity may perform op through this
@@ -226,30 +233,11 @@ type Provider struct {
Disabled bool `toml:"-" yaml:"-" json:"-"`
}
// Forge intake modes for Forge.Intake. Poll is the default; webhook reacts to
// forge events as they arrive instead of (or in addition to) polling.
const (
ForgeIntakePoll = "poll"
ForgeIntakeWebhook = "webhook"
ForgeIntakeBoth = "both"
)
// Forge configures the code forge integration.
type Forge struct {
Type string `toml:"type" yaml:"type"`
Host string `toml:"host" yaml:"host"`
Token SecretRef `toml:"token" yaml:"token"`
// Intake selects how forge issues become work: "poll" (default),
// "webhook", or "both". Webhook intake reacts to forge events the moment
// they arrive instead of up to poll_interval later.
Intake string `toml:"intake" yaml:"intake"`
// WebhookSecret is the shared secret used to verify GitHub webhook
// signatures (X-Hub-Signature-256). Required when Intake is "webhook" or
// "both".
WebhookSecret SecretRef `toml:"webhook_secret" yaml:"webhook_secret"`
// WebhookAddr is the host:port the webhook receiver listens on. Required
// when Intake is "webhook" or "both".
WebhookAddr string `toml:"webhook_addr" yaml:"webhook_addr"`
}
// Dispatch configures how archied discovers work and reacts on pickup.
@@ -370,6 +358,10 @@ type Config struct {
// MaxRetries caps how many times a parked task is retried before
// being permanently parked (status "dead"). Defaults to 3.
MaxRetries int `toml:"max_retries" yaml:"max_retries"`
// IntakePerPass caps how many tasks one issue poll creates, so a backlog
// found at once (the first poll after an outage) drains over several
// passes. Defaults to 20.
IntakePerPass int `toml:"intake_per_pass" yaml:"intake_per_pass"`
// StateDir is the host directory archie keeps non-database state in: the
// embedded NATS store and its endpoint file, the task-log registry, and
// the readiness disk probe's data target. Bootstrap-only.
+14
View File
@@ -740,9 +740,23 @@ func encodeRegistryAuth(credential string) (string, error) {
return base64.URLEncoding.EncodeToString(payload), nil
}
// inContainer reports whether this process runs in a container, where Docker
// and Podman each leave a marker file.
func inContainer() bool {
for _, marker := range []string{"/.dockerenv", "/run/.containerenv"} {
if _, err := os.Stat(marker); err == nil {
return true
}
}
return false
}
// selfNetwork returns the user-defined network this process's container is
// on, or "".
func selfNetwork(ctx context.Context, cli *client.Client, log *slog.Logger) string {
if !inContainer() {
return ""
}
hostname, err := os.Hostname()
if err != nil {
log.WarnContext(ctx, "container network auto-detect: os.Hostname failed, spawned containers will use the default bridge network and won't resolve sibling services by name — set containers.network explicitly", "err", err)
File diff suppressed because it is too large. Load diff
+59 -21
View File
@@ -23,6 +23,7 @@ const (
ForgeService_AssignedIssues_FullMethodName = "/forge.v1.ForgeService/AssignedIssues"
ForgeService_IssuesWithLabel_FullMethodName = "/forge.v1.ForgeService/IssuesWithLabel"
ForgeService_Comment_FullMethodName = "/forge.v1.ForgeService/Comment"
ForgeService_CreateIssue_FullMethodName = "/forge.v1.ForgeService/CreateIssue"
ForgeService_CloseIssue_FullMethodName = "/forge.v1.ForgeService/CloseIssue"
ForgeService_React_FullMethodName = "/forge.v1.ForgeService/React"
ForgeService_SetStateLabel_FullMethodName = "/forge.v1.ForgeService/SetStateLabel"
@@ -39,7 +40,7 @@ const (
ForgeService_AcceptInvitations_FullMethodName = "/forge.v1.ForgeService/AcceptInvitations"
ForgeService_VerifyPush_FullMethodName = "/forge.v1.ForgeService/VerifyPush"
ForgeService_LinkBranch_FullMethodName = "/forge.v1.ForgeService/LinkBranch"
ForgeService_ParseWebhook_FullMethodName = "/forge.v1.ForgeService/ParseWebhook"
ForgeService_GitCredential_FullMethodName = "/forge.v1.ForgeService/GitCredential"
ForgeService_GetRepoArchive_FullMethodName = "/forge.v1.ForgeService/GetRepoArchive"
)
@@ -60,6 +61,7 @@ type ForgeServiceClient interface {
AssignedIssues(ctx context.Context, in *AssignedIssuesRequest, opts ...grpc.CallOption) (*AssignedIssuesResponse, error)
IssuesWithLabel(ctx context.Context, in *IssuesWithLabelRequest, opts ...grpc.CallOption) (*IssuesWithLabelResponse, error)
Comment(ctx context.Context, in *CommentRequest, opts ...grpc.CallOption) (*CommentResponse, error)
CreateIssue(ctx context.Context, in *CreateIssueRequest, opts ...grpc.CallOption) (*CreateIssueResponse, error)
CloseIssue(ctx context.Context, in *CloseIssueRequest, opts ...grpc.CallOption) (*CloseIssueResponse, error)
React(ctx context.Context, in *ReactRequest, opts ...grpc.CallOption) (*ReactResponse, error)
SetStateLabel(ctx context.Context, in *SetStateLabelRequest, opts ...grpc.CallOption) (*SetStateLabelResponse, error)
@@ -76,10 +78,10 @@ type ForgeServiceClient interface {
AcceptInvitations(ctx context.Context, in *AcceptInvitationsRequest, opts ...grpc.CallOption) (*AcceptInvitationsResponse, error)
VerifyPush(ctx context.Context, in *VerifyPushRequest, opts ...grpc.CallOption) (*VerifyPushResponse, error)
LinkBranch(ctx context.Context, in *LinkBranchRequest, opts ...grpc.CallOption) (*LinkBranchResponse, error)
// ParseWebhook decodes one webhook delivery the host has already
// authenticated. A delivery that is not an event the host acts on returns no
// event; an undecodable body is INVALID_ARGUMENT.
ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error)
// GitCredential returns a short-lived credential for cloning and pushing one
// repository, and the identity commits through it should carry. A forge that
// authenticates git with its configured token answers UNIMPLEMENTED.
GitCredential(ctx context.Context, in *GitCredentialRequest, opts ...grpc.CallOption) (*GitCredentialResponse, error)
// GetRepoArchive streams a gzipped tar of the repository at a ref.
GetRepoArchive(ctx context.Context, in *GetRepoArchiveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetRepoArchiveResponse], error)
}
@@ -132,6 +134,16 @@ func (c *forgeServiceClient) Comment(ctx context.Context, in *CommentRequest, op
return out, nil
}
func (c *forgeServiceClient) CreateIssue(ctx context.Context, in *CreateIssueRequest, opts ...grpc.CallOption) (*CreateIssueResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateIssueResponse)
err := c.cc.Invoke(ctx, ForgeService_CreateIssue_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *forgeServiceClient) CloseIssue(ctx context.Context, in *CloseIssueRequest, opts ...grpc.CallOption) (*CloseIssueResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CloseIssueResponse)
@@ -292,10 +304,10 @@ func (c *forgeServiceClient) LinkBranch(ctx context.Context, in *LinkBranchReque
return out, nil
}
func (c *forgeServiceClient) ParseWebhook(ctx context.Context, in *ParseWebhookRequest, opts ...grpc.CallOption) (*ParseWebhookResponse, error) {
func (c *forgeServiceClient) GitCredential(ctx context.Context, in *GitCredentialRequest, opts ...grpc.CallOption) (*GitCredentialResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ParseWebhookResponse)
err := c.cc.Invoke(ctx, ForgeService_ParseWebhook_FullMethodName, in, out, cOpts...)
out := new(GitCredentialResponse)
err := c.cc.Invoke(ctx, ForgeService_GitCredential_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
@@ -338,6 +350,7 @@ type ForgeServiceServer interface {
AssignedIssues(context.Context, *AssignedIssuesRequest) (*AssignedIssuesResponse, error)
IssuesWithLabel(context.Context, *IssuesWithLabelRequest) (*IssuesWithLabelResponse, error)
Comment(context.Context, *CommentRequest) (*CommentResponse, error)
CreateIssue(context.Context, *CreateIssueRequest) (*CreateIssueResponse, error)
CloseIssue(context.Context, *CloseIssueRequest) (*CloseIssueResponse, error)
React(context.Context, *ReactRequest) (*ReactResponse, error)
SetStateLabel(context.Context, *SetStateLabelRequest) (*SetStateLabelResponse, error)
@@ -354,10 +367,10 @@ type ForgeServiceServer interface {
AcceptInvitations(context.Context, *AcceptInvitationsRequest) (*AcceptInvitationsResponse, error)
VerifyPush(context.Context, *VerifyPushRequest) (*VerifyPushResponse, error)
LinkBranch(context.Context, *LinkBranchRequest) (*LinkBranchResponse, error)
// ParseWebhook decodes one webhook delivery the host has already
// authenticated. A delivery that is not an event the host acts on returns no
// event; an undecodable body is INVALID_ARGUMENT.
ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error)
// GitCredential returns a short-lived credential for cloning and pushing one
// repository, and the identity commits through it should carry. A forge that
// authenticates git with its configured token answers UNIMPLEMENTED.
GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error)
// GetRepoArchive streams a gzipped tar of the repository at a ref.
GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error
mustEmbedUnimplementedForgeServiceServer()
@@ -382,6 +395,9 @@ func (UnimplementedForgeServiceServer) IssuesWithLabel(context.Context, *IssuesW
func (UnimplementedForgeServiceServer) Comment(context.Context, *CommentRequest) (*CommentResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Comment not implemented")
}
func (UnimplementedForgeServiceServer) CreateIssue(context.Context, *CreateIssueRequest) (*CreateIssueResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CreateIssue not implemented")
}
func (UnimplementedForgeServiceServer) CloseIssue(context.Context, *CloseIssueRequest) (*CloseIssueResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CloseIssue not implemented")
}
@@ -430,8 +446,8 @@ func (UnimplementedForgeServiceServer) VerifyPush(context.Context, *VerifyPushRe
func (UnimplementedForgeServiceServer) LinkBranch(context.Context, *LinkBranchRequest) (*LinkBranchResponse, error) {
return nil, status.Error(codes.Unimplemented, "method LinkBranch not implemented")
}
func (UnimplementedForgeServiceServer) ParseWebhook(context.Context, *ParseWebhookRequest) (*ParseWebhookResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ParseWebhook not implemented")
func (UnimplementedForgeServiceServer) GitCredential(context.Context, *GitCredentialRequest) (*GitCredentialResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GitCredential not implemented")
}
func (UnimplementedForgeServiceServer) GetRepoArchive(*GetRepoArchiveRequest, grpc.ServerStreamingServer[GetRepoArchiveResponse]) error {
return status.Error(codes.Unimplemented, "method GetRepoArchive not implemented")
@@ -529,6 +545,24 @@ func _ForgeService_Comment_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _ForgeService_CreateIssue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateIssueRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ForgeServiceServer).CreateIssue(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ForgeService_CreateIssue_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ForgeServiceServer).CreateIssue(ctx, req.(*CreateIssueRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ForgeService_CloseIssue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CloseIssueRequest)
if err := dec(in); err != nil {
@@ -817,20 +851,20 @@ func _ForgeService_LinkBranch_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _ForgeService_ParseWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ParseWebhookRequest)
func _ForgeService_GitCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GitCredentialRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ForgeServiceServer).ParseWebhook(ctx, in)
return srv.(ForgeServiceServer).GitCredential(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ForgeService_ParseWebhook_FullMethodName,
FullMethod: ForgeService_GitCredential_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ForgeServiceServer).ParseWebhook(ctx, req.(*ParseWebhookRequest))
return srv.(ForgeServiceServer).GitCredential(ctx, req.(*GitCredentialRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -869,6 +903,10 @@ var ForgeService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Comment",
Handler: _ForgeService_Comment_Handler,
},
{
MethodName: "CreateIssue",
Handler: _ForgeService_CreateIssue_Handler,
},
{
MethodName: "CloseIssue",
Handler: _ForgeService_CloseIssue_Handler,
@@ -934,8 +972,8 @@ var ForgeService_ServiceDesc = grpc.ServiceDesc{
Handler: _ForgeService_LinkBranch_Handler,
},
{
MethodName: "ParseWebhook",
Handler: _ForgeService_ParseWebhook_Handler,
MethodName: "GitCredential",
Handler: _ForgeService_GitCredential_Handler,
},
},
Streams: []grpc.StreamDesc{
File diff suppressed because it is too large. Load diff
@@ -38,6 +38,7 @@ const (
AccountService_AddPersonalToken_FullMethodName = "/state.v1.AccountService/AddPersonalToken"
AccountService_ListPersonalTokens_FullMethodName = "/state.v1.AccountService/ListPersonalTokens"
AccountService_RevokePersonalToken_FullMethodName = "/state.v1.AccountService/RevokePersonalToken"
AccountService_BindIdentityPersonalToken_FullMethodName = "/state.v1.AccountService/BindIdentityPersonalToken"
)
// AccountServiceClient is the client API for AccountService service.
@@ -65,6 +66,12 @@ type AccountServiceClient interface {
AddPersonalToken(ctx context.Context, in *AddPersonalTokenRequest, opts ...grpc.CallOption) (*AddPersonalTokenResponse, error)
ListPersonalTokens(ctx context.Context, in *ListPersonalTokensRequest, opts ...grpc.CallOption) (*ListPersonalTokensResponse, error)
RevokePersonalToken(ctx context.Context, in *RevokePersonalTokenRequest, opts ...grpc.CallOption) (*RevokePersonalTokenResponse, error)
// BindIdentityPersonalToken binds a personal token to a NAMED identity
// instead of the caller's principal, which is how a service account gets
// its bearer credential. Only non-user targets are accepted: a person's
// token comes from AddPersonalToken. The audit actor is the caller's
// principal, never a request field.
BindIdentityPersonalToken(ctx context.Context, in *BindIdentityPersonalTokenRequest, opts ...grpc.CallOption) (*BindIdentityPersonalTokenResponse, error)
}
type accountServiceClient struct {
@@ -265,6 +272,16 @@ func (c *accountServiceClient) RevokePersonalToken(ctx context.Context, in *Revo
return out, nil
}
func (c *accountServiceClient) BindIdentityPersonalToken(ctx context.Context, in *BindIdentityPersonalTokenRequest, opts ...grpc.CallOption) (*BindIdentityPersonalTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(BindIdentityPersonalTokenResponse)
err := c.cc.Invoke(ctx, AccountService_BindIdentityPersonalToken_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AccountServiceServer is the server API for AccountService service.
// All implementations must embed UnimplementedAccountServiceServer
// for forward compatibility.
@@ -290,6 +307,12 @@ type AccountServiceServer interface {
AddPersonalToken(context.Context, *AddPersonalTokenRequest) (*AddPersonalTokenResponse, error)
ListPersonalTokens(context.Context, *ListPersonalTokensRequest) (*ListPersonalTokensResponse, error)
RevokePersonalToken(context.Context, *RevokePersonalTokenRequest) (*RevokePersonalTokenResponse, error)
// BindIdentityPersonalToken binds a personal token to a NAMED identity
// instead of the caller's principal, which is how a service account gets
// its bearer credential. Only non-user targets are accepted: a person's
// token comes from AddPersonalToken. The audit actor is the caller's
// principal, never a request field.
BindIdentityPersonalToken(context.Context, *BindIdentityPersonalTokenRequest) (*BindIdentityPersonalTokenResponse, error)
mustEmbedUnimplementedAccountServiceServer()
}
@@ -357,6 +380,9 @@ func (UnimplementedAccountServiceServer) ListPersonalTokens(context.Context, *Li
func (UnimplementedAccountServiceServer) RevokePersonalToken(context.Context, *RevokePersonalTokenRequest) (*RevokePersonalTokenResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RevokePersonalToken not implemented")
}
func (UnimplementedAccountServiceServer) BindIdentityPersonalToken(context.Context, *BindIdentityPersonalTokenRequest) (*BindIdentityPersonalTokenResponse, error) {
return nil, status.Error(codes.Unimplemented, "method BindIdentityPersonalToken not implemented")
}
func (UnimplementedAccountServiceServer) mustEmbedUnimplementedAccountServiceServer() {}
func (UnimplementedAccountServiceServer) testEmbeddedByValue() {}
@@ -720,6 +746,24 @@ func _AccountService_RevokePersonalToken_Handler(srv interface{}, ctx context.Co
return interceptor(ctx, in, info, handler)
}
func _AccountService_BindIdentityPersonalToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BindIdentityPersonalTokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountServiceServer).BindIdentityPersonalToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AccountService_BindIdentityPersonalToken_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountServiceServer).BindIdentityPersonalToken(ctx, req.(*BindIdentityPersonalTokenRequest))
}
return interceptor(ctx, in, info, handler)
}
// AccountService_ServiceDesc is the grpc.ServiceDesc for AccountService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -803,6 +847,10 @@ var AccountService_ServiceDesc = grpc.ServiceDesc{
MethodName: "RevokePersonalToken",
Handler: _AccountService_RevokePersonalToken_Handler,
},
{
MethodName: "BindIdentityPersonalToken",
Handler: _AccountService_BindIdentityPersonalToken_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "state/v1/account.proto",
+46 -144
View File
@@ -901,94 +901,6 @@ func (*ResumeBindingResponse) Descriptor() ([]byte, []int) {
return file_state_v1_binding_proto_rawDescGZIP(), []int{17}
}
type ArmedBindingsForSourceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ArmedBindingsForSourceRequest) Reset() {
*x = ArmedBindingsForSourceRequest{}
mi := &file_state_v1_binding_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ArmedBindingsForSourceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ArmedBindingsForSourceRequest) ProtoMessage() {}
func (x *ArmedBindingsForSourceRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_binding_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ArmedBindingsForSourceRequest.ProtoReflect.Descriptor instead.
func (*ArmedBindingsForSourceRequest) Descriptor() ([]byte, []int) {
return file_state_v1_binding_proto_rawDescGZIP(), []int{18}
}
func (x *ArmedBindingsForSourceRequest) GetSource() string {
if x != nil {
return x.Source
}
return ""
}
type ArmedBindingsForSourceResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Bindings []*Binding `protobuf:"bytes,1,rep,name=bindings,proto3" json:"bindings,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ArmedBindingsForSourceResponse) Reset() {
*x = ArmedBindingsForSourceResponse{}
mi := &file_state_v1_binding_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ArmedBindingsForSourceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ArmedBindingsForSourceResponse) ProtoMessage() {}
func (x *ArmedBindingsForSourceResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_binding_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ArmedBindingsForSourceResponse.ProtoReflect.Descriptor instead.
func (*ArmedBindingsForSourceResponse) Descriptor() ([]byte, []int) {
return file_state_v1_binding_proto_rawDescGZIP(), []int{19}
}
func (x *ArmedBindingsForSourceResponse) GetBindings() []*Binding {
if x != nil {
return x.Bindings
}
return nil
}
var File_state_v1_binding_proto protoreflect.FileDescriptor
const file_state_v1_binding_proto_rawDesc = "" +
@@ -1045,11 +957,7 @@ const file_state_v1_binding_proto_rawDesc = "" +
"\x14PauseBindingResponse\"&\n" +
"\x14ResumeBindingRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"\x17\n" +
"\x15ResumeBindingResponse\"7\n" +
"\x1dArmedBindingsForSourceRequest\x12\x16\n" +
"\x06source\x18\x01 \x01(\tR\x06source\"O\n" +
"\x1eArmedBindingsForSourceResponse\x12-\n" +
"\bbindings\x18\x01 \x03(\v2\x11.state.v1.BindingR\bbindings2\x81\x06\n" +
"\x15ResumeBindingResponse2\x94\x05\n" +
"\x0eBindingService\x12P\n" +
"\rInsertBinding\x12\x1e.state.v1.InsertBindingRequest\x1a\x1f.state.v1.InsertBindingResponse\x12G\n" +
"\n" +
@@ -1059,8 +967,7 @@ const file_state_v1_binding_proto_rawDesc = "" +
"\rDeleteBinding\x12\x1e.state.v1.DeleteBindingRequest\x1a\x1f.state.v1.DeleteBindingResponse\x12S\n" +
"\x0eApproveBinding\x12\x1f.state.v1.ApproveBindingRequest\x1a .state.v1.ApproveBindingResponse\x12M\n" +
"\fPauseBinding\x12\x1d.state.v1.PauseBindingRequest\x1a\x1e.state.v1.PauseBindingResponse\x12P\n" +
"\rResumeBinding\x12\x1e.state.v1.ResumeBindingRequest\x1a\x1f.state.v1.ResumeBindingResponse\x12k\n" +
"\x16ArmedBindingsForSource\x12'.state.v1.ArmedBindingsForSourceRequest\x1a(.state.v1.ArmedBindingsForSourceResponseB\xa6\x01\n" +
"\rResumeBinding\x12\x1e.state.v1.ResumeBindingRequest\x1a\x1f.state.v1.ResumeBindingResponseB\xa6\x01\n" +
"\fcom.state.v1B\fBindingProtoP\x01ZGgithub.com/samcharles93/archie-core/internal/contracts/state/v1;statev1\xa2\x02\x03SXX\xaa\x02\bState.V1\xca\x02\bState\\V1\xe2\x02\x14State\\V1\\GPBMetadata\xea\x02\tState::V1b\x06proto3"
var (
@@ -1075,62 +982,57 @@ func file_state_v1_binding_proto_rawDescGZIP() []byte {
return file_state_v1_binding_proto_rawDescData
}
var file_state_v1_binding_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
var file_state_v1_binding_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_state_v1_binding_proto_goTypes = []any{
(*BindingMatcher)(nil), // 0: state.v1.BindingMatcher
(*Binding)(nil), // 1: state.v1.Binding
(*InsertBindingRequest)(nil), // 2: state.v1.InsertBindingRequest
(*InsertBindingResponse)(nil), // 3: state.v1.InsertBindingResponse
(*GetBindingRequest)(nil), // 4: state.v1.GetBindingRequest
(*GetBindingResponse)(nil), // 5: state.v1.GetBindingResponse
(*ListBindingsRequest)(nil), // 6: state.v1.ListBindingsRequest
(*ListBindingsResponse)(nil), // 7: state.v1.ListBindingsResponse
(*UpdateBindingRequest)(nil), // 8: state.v1.UpdateBindingRequest
(*UpdateBindingResponse)(nil), // 9: state.v1.UpdateBindingResponse
(*DeleteBindingRequest)(nil), // 10: state.v1.DeleteBindingRequest
(*DeleteBindingResponse)(nil), // 11: state.v1.DeleteBindingResponse
(*ApproveBindingRequest)(nil), // 12: state.v1.ApproveBindingRequest
(*ApproveBindingResponse)(nil), // 13: state.v1.ApproveBindingResponse
(*PauseBindingRequest)(nil), // 14: state.v1.PauseBindingRequest
(*PauseBindingResponse)(nil), // 15: state.v1.PauseBindingResponse
(*ResumeBindingRequest)(nil), // 16: state.v1.ResumeBindingRequest
(*ResumeBindingResponse)(nil), // 17: state.v1.ResumeBindingResponse
(*ArmedBindingsForSourceRequest)(nil), // 18: state.v1.ArmedBindingsForSourceRequest
(*ArmedBindingsForSourceResponse)(nil), // 19: state.v1.ArmedBindingsForSourceResponse
(*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp
(*BindingMatcher)(nil), // 0: state.v1.BindingMatcher
(*Binding)(nil), // 1: state.v1.Binding
(*InsertBindingRequest)(nil), // 2: state.v1.InsertBindingRequest
(*InsertBindingResponse)(nil), // 3: state.v1.InsertBindingResponse
(*GetBindingRequest)(nil), // 4: state.v1.GetBindingRequest
(*GetBindingResponse)(nil), // 5: state.v1.GetBindingResponse
(*ListBindingsRequest)(nil), // 6: state.v1.ListBindingsRequest
(*ListBindingsResponse)(nil), // 7: state.v1.ListBindingsResponse
(*UpdateBindingRequest)(nil), // 8: state.v1.UpdateBindingRequest
(*UpdateBindingResponse)(nil), // 9: state.v1.UpdateBindingResponse
(*DeleteBindingRequest)(nil), // 10: state.v1.DeleteBindingRequest
(*DeleteBindingResponse)(nil), // 11: state.v1.DeleteBindingResponse
(*ApproveBindingRequest)(nil), // 12: state.v1.ApproveBindingRequest
(*ApproveBindingResponse)(nil), // 13: state.v1.ApproveBindingResponse
(*PauseBindingRequest)(nil), // 14: state.v1.PauseBindingRequest
(*PauseBindingResponse)(nil), // 15: state.v1.PauseBindingResponse
(*ResumeBindingRequest)(nil), // 16: state.v1.ResumeBindingRequest
(*ResumeBindingResponse)(nil), // 17: state.v1.ResumeBindingResponse
(*timestamppb.Timestamp)(nil), // 18: google.protobuf.Timestamp
}
var file_state_v1_binding_proto_depIdxs = []int32{
0, // 0: state.v1.Binding.matcher:type_name -> state.v1.BindingMatcher
20, // 1: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
20, // 2: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
18, // 1: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
18, // 2: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
1, // 3: state.v1.InsertBindingRequest.binding:type_name -> state.v1.Binding
1, // 4: state.v1.GetBindingResponse.binding:type_name -> state.v1.Binding
1, // 5: state.v1.ListBindingsResponse.bindings:type_name -> state.v1.Binding
1, // 6: state.v1.UpdateBindingRequest.binding:type_name -> state.v1.Binding
1, // 7: state.v1.ArmedBindingsForSourceResponse.bindings:type_name -> state.v1.Binding
2, // 8: state.v1.BindingService.InsertBinding:input_type -> state.v1.InsertBindingRequest
4, // 9: state.v1.BindingService.GetBinding:input_type -> state.v1.GetBindingRequest
6, // 10: state.v1.BindingService.ListBindings:input_type -> state.v1.ListBindingsRequest
8, // 11: state.v1.BindingService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
10, // 12: state.v1.BindingService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
12, // 13: state.v1.BindingService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
14, // 14: state.v1.BindingService.PauseBinding:input_type -> state.v1.PauseBindingRequest
16, // 15: state.v1.BindingService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
18, // 16: state.v1.BindingService.ArmedBindingsForSource:input_type -> state.v1.ArmedBindingsForSourceRequest
3, // 17: state.v1.BindingService.InsertBinding:output_type -> state.v1.InsertBindingResponse
5, // 18: state.v1.BindingService.GetBinding:output_type -> state.v1.GetBindingResponse
7, // 19: state.v1.BindingService.ListBindings:output_type -> state.v1.ListBindingsResponse
9, // 20: state.v1.BindingService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
11, // 21: state.v1.BindingService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
13, // 22: state.v1.BindingService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
15, // 23: state.v1.BindingService.PauseBinding:output_type -> state.v1.PauseBindingResponse
17, // 24: state.v1.BindingService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
19, // 25: state.v1.BindingService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
17, // [17:26] is the sub-list for method output_type
8, // [8:17] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
2, // 7: state.v1.BindingService.InsertBinding:input_type -> state.v1.InsertBindingRequest
4, // 8: state.v1.BindingService.GetBinding:input_type -> state.v1.GetBindingRequest
6, // 9: state.v1.BindingService.ListBindings:input_type -> state.v1.ListBindingsRequest
8, // 10: state.v1.BindingService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
10, // 11: state.v1.BindingService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
12, // 12: state.v1.BindingService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
14, // 13: state.v1.BindingService.PauseBinding:input_type -> state.v1.PauseBindingRequest
16, // 14: state.v1.BindingService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
3, // 15: state.v1.BindingService.InsertBinding:output_type -> state.v1.InsertBindingResponse
5, // 16: state.v1.BindingService.GetBinding:output_type -> state.v1.GetBindingResponse
7, // 17: state.v1.BindingService.ListBindings:output_type -> state.v1.ListBindingsResponse
9, // 18: state.v1.BindingService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
11, // 19: state.v1.BindingService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
13, // 20: state.v1.BindingService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
15, // 21: state.v1.BindingService.PauseBinding:output_type -> state.v1.PauseBindingResponse
17, // 22: state.v1.BindingService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
15, // [15:23] is the sub-list for method output_type
7, // [7:15] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_state_v1_binding_proto_init() }
@@ -1144,7 +1046,7 @@ func file_state_v1_binding_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_state_v1_binding_proto_rawDesc), len(file_state_v1_binding_proto_rawDesc)),
NumEnums: 0,
NumMessages: 20,
NumMessages: 18,
NumExtensions: 0,
NumServices: 1,
},
+8 -46
View File
@@ -19,15 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
BindingService_InsertBinding_FullMethodName = "/state.v1.BindingService/InsertBinding"
BindingService_GetBinding_FullMethodName = "/state.v1.BindingService/GetBinding"
BindingService_ListBindings_FullMethodName = "/state.v1.BindingService/ListBindings"
BindingService_UpdateBinding_FullMethodName = "/state.v1.BindingService/UpdateBinding"
BindingService_DeleteBinding_FullMethodName = "/state.v1.BindingService/DeleteBinding"
BindingService_ApproveBinding_FullMethodName = "/state.v1.BindingService/ApproveBinding"
BindingService_PauseBinding_FullMethodName = "/state.v1.BindingService/PauseBinding"
BindingService_ResumeBinding_FullMethodName = "/state.v1.BindingService/ResumeBinding"
BindingService_ArmedBindingsForSource_FullMethodName = "/state.v1.BindingService/ArmedBindingsForSource"
BindingService_InsertBinding_FullMethodName = "/state.v1.BindingService/InsertBinding"
BindingService_GetBinding_FullMethodName = "/state.v1.BindingService/GetBinding"
BindingService_ListBindings_FullMethodName = "/state.v1.BindingService/ListBindings"
BindingService_UpdateBinding_FullMethodName = "/state.v1.BindingService/UpdateBinding"
BindingService_DeleteBinding_FullMethodName = "/state.v1.BindingService/DeleteBinding"
BindingService_ApproveBinding_FullMethodName = "/state.v1.BindingService/ApproveBinding"
BindingService_PauseBinding_FullMethodName = "/state.v1.BindingService/PauseBinding"
BindingService_ResumeBinding_FullMethodName = "/state.v1.BindingService/ResumeBinding"
)
// BindingServiceClient is the client API for BindingService service.
@@ -42,7 +41,6 @@ type BindingServiceClient interface {
ApproveBinding(ctx context.Context, in *ApproveBindingRequest, opts ...grpc.CallOption) (*ApproveBindingResponse, error)
PauseBinding(ctx context.Context, in *PauseBindingRequest, opts ...grpc.CallOption) (*PauseBindingResponse, error)
ResumeBinding(ctx context.Context, in *ResumeBindingRequest, opts ...grpc.CallOption) (*ResumeBindingResponse, error)
ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error)
}
type bindingServiceClient struct {
@@ -133,16 +131,6 @@ func (c *bindingServiceClient) ResumeBinding(ctx context.Context, in *ResumeBind
return out, nil
}
func (c *bindingServiceClient) ArmedBindingsForSource(ctx context.Context, in *ArmedBindingsForSourceRequest, opts ...grpc.CallOption) (*ArmedBindingsForSourceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ArmedBindingsForSourceResponse)
err := c.cc.Invoke(ctx, BindingService_ArmedBindingsForSource_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// BindingServiceServer is the server API for BindingService service.
// All implementations must embed UnimplementedBindingServiceServer
// for forward compatibility.
@@ -155,7 +143,6 @@ type BindingServiceServer interface {
ApproveBinding(context.Context, *ApproveBindingRequest) (*ApproveBindingResponse, error)
PauseBinding(context.Context, *PauseBindingRequest) (*PauseBindingResponse, error)
ResumeBinding(context.Context, *ResumeBindingRequest) (*ResumeBindingResponse, error)
ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error)
mustEmbedUnimplementedBindingServiceServer()
}
@@ -190,9 +177,6 @@ func (UnimplementedBindingServiceServer) PauseBinding(context.Context, *PauseBin
func (UnimplementedBindingServiceServer) ResumeBinding(context.Context, *ResumeBindingRequest) (*ResumeBindingResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ResumeBinding not implemented")
}
func (UnimplementedBindingServiceServer) ArmedBindingsForSource(context.Context, *ArmedBindingsForSourceRequest) (*ArmedBindingsForSourceResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ArmedBindingsForSource not implemented")
}
func (UnimplementedBindingServiceServer) mustEmbedUnimplementedBindingServiceServer() {}
func (UnimplementedBindingServiceServer) testEmbeddedByValue() {}
@@ -358,24 +342,6 @@ func _BindingService_ResumeBinding_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _BindingService_ArmedBindingsForSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ArmedBindingsForSourceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BindingServiceServer).ArmedBindingsForSource(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: BindingService_ArmedBindingsForSource_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BindingServiceServer).ArmedBindingsForSource(ctx, req.(*ArmedBindingsForSourceRequest))
}
return interceptor(ctx, in, info, handler)
}
// BindingService_ServiceDesc is the grpc.ServiceDesc for BindingService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -415,10 +381,6 @@ var BindingService_ServiceDesc = grpc.ServiceDesc{
MethodName: "ResumeBinding",
Handler: _BindingService_ResumeBinding_Handler,
},
{
MethodName: "ArmedBindingsForSource",
Handler: _BindingService_ArmedBindingsForSource_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "state/v1/binding.proto",
+228 -112
View File
@@ -2163,6 +2163,110 @@ func (x *EnqueueCallTaskRequest) GetCallKey() string {
return ""
}
type HandoffTaskRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
Workflow string `protobuf:"bytes,2,opt,name=workflow,proto3" json:"workflow,omitempty"`
Detail string `protobuf:"bytes,3,opt,name=detail,proto3" json:"detail,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HandoffTaskRequest) Reset() {
*x = HandoffTaskRequest{}
mi := &file_state_v1_task_proto_msgTypes[41]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HandoffTaskRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HandoffTaskRequest) ProtoMessage() {}
func (x *HandoffTaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[41]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HandoffTaskRequest.ProtoReflect.Descriptor instead.
func (*HandoffTaskRequest) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{41}
}
func (x *HandoffTaskRequest) GetTaskId() int64 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *HandoffTaskRequest) GetWorkflow() string {
if x != nil {
return x.Workflow
}
return ""
}
func (x *HandoffTaskRequest) GetDetail() string {
if x != nil {
return x.Detail
}
return ""
}
type HandoffTaskResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Task *Task `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HandoffTaskResponse) Reset() {
*x = HandoffTaskResponse{}
mi := &file_state_v1_task_proto_msgTypes[42]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HandoffTaskResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HandoffTaskResponse) ProtoMessage() {}
func (x *HandoffTaskResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[42]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HandoffTaskResponse.ProtoReflect.Descriptor instead.
func (*HandoffTaskResponse) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{42}
}
func (x *HandoffTaskResponse) GetTask() *Task {
if x != nil {
return x.Task
}
return nil
}
type EnqueueCallTaskResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Task *Task `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"`
@@ -2173,7 +2277,7 @@ type EnqueueCallTaskResponse struct {
func (x *EnqueueCallTaskResponse) Reset() {
*x = EnqueueCallTaskResponse{}
mi := &file_state_v1_task_proto_msgTypes[41]
mi := &file_state_v1_task_proto_msgTypes[43]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2185,7 +2289,7 @@ func (x *EnqueueCallTaskResponse) String() string {
func (*EnqueueCallTaskResponse) ProtoMessage() {}
func (x *EnqueueCallTaskResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[41]
mi := &file_state_v1_task_proto_msgTypes[43]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2198,7 +2302,7 @@ func (x *EnqueueCallTaskResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use EnqueueCallTaskResponse.ProtoReflect.Descriptor instead.
func (*EnqueueCallTaskResponse) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{41}
return file_state_v1_task_proto_rawDescGZIP(), []int{43}
}
func (x *EnqueueCallTaskResponse) GetTask() *Task {
@@ -2225,7 +2329,7 @@ type WorkflowCallStatusRequest struct {
func (x *WorkflowCallStatusRequest) Reset() {
*x = WorkflowCallStatusRequest{}
mi := &file_state_v1_task_proto_msgTypes[42]
mi := &file_state_v1_task_proto_msgTypes[44]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2237,7 +2341,7 @@ func (x *WorkflowCallStatusRequest) String() string {
func (*WorkflowCallStatusRequest) ProtoMessage() {}
func (x *WorkflowCallStatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[42]
mi := &file_state_v1_task_proto_msgTypes[44]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2250,7 +2354,7 @@ func (x *WorkflowCallStatusRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use WorkflowCallStatusRequest.ProtoReflect.Descriptor instead.
func (*WorkflowCallStatusRequest) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{42}
return file_state_v1_task_proto_rawDescGZIP(), []int{44}
}
func (x *WorkflowCallStatusRequest) GetCallerTaskId() int64 {
@@ -2283,7 +2387,7 @@ type WorkflowCallStatusResponse struct {
func (x *WorkflowCallStatusResponse) Reset() {
*x = WorkflowCallStatusResponse{}
mi := &file_state_v1_task_proto_msgTypes[43]
mi := &file_state_v1_task_proto_msgTypes[45]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2295,7 +2399,7 @@ func (x *WorkflowCallStatusResponse) String() string {
func (*WorkflowCallStatusResponse) ProtoMessage() {}
func (x *WorkflowCallStatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[43]
mi := &file_state_v1_task_proto_msgTypes[45]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2308,7 +2412,7 @@ func (x *WorkflowCallStatusResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use WorkflowCallStatusResponse.ProtoReflect.Descriptor instead.
func (*WorkflowCallStatusResponse) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{43}
return file_state_v1_task_proto_rawDescGZIP(), []int{45}
}
func (x *WorkflowCallStatusResponse) GetStatus() string {
@@ -2341,7 +2445,7 @@ type TaskModelsRequest struct {
func (x *TaskModelsRequest) Reset() {
*x = TaskModelsRequest{}
mi := &file_state_v1_task_proto_msgTypes[44]
mi := &file_state_v1_task_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2353,7 +2457,7 @@ func (x *TaskModelsRequest) String() string {
func (*TaskModelsRequest) ProtoMessage() {}
func (x *TaskModelsRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[44]
mi := &file_state_v1_task_proto_msgTypes[46]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2366,7 +2470,7 @@ func (x *TaskModelsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskModelsRequest.ProtoReflect.Descriptor instead.
func (*TaskModelsRequest) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{44}
return file_state_v1_task_proto_rawDescGZIP(), []int{46}
}
func (x *TaskModelsRequest) GetTaskId() int64 {
@@ -2385,7 +2489,7 @@ type TaskInstructionsRequest struct {
func (x *TaskInstructionsRequest) Reset() {
*x = TaskInstructionsRequest{}
mi := &file_state_v1_task_proto_msgTypes[45]
mi := &file_state_v1_task_proto_msgTypes[47]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2397,7 +2501,7 @@ func (x *TaskInstructionsRequest) String() string {
func (*TaskInstructionsRequest) ProtoMessage() {}
func (x *TaskInstructionsRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[45]
mi := &file_state_v1_task_proto_msgTypes[47]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2410,7 +2514,7 @@ func (x *TaskInstructionsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskInstructionsRequest.ProtoReflect.Descriptor instead.
func (*TaskInstructionsRequest) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{45}
return file_state_v1_task_proto_rawDescGZIP(), []int{47}
}
func (x *TaskInstructionsRequest) GetTaskId() int64 {
@@ -2430,7 +2534,7 @@ type TaskInstructionsResponse struct {
func (x *TaskInstructionsResponse) Reset() {
*x = TaskInstructionsResponse{}
mi := &file_state_v1_task_proto_msgTypes[46]
mi := &file_state_v1_task_proto_msgTypes[48]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2442,7 +2546,7 @@ func (x *TaskInstructionsResponse) String() string {
func (*TaskInstructionsResponse) ProtoMessage() {}
func (x *TaskInstructionsResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[46]
mi := &file_state_v1_task_proto_msgTypes[48]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2455,7 +2559,7 @@ func (x *TaskInstructionsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskInstructionsResponse.ProtoReflect.Descriptor instead.
func (*TaskInstructionsResponse) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{46}
return file_state_v1_task_proto_rawDescGZIP(), []int{48}
}
func (x *TaskInstructionsResponse) GetInstance() string {
@@ -2483,7 +2587,7 @@ type TaskModelsResponse struct {
func (x *TaskModelsResponse) Reset() {
*x = TaskModelsResponse{}
mi := &file_state_v1_task_proto_msgTypes[47]
mi := &file_state_v1_task_proto_msgTypes[49]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2495,7 +2599,7 @@ func (x *TaskModelsResponse) String() string {
func (*TaskModelsResponse) ProtoMessage() {}
func (x *TaskModelsResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[47]
mi := &file_state_v1_task_proto_msgTypes[49]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2508,7 +2612,7 @@ func (x *TaskModelsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskModelsResponse.ProtoReflect.Descriptor instead.
func (*TaskModelsResponse) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{47}
return file_state_v1_task_proto_rawDescGZIP(), []int{49}
}
func (x *TaskModelsResponse) GetOrgId() string {
@@ -2550,7 +2654,7 @@ type ModelProvider struct {
func (x *ModelProvider) Reset() {
*x = ModelProvider{}
mi := &file_state_v1_task_proto_msgTypes[48]
mi := &file_state_v1_task_proto_msgTypes[50]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2562,7 +2666,7 @@ func (x *ModelProvider) String() string {
func (*ModelProvider) ProtoMessage() {}
func (x *ModelProvider) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_task_proto_msgTypes[48]
mi := &file_state_v1_task_proto_msgTypes[50]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2575,7 +2679,7 @@ func (x *ModelProvider) ProtoReflect() protoreflect.Message {
// Deprecated: Use ModelProvider.ProtoReflect.Descriptor instead.
func (*ModelProvider) Descriptor() ([]byte, []int) {
return file_state_v1_task_proto_rawDescGZIP(), []int{48}
return file_state_v1_task_proto_rawDescGZIP(), []int{50}
}
func (x *ModelProvider) GetClass() string {
@@ -2746,7 +2850,13 @@ const file_state_v1_task_proto_rawDesc = "" +
"\bworkflow\x18\x02 \x01(\tR\bworkflow\x12\x1f\n" +
"\vinputs_json\x18\x03 \x01(\tR\n" +
"inputsJson\x12\x19\n" +
"\bcall_key\x18\x04 \x01(\tR\acallKey\"Y\n" +
"\bcall_key\x18\x04 \x01(\tR\acallKey\"a\n" +
"\x12HandoffTaskRequest\x12\x17\n" +
"\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x1a\n" +
"\bworkflow\x18\x02 \x01(\tR\bworkflow\x12\x16\n" +
"\x06detail\x18\x03 \x01(\tR\x06detail\"9\n" +
"\x13HandoffTaskResponse\x12\"\n" +
"\x04task\x18\x01 \x01(\v2\x0e.state.v1.TaskR\x04task\"Y\n" +
"\x17EnqueueCallTaskResponse\x12\"\n" +
"\x04task\x18\x01 \x01(\v2\x0e.state.v1.TaskR\x04task\x12\x1a\n" +
"\baccepted\x18\x02 \x01(\bR\baccepted\"c\n" +
@@ -2780,7 +2890,7 @@ const file_state_v1_task_proto_rawDesc = "" +
"\bbase_url\x18\x02 \x01(\tR\abaseUrl\x12\x1e\n" +
"\vapi_key_env\x18\x03 \x01(\tR\tapiKeyEnv\x12$\n" +
"\x0eapi_key_engine\x18\x04 \x01(\tR\fapiKeyEngine\x12\x1e\n" +
"\vapi_key_key\x18\x05 \x01(\tR\tapiKeyKey2\xe6\x0e\n" +
"\vapi_key_key\x18\x05 \x01(\tR\tapiKeyKey2\xb2\x0f\n" +
"\vTaskService\x12M\n" +
"\fEnqueueIssue\x12\x1d.state.v1.EnqueueIssueRequest\x1a\x1e.state.v1.EnqueueIssueResponse\x12V\n" +
"\x0fEnqueueChatTask\x12 .state.v1.EnqueueChatTaskRequest\x1a!.state.v1.EnqueueChatTaskResponse\x12b\n" +
@@ -2806,7 +2916,8 @@ const file_state_v1_task_proto_rawDesc = "" +
"\aOpenPRs\x12\x18.state.v1.OpenPRsRequest\x1a\x19.state.v1.OpenPRsResponse\x12_\n" +
"\x12ClearTerminalTasks\x12#.state.v1.ClearTerminalTasksRequest\x1a$.state.v1.ClearTerminalTasksResponse\x128\n" +
"\x05Tasks\x12\x16.state.v1.TasksRequest\x1a\x17.state.v1.TasksResponse\x12V\n" +
"\x0fEnqueueCallTask\x12 .state.v1.EnqueueCallTaskRequest\x1a!.state.v1.EnqueueCallTaskResponse\x12_\n" +
"\x0fEnqueueCallTask\x12 .state.v1.EnqueueCallTaskRequest\x1a!.state.v1.EnqueueCallTaskResponse\x12J\n" +
"\vHandoffTask\x12\x1c.state.v1.HandoffTaskRequest\x1a\x1d.state.v1.HandoffTaskResponse\x12_\n" +
"\x12WorkflowCallStatus\x12#.state.v1.WorkflowCallStatusRequest\x1a$.state.v1.WorkflowCallStatusResponseB\xa3\x01\n" +
"\fcom.state.v1B\tTaskProtoP\x01ZGgithub.com/samcharles93/archie-core/internal/contracts/state/v1;statev1\xa2\x02\x03SXX\xaa\x02\bState.V1\xca\x02\bState\\V1\xe2\x02\x14State\\V1\\GPBMetadata\xea\x02\tState::V1b\x06proto3"
@@ -2822,7 +2933,7 @@ func file_state_v1_task_proto_rawDescGZIP() []byte {
return file_state_v1_task_proto_rawDescData
}
var file_state_v1_task_proto_msgTypes = make([]protoimpl.MessageInfo, 51)
var file_state_v1_task_proto_msgTypes = make([]protoimpl.MessageInfo, 53)
var file_state_v1_task_proto_goTypes = []any{
(*EnqueueIssueRequest)(nil), // 0: state.v1.EnqueueIssueRequest
(*EnqueueIssueResponse)(nil), // 1: state.v1.EnqueueIssueResponse
@@ -2865,91 +2976,96 @@ var file_state_v1_task_proto_goTypes = []any{
(*TasksRequest)(nil), // 38: state.v1.TasksRequest
(*TasksResponse)(nil), // 39: state.v1.TasksResponse
(*EnqueueCallTaskRequest)(nil), // 40: state.v1.EnqueueCallTaskRequest
(*EnqueueCallTaskResponse)(nil), // 41: state.v1.EnqueueCallTaskResponse
(*WorkflowCallStatusRequest)(nil), // 42: state.v1.WorkflowCallStatusRequest
(*WorkflowCallStatusResponse)(nil), // 43: state.v1.WorkflowCallStatusResponse
(*TaskModelsRequest)(nil), // 44: state.v1.TaskModelsRequest
(*TaskInstructionsRequest)(nil), // 45: state.v1.TaskInstructionsRequest
(*TaskInstructionsResponse)(nil), // 46: state.v1.TaskInstructionsResponse
(*TaskModelsResponse)(nil), // 47: state.v1.TaskModelsResponse
(*ModelProvider)(nil), // 48: state.v1.ModelProvider
nil, // 49: state.v1.TaskModelsResponse.AliasesEntry
nil, // 50: state.v1.TaskModelsResponse.ProvidersEntry
(*Task)(nil), // 51: state.v1.Task
(*Event)(nil), // 52: state.v1.Event
(*timestamppb.Timestamp)(nil), // 53: google.protobuf.Timestamp
(*HandoffTaskRequest)(nil), // 41: state.v1.HandoffTaskRequest
(*HandoffTaskResponse)(nil), // 42: state.v1.HandoffTaskResponse
(*EnqueueCallTaskResponse)(nil), // 43: state.v1.EnqueueCallTaskResponse
(*WorkflowCallStatusRequest)(nil), // 44: state.v1.WorkflowCallStatusRequest
(*WorkflowCallStatusResponse)(nil), // 45: state.v1.WorkflowCallStatusResponse
(*TaskModelsRequest)(nil), // 46: state.v1.TaskModelsRequest
(*TaskInstructionsRequest)(nil), // 47: state.v1.TaskInstructionsRequest
(*TaskInstructionsResponse)(nil), // 48: state.v1.TaskInstructionsResponse
(*TaskModelsResponse)(nil), // 49: state.v1.TaskModelsResponse
(*ModelProvider)(nil), // 50: state.v1.ModelProvider
nil, // 51: state.v1.TaskModelsResponse.AliasesEntry
nil, // 52: state.v1.TaskModelsResponse.ProvidersEntry
(*Task)(nil), // 53: state.v1.Task
(*Event)(nil), // 54: state.v1.Event
(*timestamppb.Timestamp)(nil), // 55: google.protobuf.Timestamp
}
var file_state_v1_task_proto_depIdxs = []int32{
51, // 0: state.v1.ActiveTasksByOriginResponse.tasks:type_name -> state.v1.Task
51, // 1: state.v1.UnpostedOutcomesResponse.tasks:type_name -> state.v1.Task
51, // 2: state.v1.EnqueueChatTaskResponse.task:type_name -> state.v1.Task
51, // 3: state.v1.ClaimNextResponse.task:type_name -> state.v1.Task
51, // 4: state.v1.ClaimByIssueResponse.task:type_name -> state.v1.Task
51, // 5: state.v1.UpdateRequest.task:type_name -> state.v1.Task
52, // 6: state.v1.ArchiveTaskRequest.audit:type_name -> state.v1.Event
51, // 7: state.v1.TaskByIssueResponse.task:type_name -> state.v1.Task
51, // 8: state.v1.OpenTaskByPRResponse.task:type_name -> state.v1.Task
51, // 9: state.v1.TaskByIDResponse.task:type_name -> state.v1.Task
51, // 10: state.v1.OpenPRsResponse.tasks:type_name -> state.v1.Task
53, // 11: state.v1.TasksRequest.after_updated_at:type_name -> google.protobuf.Timestamp
51, // 12: state.v1.TasksResponse.tasks:type_name -> state.v1.Task
51, // 13: state.v1.EnqueueCallTaskResponse.task:type_name -> state.v1.Task
49, // 14: state.v1.TaskModelsResponse.aliases:type_name -> state.v1.TaskModelsResponse.AliasesEntry
50, // 15: state.v1.TaskModelsResponse.providers:type_name -> state.v1.TaskModelsResponse.ProvidersEntry
48, // 16: state.v1.TaskModelsResponse.ProvidersEntry.value:type_name -> state.v1.ModelProvider
0, // 17: state.v1.TaskService.EnqueueIssue:input_type -> state.v1.EnqueueIssueRequest
8, // 18: state.v1.TaskService.EnqueueChatTask:input_type -> state.v1.EnqueueChatTaskRequest
2, // 19: state.v1.TaskService.ActiveTasksByOrigin:input_type -> state.v1.ActiveTasksByOriginRequest
4, // 20: state.v1.TaskService.UnpostedOutcomes:input_type -> state.v1.UnpostedOutcomesRequest
6, // 21: state.v1.TaskService.MarkOutcomePosted:input_type -> state.v1.MarkOutcomePostedRequest
10, // 22: state.v1.TaskService.ClaimNext:input_type -> state.v1.ClaimNextRequest
12, // 23: state.v1.TaskService.ClaimByIssue:input_type -> state.v1.ClaimByIssueRequest
14, // 24: state.v1.TaskService.Transition:input_type -> state.v1.TransitionRequest
16, // 25: state.v1.TaskService.Update:input_type -> state.v1.UpdateRequest
44, // 26: state.v1.TaskService.TaskModels:input_type -> state.v1.TaskModelsRequest
45, // 27: state.v1.TaskService.TaskInstructions:input_type -> state.v1.TaskInstructionsRequest
18, // 28: state.v1.TaskService.Requeue:input_type -> state.v1.RequeueRequest
20, // 29: state.v1.TaskService.ParkTask:input_type -> state.v1.ParkTaskRequest
22, // 30: state.v1.TaskService.RecoverStale:input_type -> state.v1.RecoverStaleRequest
24, // 31: state.v1.TaskService.ArchiveTask:input_type -> state.v1.ArchiveTaskRequest
26, // 32: state.v1.TaskService.RetryTask:input_type -> state.v1.RetryTaskRequest
28, // 33: state.v1.TaskService.TaskByIssue:input_type -> state.v1.TaskByIssueRequest
30, // 34: state.v1.TaskService.OpenTaskByPR:input_type -> state.v1.OpenTaskByPRRequest
32, // 35: state.v1.TaskService.TaskByID:input_type -> state.v1.TaskByIDRequest
34, // 36: state.v1.TaskService.OpenPRs:input_type -> state.v1.OpenPRsRequest
36, // 37: state.v1.TaskService.ClearTerminalTasks:input_type -> state.v1.ClearTerminalTasksRequest
38, // 38: state.v1.TaskService.Tasks:input_type -> state.v1.TasksRequest
40, // 39: state.v1.TaskService.EnqueueCallTask:input_type -> state.v1.EnqueueCallTaskRequest
42, // 40: state.v1.TaskService.WorkflowCallStatus:input_type -> state.v1.WorkflowCallStatusRequest
1, // 41: state.v1.TaskService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
9, // 42: state.v1.TaskService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
3, // 43: state.v1.TaskService.ActiveTasksByOrigin:output_type -> state.v1.ActiveTasksByOriginResponse
5, // 44: state.v1.TaskService.UnpostedOutcomes:output_type -> state.v1.UnpostedOutcomesResponse
7, // 45: state.v1.TaskService.MarkOutcomePosted:output_type -> state.v1.MarkOutcomePostedResponse
11, // 46: state.v1.TaskService.ClaimNext:output_type -> state.v1.ClaimNextResponse
13, // 47: state.v1.TaskService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
15, // 48: state.v1.TaskService.Transition:output_type -> state.v1.TransitionResponse
17, // 49: state.v1.TaskService.Update:output_type -> state.v1.UpdateResponse
47, // 50: state.v1.TaskService.TaskModels:output_type -> state.v1.TaskModelsResponse
46, // 51: state.v1.TaskService.TaskInstructions:output_type -> state.v1.TaskInstructionsResponse
19, // 52: state.v1.TaskService.Requeue:output_type -> state.v1.RequeueResponse
21, // 53: state.v1.TaskService.ParkTask:output_type -> state.v1.ParkTaskResponse
23, // 54: state.v1.TaskService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
25, // 55: state.v1.TaskService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
27, // 56: state.v1.TaskService.RetryTask:output_type -> state.v1.RetryTaskResponse
29, // 57: state.v1.TaskService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
31, // 58: state.v1.TaskService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
33, // 59: state.v1.TaskService.TaskByID:output_type -> state.v1.TaskByIDResponse
35, // 60: state.v1.TaskService.OpenPRs:output_type -> state.v1.OpenPRsResponse
37, // 61: state.v1.TaskService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
39, // 62: state.v1.TaskService.Tasks:output_type -> state.v1.TasksResponse
41, // 63: state.v1.TaskService.EnqueueCallTask:output_type -> state.v1.EnqueueCallTaskResponse
43, // 64: state.v1.TaskService.WorkflowCallStatus:output_type -> state.v1.WorkflowCallStatusResponse
41, // [41:65] is the sub-list for method output_type
17, // [17:41] is the sub-list for method input_type
17, // [17:17] is the sub-list for extension type_name
17, // [17:17] is the sub-list for extension extendee
0, // [0:17] is the sub-list for field type_name
53, // 0: state.v1.ActiveTasksByOriginResponse.tasks:type_name -> state.v1.Task
53, // 1: state.v1.UnpostedOutcomesResponse.tasks:type_name -> state.v1.Task
53, // 2: state.v1.EnqueueChatTaskResponse.task:type_name -> state.v1.Task
53, // 3: state.v1.ClaimNextResponse.task:type_name -> state.v1.Task
53, // 4: state.v1.ClaimByIssueResponse.task:type_name -> state.v1.Task
53, // 5: state.v1.UpdateRequest.task:type_name -> state.v1.Task
54, // 6: state.v1.ArchiveTaskRequest.audit:type_name -> state.v1.Event
53, // 7: state.v1.TaskByIssueResponse.task:type_name -> state.v1.Task
53, // 8: state.v1.OpenTaskByPRResponse.task:type_name -> state.v1.Task
53, // 9: state.v1.TaskByIDResponse.task:type_name -> state.v1.Task
53, // 10: state.v1.OpenPRsResponse.tasks:type_name -> state.v1.Task
55, // 11: state.v1.TasksRequest.after_updated_at:type_name -> google.protobuf.Timestamp
53, // 12: state.v1.TasksResponse.tasks:type_name -> state.v1.Task
53, // 13: state.v1.HandoffTaskResponse.task:type_name -> state.v1.Task
53, // 14: state.v1.EnqueueCallTaskResponse.task:type_name -> state.v1.Task
51, // 15: state.v1.TaskModelsResponse.aliases:type_name -> state.v1.TaskModelsResponse.AliasesEntry
52, // 16: state.v1.TaskModelsResponse.providers:type_name -> state.v1.TaskModelsResponse.ProvidersEntry
50, // 17: state.v1.TaskModelsResponse.ProvidersEntry.value:type_name -> state.v1.ModelProvider
0, // 18: state.v1.TaskService.EnqueueIssue:input_type -> state.v1.EnqueueIssueRequest
8, // 19: state.v1.TaskService.EnqueueChatTask:input_type -> state.v1.EnqueueChatTaskRequest
2, // 20: state.v1.TaskService.ActiveTasksByOrigin:input_type -> state.v1.ActiveTasksByOriginRequest
4, // 21: state.v1.TaskService.UnpostedOutcomes:input_type -> state.v1.UnpostedOutcomesRequest
6, // 22: state.v1.TaskService.MarkOutcomePosted:input_type -> state.v1.MarkOutcomePostedRequest
10, // 23: state.v1.TaskService.ClaimNext:input_type -> state.v1.ClaimNextRequest
12, // 24: state.v1.TaskService.ClaimByIssue:input_type -> state.v1.ClaimByIssueRequest
14, // 25: state.v1.TaskService.Transition:input_type -> state.v1.TransitionRequest
16, // 26: state.v1.TaskService.Update:input_type -> state.v1.UpdateRequest
46, // 27: state.v1.TaskService.TaskModels:input_type -> state.v1.TaskModelsRequest
47, // 28: state.v1.TaskService.TaskInstructions:input_type -> state.v1.TaskInstructionsRequest
18, // 29: state.v1.TaskService.Requeue:input_type -> state.v1.RequeueRequest
20, // 30: state.v1.TaskService.ParkTask:input_type -> state.v1.ParkTaskRequest
22, // 31: state.v1.TaskService.RecoverStale:input_type -> state.v1.RecoverStaleRequest
24, // 32: state.v1.TaskService.ArchiveTask:input_type -> state.v1.ArchiveTaskRequest
26, // 33: state.v1.TaskService.RetryTask:input_type -> state.v1.RetryTaskRequest
28, // 34: state.v1.TaskService.TaskByIssue:input_type -> state.v1.TaskByIssueRequest
30, // 35: state.v1.TaskService.OpenTaskByPR:input_type -> state.v1.OpenTaskByPRRequest
32, // 36: state.v1.TaskService.TaskByID:input_type -> state.v1.TaskByIDRequest
34, // 37: state.v1.TaskService.OpenPRs:input_type -> state.v1.OpenPRsRequest
36, // 38: state.v1.TaskService.ClearTerminalTasks:input_type -> state.v1.ClearTerminalTasksRequest
38, // 39: state.v1.TaskService.Tasks:input_type -> state.v1.TasksRequest
40, // 40: state.v1.TaskService.EnqueueCallTask:input_type -> state.v1.EnqueueCallTaskRequest
41, // 41: state.v1.TaskService.HandoffTask:input_type -> state.v1.HandoffTaskRequest
44, // 42: state.v1.TaskService.WorkflowCallStatus:input_type -> state.v1.WorkflowCallStatusRequest
1, // 43: state.v1.TaskService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
9, // 44: state.v1.TaskService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
3, // 45: state.v1.TaskService.ActiveTasksByOrigin:output_type -> state.v1.ActiveTasksByOriginResponse
5, // 46: state.v1.TaskService.UnpostedOutcomes:output_type -> state.v1.UnpostedOutcomesResponse
7, // 47: state.v1.TaskService.MarkOutcomePosted:output_type -> state.v1.MarkOutcomePostedResponse
11, // 48: state.v1.TaskService.ClaimNext:output_type -> state.v1.ClaimNextResponse
13, // 49: state.v1.TaskService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
15, // 50: state.v1.TaskService.Transition:output_type -> state.v1.TransitionResponse
17, // 51: state.v1.TaskService.Update:output_type -> state.v1.UpdateResponse
49, // 52: state.v1.TaskService.TaskModels:output_type -> state.v1.TaskModelsResponse
48, // 53: state.v1.TaskService.TaskInstructions:output_type -> state.v1.TaskInstructionsResponse
19, // 54: state.v1.TaskService.Requeue:output_type -> state.v1.RequeueResponse
21, // 55: state.v1.TaskService.ParkTask:output_type -> state.v1.ParkTaskResponse
23, // 56: state.v1.TaskService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
25, // 57: state.v1.TaskService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
27, // 58: state.v1.TaskService.RetryTask:output_type -> state.v1.RetryTaskResponse
29, // 59: state.v1.TaskService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
31, // 60: state.v1.TaskService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
33, // 61: state.v1.TaskService.TaskByID:output_type -> state.v1.TaskByIDResponse
35, // 62: state.v1.TaskService.OpenPRs:output_type -> state.v1.OpenPRsResponse
37, // 63: state.v1.TaskService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
39, // 64: state.v1.TaskService.Tasks:output_type -> state.v1.TasksResponse
43, // 65: state.v1.TaskService.EnqueueCallTask:output_type -> state.v1.EnqueueCallTaskResponse
42, // 66: state.v1.TaskService.HandoffTask:output_type -> state.v1.HandoffTaskResponse
45, // 67: state.v1.TaskService.WorkflowCallStatus:output_type -> state.v1.WorkflowCallStatusResponse
43, // [43:68] is the sub-list for method output_type
18, // [18:43] is the sub-list for method input_type
18, // [18:18] is the sub-list for extension type_name
18, // [18:18] is the sub-list for extension extendee
0, // [0:18] is the sub-list for field type_name
}
func init() { file_state_v1_task_proto_init() }
@@ -2964,7 +3080,7 @@ func file_state_v1_task_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_state_v1_task_proto_rawDesc), len(file_state_v1_task_proto_rawDesc)),
NumEnums: 0,
NumMessages: 51,
NumMessages: 53,
NumExtensions: 0,
NumServices: 1,
},
@@ -42,6 +42,7 @@ const (
TaskService_ClearTerminalTasks_FullMethodName = "/state.v1.TaskService/ClearTerminalTasks"
TaskService_Tasks_FullMethodName = "/state.v1.TaskService/Tasks"
TaskService_EnqueueCallTask_FullMethodName = "/state.v1.TaskService/EnqueueCallTask"
TaskService_HandoffTask_FullMethodName = "/state.v1.TaskService/HandoffTask"
TaskService_WorkflowCallStatus_FullMethodName = "/state.v1.TaskService/WorkflowCallStatus"
)
@@ -84,6 +85,9 @@ type TaskServiceClient interface {
// (docs/prds/workflow-calls.md). CallStatus re-checks the parent-child
// relation server-side, so the grant only names the caller.
EnqueueCallTask(ctx context.Context, in *EnqueueCallTaskRequest, opts ...grpc.CallOption) (*EnqueueCallTaskResponse, error)
// HandoffTask completes a running run and starts its linked successor on
// the same work item under another workflow.
HandoffTask(ctx context.Context, in *HandoffTaskRequest, opts ...grpc.CallOption) (*HandoffTaskResponse, error)
WorkflowCallStatus(ctx context.Context, in *WorkflowCallStatusRequest, opts ...grpc.CallOption) (*WorkflowCallStatusResponse, error)
}
@@ -325,6 +329,16 @@ func (c *taskServiceClient) EnqueueCallTask(ctx context.Context, in *EnqueueCall
return out, nil
}
func (c *taskServiceClient) HandoffTask(ctx context.Context, in *HandoffTaskRequest, opts ...grpc.CallOption) (*HandoffTaskResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HandoffTaskResponse)
err := c.cc.Invoke(ctx, TaskService_HandoffTask_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *taskServiceClient) WorkflowCallStatus(ctx context.Context, in *WorkflowCallStatusRequest, opts ...grpc.CallOption) (*WorkflowCallStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(WorkflowCallStatusResponse)
@@ -374,6 +388,9 @@ type TaskServiceServer interface {
// (docs/prds/workflow-calls.md). CallStatus re-checks the parent-child
// relation server-side, so the grant only names the caller.
EnqueueCallTask(context.Context, *EnqueueCallTaskRequest) (*EnqueueCallTaskResponse, error)
// HandoffTask completes a running run and starts its linked successor on
// the same work item under another workflow.
HandoffTask(context.Context, *HandoffTaskRequest) (*HandoffTaskResponse, error)
WorkflowCallStatus(context.Context, *WorkflowCallStatusRequest) (*WorkflowCallStatusResponse, error)
mustEmbedUnimplementedTaskServiceServer()
}
@@ -454,6 +471,9 @@ func (UnimplementedTaskServiceServer) Tasks(context.Context, *TasksRequest) (*Ta
func (UnimplementedTaskServiceServer) EnqueueCallTask(context.Context, *EnqueueCallTaskRequest) (*EnqueueCallTaskResponse, error) {
return nil, status.Error(codes.Unimplemented, "method EnqueueCallTask not implemented")
}
func (UnimplementedTaskServiceServer) HandoffTask(context.Context, *HandoffTaskRequest) (*HandoffTaskResponse, error) {
return nil, status.Error(codes.Unimplemented, "method HandoffTask not implemented")
}
func (UnimplementedTaskServiceServer) WorkflowCallStatus(context.Context, *WorkflowCallStatusRequest) (*WorkflowCallStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method WorkflowCallStatus not implemented")
}
@@ -892,6 +912,24 @@ func _TaskService_EnqueueCallTask_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _TaskService_HandoffTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HandoffTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TaskServiceServer).HandoffTask(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: TaskService_HandoffTask_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TaskServiceServer).HandoffTask(ctx, req.(*HandoffTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
func _TaskService_WorkflowCallStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(WorkflowCallStatusRequest)
if err := dec(in); err != nil {
@@ -1009,6 +1047,10 @@ var TaskService_ServiceDesc = grpc.ServiceDesc{
MethodName: "EnqueueCallTask",
Handler: _TaskService_EnqueueCallTask_Handler,
},
{
MethodName: "HandoffTask",
Handler: _TaskService_HandoffTask_Handler,
},
{
MethodName: "WorkflowCallStatus",
Handler: _TaskService_WorkflowCallStatus_Handler,
+25 -5
View File
@@ -229,9 +229,13 @@ type Task struct {
// recorded at the park site; empty when the park has no known fix.
ParkBlocker string `protobuf:"bytes,48,opt,name=park_blocker,json=parkBlocker,proto3" json:"park_blocker,omitempty"`
// plan_document is the structured plan (JSON) plan was rendered from.
PlanDocument string `protobuf:"bytes,50,opt,name=plan_document,json=planDocument,proto3" json:"plan_document,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
PlanDocument string `protobuf:"bytes,50,opt,name=plan_document,json=planDocument,proto3" json:"plan_document,omitempty"`
// handoff_from_task_id is the run that handed off to this one; 0 when none.
HandoffFromTaskId int64 `protobuf:"varint,51,opt,name=handoff_from_task_id,json=handoffFromTaskId,proto3" json:"handoff_from_task_id,omitempty"`
// handoff_to_task_id is the run this one handed off to; 0 when none.
HandoffToTaskId int64 `protobuf:"varint,52,opt,name=handoff_to_task_id,json=handoffToTaskId,proto3" json:"handoff_to_task_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Task) Reset() {
@@ -608,6 +612,20 @@ func (x *Task) GetPlanDocument() string {
return ""
}
func (x *Task) GetHandoffFromTaskId() int64 {
if x != nil {
return x.HandoffFromTaskId
}
return 0
}
func (x *Task) GetHandoffToTaskId() int64 {
if x != nil {
return x.HandoffToTaskId
}
return 0
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
// string (matching the store's own on-disk representation) rather than
// google.protobuf.Struct, to stay a direct mirror of the existing column.
@@ -784,7 +802,7 @@ const file_state_v1_types_proto_rawDesc = "" +
"\n" +
"created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" +
"\n" +
"updated_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\x91\r\n" +
"updated_at\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"\xef\r\n" +
"\x04Task\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05owner\x18\x02 \x01(\tR\x05owner\x12\x12\n" +
@@ -849,7 +867,9 @@ const file_state_v1_types_proto_rawDesc = "" +
"\x11binding_signature\x18. \x01(\tR\x10bindingSignature\x12!\n" +
"\fbinding_addr\x18/ \x01(\tR\vbindingAddr\x12!\n" +
"\fpark_blocker\x180 \x01(\tR\vparkBlocker\x12#\n" +
"\rplan_document\x182 \x01(\tR\fplanDocumentJ\x04\b1\x102R\tplan_view\"\xf8\x02\n" +
"\rplan_document\x182 \x01(\tR\fplanDocument\x12/\n" +
"\x14handoff_from_task_id\x183 \x01(\x03R\x11handoffFromTaskId\x12+\n" +
"\x12handoff_to_task_id\x184 \x01(\x03R\x0fhandoffToTaskIdJ\x04\b1\x102R\tplan_view\"\xf8\x02\n" +
"\x05Event\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12*\n" +
"\x02at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02at\x12\x12\n" +
-4
View File
@@ -36,10 +36,6 @@ func (s *ledgerStore) ListBindings(context.Context) ([]binding.Binding, error) {
return []binding.Binding{dispatchBinding}, nil
}
func (s *ledgerStore) ArmedBindingsForSource(context.Context, string) ([]binding.Binding, error) {
return []binding.Binding{dispatchBinding}, nil
}
func (s *ledgerStore) ListUndispatchedCaptures(context.Context, []string, int) ([]storecontract.CapturedEvent, error) {
s.mu.Lock()
pending := !s.claimed["capture"]
+16
View File
@@ -0,0 +1,16 @@
package daemon
import (
"context"
"testing"
)
// The systemd watchdog beats only while StalestLoop is fresh, so a cycle that
// doesn't stamp it gets archied killed shortly after every start.
func TestCycleMarksPass(t *testing.T) {
d := &Daemon{}
d.Cycle(context.Background())
if loop, at := d.StalestLoop(); loop != "cycle" || at.IsZero() {
t.Fatalf("StalestLoop() = %q, %v; want a cycle pass", loop, at)
}
}
+170 -63
View File
@@ -240,10 +240,10 @@ type Daemon struct {
// to use.
running runningTasks
// lastPollAt maps each poll loop (an identity ID, or "" for the root
// loop) to when its latest pass began, as Unix nanoseconds. LastPollAt
// reports the oldest, so one wedged loop is not hidden by a healthy one.
lastPollAt sync.Map
// loopPasses maps each run loop ("cycle", "drain") to when its latest
// pass began, as Unix nanoseconds. StalestLoop reports the oldest, so one
// wedged loop isn't hidden by a healthy one.
loopPasses sync.Map
}
// IssueSource is one forge connection's repositories as the identity
@@ -304,6 +304,14 @@ func (d *Daemon) Startup(ctx context.Context) error {
// an unreachable host would otherwise hold boot open indefinitely.
const sweepTimeout = 2 * time.Minute
// A clone waits, holding its slot, until the work volume has minCloneSpace
// free, and parks as transient if it does not within diskWaitLimit.
const (
minCloneSpace = 5 << 30
diskCheckEvery = 15 * time.Second
diskWaitLimit = 10 * time.Minute
)
// sweepAccess accepts pending invitations and verifies push access through
// every organisation connection, each in its own goroutine.
func (d *Daemon) sweepAccess(ctx context.Context) {
@@ -366,6 +374,9 @@ func (d *Daemon) Run(ctx context.Context) error {
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
if d.Tasks == nil {
d.dispatchBindings(ctx)
}
d.Cycle(ctx)
select {
case <-ctx.Done():
@@ -381,14 +392,17 @@ func (d *Daemon) Run(ctx context.Context) error {
}
}
// drainLoop is the only task drainer while Run is active. It runs apart from
// the poll tick so a queued task starts within about a second regardless of
// poll_interval or forge latency. Submit never blocks, so a full dispatcher
// drainLoop is the only task drainer and capture dispatcher while Run is
// active. It runs apart from the poll tick so a captured event becomes a
// running task within about a second regardless of poll_interval or forge
// latency. Submit never blocks, so a full dispatcher
// just leaves tasks waiting on slots and the loop stays paced by the ticker.
func (d *Daemon) drainLoop(ctx context.Context) {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {
d.markPass("drain")
d.dispatchBindings(ctx)
d.drainNATS(ctx)
select {
case <-ctx.Done():
@@ -402,15 +416,8 @@ func (d *Daemon) drainLoop(ctx context.Context) {
// work, using the given forge client and dispatch config. complete is false when any part of the poll failed or was skipped, so
// the result must not be read as the whole eligible set.
func (d *Daemon) pollIssuesWithConfig(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo) (issues []forge.Issue, complete bool) {
// Webhook intake hears about issues as they change; polling as well would
// spend forge API quota to find the same work. The receiver runs from the
// root forge settings, so their mode decides for every identity.
if d.Cfg.Get().Forge.Intake == config.ForgeIntakeWebhook {
return nil, false
}
labelled := func() ([]forge.Issue, bool) {
// Empty-label rule shared with workintake.MatchesDispatch: a label
// trigger needs a non-empty label or it would match every open issue.
// A label trigger needs a non-empty label or it would match every open issue.
if cfg.Label == "" {
d.Log.ErrorContext(ctx, "label trigger configured with an empty label; refusing to poll (an empty label matches every open issue)", "repo", repo.FullName())
return nil, false
@@ -468,6 +475,7 @@ func (d *Daemon) RunOnce(ctx context.Context) {
d.Log.WarnContext(ctx, "built-in job failed", "job", job.ID, "err", err)
}
}
d.dispatchBindings(ctx)
d.Cycle(ctx)
if d.Tasks == nil {
return
@@ -485,12 +493,63 @@ func (d *Daemon) RunOnce(ctx context.Context) {
}
}
// Cycle is one poll pass: turn captured events and review reactions into
// tasks; maintenance runs as built-in schedules. Draining queued tasks is the caller's job
// (drainLoop in Run, drainNATS in RunOnce) so there is one drainer.
// Cycle is one poll pass: turn review reactions into tasks; maintenance runs
// as built-in schedules. Captured events are dispatched by the caller
// (drainLoop in Run, once in RunOnce) so they start within about a second.
func (d *Daemon) Cycle(ctx context.Context) {
d.dispatchBindings(ctx)
d.markPass("cycle")
d.drainReactions(ctx)
d.retryTransientParks(ctx)
}
// retryTransientParks requeues tasks parked for an environmental cause once
// their backoff has passed. The store parks a task needs_decision, which
// raises the alert, when its retries run out, so this never loops on one.
func (d *Daemon) retryTransientParks(ctx context.Context) {
if d.Store == nil {
return
}
now := time.Now()
var after storecontract.TaskCursor
for {
page, err := d.Store.TasksPage(ctx, storecontract.TaskPage{Statuses: []string{workflow.StatusParked}, After: after, Limit: 200})
if err != nil {
d.Log.WarnContext(ctx, "list parked tasks for retry failed", "err", err)
return
}
for _, t := range page {
if taskstate.TransientRetryDue(t.ParkClass, t.RetryCount, t.UpdatedAt, now) {
d.retryTransientPark(ctx, t.ID)
}
}
if len(page) < 200 {
return
}
last := page[len(page)-1]
after = storecontract.TaskCursor{UpdatedAt: last.UpdatedAt, ID: last.ID}
}
}
// retryTransientPark requeues one task on its stored retry mode, which the
// list projection omits: a remediation must keep continuing its branch.
func (d *Daemon) retryTransientPark(ctx context.Context, id int64) {
t, err := d.Store.TaskByID(ctx, id)
if err != nil {
d.Log.WarnContext(ctx, "load task for transient retry failed", "task", id, "err", err)
return
}
if err := d.Store.RetryTask(ctx, id, workflow.StatusParked, "", t.RetryMode, workflowtask.Resume{}, false); err != nil {
if !errors.Is(err, storecontract.ErrStaleTransition) {
d.Log.WarnContext(ctx, "transient park retry failed", "task", id, "err", err)
}
return
}
d.emit(ctx, events.Event{
Kind: events.KindTaskRetried, TaskID: id, Workflow: t.Workflow,
Repo: strings.Trim(t.Owner+"/"+t.Repo, "/"), Issue: t.IssueNumber,
Detail: "retried automatically after a transient park",
Data: map[string]any{"retry_count": t.RetryCount + 1, "previous_reason": t.ParkReason},
})
}
func (d *Daemon) cleanupExpiredStorage(ctx context.Context) error {
@@ -561,9 +620,11 @@ func (d *Daemon) dispatchOrgBindings(ctx context.Context) {
return
}
enabled := make([]string, 0, len(bindings))
armed := make([]binding.Binding, 0, len(bindings))
for _, b := range bindings {
if b.OrgID == org.OrgFromContext(ctx) && b.Status == binding.StatusArmed && b.Matcher.Source != "" && enablement.Enabled(b.OrgID, b.Workflow) {
enabled = append(enabled, b.ID)
armed = append(armed, b)
}
}
if len(enabled) == 0 {
@@ -581,21 +642,16 @@ func (d *Daemon) dispatchOrgBindings(ctx context.Context) {
return
}
for _, c := range captures {
d.dispatchCapture(ctx, c, workflows, enablement)
d.dispatchCapture(ctx, c, armed, workflows)
}
}
// dispatchCapture offers one capture to every armed binding on its source. A
// disabled workflow's binding is skipped like an unarmed one, so the capture
// waits rather than recording a failure every cycle.
func (d *Daemon) dispatchCapture(ctx context.Context, c storecontract.CapturedEvent, workflows workflow.WorkflowDefinitionCollection, enablement workflowtask.WorkflowEnablement) {
armed, err := d.BindingDispatcher.ArmedBindingsForSource(ctx, c.Source)
if err != nil {
d.Log.WarnContext(ctx, "armed bindings lookup", "source", c.Source, "error", err)
return
}
// dispatchCapture offers one capture to every armed binding that matches it.
// armed holds only the org's armed bindings on enabled workflows, so a
// disabled workflow's capture waits rather than recording a failure every pass.
func (d *Daemon) dispatchCapture(ctx context.Context, c storecontract.CapturedEvent, armed []binding.Binding, workflows workflow.WorkflowDefinitionCollection) {
for _, b := range armed {
if b.OrgID == org.OrgFromContext(ctx) && b.Matcher.Matches(c.Source, c.Dispatchable()) && enablement.Enabled(b.OrgID, b.Workflow) {
if b.Matcher.Matches(c.Source, c.Dispatchable()) {
d.dispatchOneBinding(ctx, b, c, workflows)
}
}
@@ -877,7 +933,9 @@ func (d *Daemon) botUserForTask(task *workflowtask.Task) string {
// through WaitForTasks.
func (d *Daemon) drainNATS(ctx context.Context) {
dispatcher := d.taskDispatcher()
for ctx.Err() == nil {
// A full dispatcher leaves work in the stream and the store, not parked
// on slots where it already reads as running.
for ctx.Err() == nil && dispatcher.hasRoom() {
msg, err := d.Tasks.Fetch(ctx)
if err != nil && !errors.Is(err, eventbus.ErrNoMessage) {
d.Log.ErrorContext(ctx, "nats fetch failed", "err", err)
@@ -885,6 +943,7 @@ func (d *Daemon) drainNATS(ctx context.Context) {
}
if err == nil {
d.submitNATSTask(ctx, dispatcher, msg)
d.markPass("drain")
continue
}
@@ -892,15 +951,27 @@ func (d *Daemon) drainNATS(ctx context.Context) {
// the SQLite fallback must run: requeued tasks (waiting_approval
// approval, retry-parked) never went through a NATS publish, so
// nothing will ever arrive on the stream to trigger them.
task, claimErr := d.Store.ClaimNext(ctx)
if claimErr != nil {
d.Log.ErrorContext(ctx, "sqlite claim failed", "err", claimErr)
break
d.claimRequeued(ctx, dispatcher)
return
}
}
// claimRequeued submits tasks from the store's claim fallback while the
// dispatcher has room; the rest stay unclaimed for a later pass. It does
// not go back to the stream between claims: each empty fetch waits a full poll
// timeout, so a backlog left by a restart would outlast the systemd watchdog.
func (d *Daemon) claimRequeued(ctx context.Context, dispatcher *taskDispatcher) {
for ctx.Err() == nil && dispatcher.hasRoom() {
task, err := d.Store.ClaimNext(ctx)
if err != nil {
d.Log.ErrorContext(ctx, "sqlite claim failed", "err", err)
return
}
if task == nil {
break
return
}
dispatcher.Submit(ctx, task, d.process)
d.markPass("drain")
}
}
@@ -956,6 +1027,9 @@ type taskDispatcher struct {
slotsFree *sync.Cond
repoTail map[string]chan struct{}
pending int
// waiting counts submitted tasks that hold no slot yet, so a drain pass
// stops claiming once queued work alone fills the limit.
waiting int
// holds maps a task id to the capacity its run holds, so a run waiting on
// a callee can give that capacity back and take it again by task id.
holds map[int64]*taskHold
@@ -1172,6 +1246,7 @@ func (d *taskDispatcher) Submit(
d.mu.Lock()
d.pending++
d.waiting++
d.mu.Unlock()
go func() {
defer d.finishRun(hold)
@@ -1180,12 +1255,22 @@ func (d *taskDispatcher) Submit(
}
d.mu.Lock()
d.takeSlotLocked()
d.waiting--
hold.slot = true
d.mu.Unlock()
process(ctx, task, hold)
}()
}
// hasRoom reports whether a newly submitted task could take a slot without
// queueing behind work already submitted. A run waiting on a callee holds no
// slot, so its callee still finds room.
func (d *taskDispatcher) hasRoom() bool {
d.mu.Lock()
defer d.mu.Unlock()
return d.limit <= 0 || d.active+d.waiting < d.limit
}
// inFlight is how many submitted tasks have not returned yet.
func (d *taskDispatcher) inFlight() int {
d.mu.Lock()
@@ -1205,12 +1290,8 @@ func (d *taskDispatcher) Wait() {
// afresh each cycle so a rotated credential or a new connection applies to
// the next poll.
func (d *Daemon) poll(ctx context.Context) error {
d.markPoll("")
// Webhook intake replaces polling; an empty pass is not a failure.
if d.Cfg.Get().Forge.Intake == config.ForgeIntakeWebhook {
return nil
}
var failed []string
room := d.Cfg.Get().IntakePerPass
for _, source := range d.issueSources(ctx) {
if !d.identityActive(ctx, source.Identity) {
continue
@@ -1228,10 +1309,8 @@ func (d *Daemon) poll(ctx context.Context) error {
} else {
failed = append(failed, repo.FullName())
}
for _, is := range issues {
if d.Tasks != nil {
d.pollNATS(ctx, source.Forge, cfg, repo, is, strings.Join(is.Labels, ","), tag)
}
if d.Tasks != nil {
d.publishDiscovered(ctx, source.Forge, cfg, repo, issues, tag, &room)
}
}
}
@@ -1308,16 +1387,34 @@ func (d *Daemon) withdrawUnpolled(ctx context.Context, repo config.Repo, identit
}
}
// pollNATS publishes discovered issues to NATS (new flow).
func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, is forge.Issue, labels, identity string) {
// publishDiscovered publishes a repo's discovered issues until the pass has
// created its cap of tasks. room is what is left of the cap; the issues left
// over are found again by the next poll, because an issue with a task is
// skipped and one without is not. A cap of zero or less is no cap.
func (d *Daemon) publishDiscovered(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, issues []forge.Issue, identity string, room *int) {
capped := *room > 0
for _, is := range issues {
if capped && *room == 0 {
d.Log.InfoContext(ctx, "intake cap reached; remaining issues wait for the next poll", "repo", repo.FullName())
return
}
if d.pollNATS(ctx, fg, cfg, repo, is, strings.Join(is.Labels, ","), identity) && capped {
*room--
}
}
}
// pollNATS publishes a discovered issue to NATS and reports whether it created
// a task.
func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config, repo config.Repo, is forge.Issue, labels, identity string) bool {
// Read-only existence check prevents rediscovering an existing task.
existing, err := d.Store.TaskByIssue(ctx, repo.Owner, repo.Name, is.Number)
if err != nil {
d.Log.ErrorContext(ctx, "task lookup failed", "repo", repo.FullName(), "issue", is.Number, "err", err)
return
return false
}
if existing != nil {
return
return false
}
// Classify and encode here: the envelope, its routing kind and its
// subject belong to the work-intake domain, not to the transport.
@@ -1334,9 +1431,10 @@ func (d *Daemon) pollNATS(ctx context.Context, fg forge.Forge, cfg config.Config
}
if err := d.PublishTask(ctx, task); err != nil {
d.Log.ErrorContext(ctx, "task publish failed", "repo", repo.FullName(), "issue", is.Number, "err", err)
return
return false
}
d.acknowledge(ctx, fg, cfg, repo, is)
return true
}
// PublishTask validates a task envelope, stamps the producing identity's
@@ -1714,6 +1812,11 @@ func (d *Daemon) prepareWorkspace(ctx context.Context, task *workflow.Task, tree
}
target = worktree.Target(task.Branch)
}
if err := worktree.AwaitSpace(ctx, trees.FreeBytes, minCloneSpace, diskCheckEvery, diskWaitLimit); err != nil {
d.Log.WarnContext(ctx, "worktree prepare delayed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task, "worktree prepare failed: "+err.Error(), taskstate.ParkTransient)
return "", false
}
// Every task gets an independent full clone.
prepare := func() (string, string, error) {
return trees.Prepare(ctx, task.Owner, task.Repo, repo.BaseBranch(), task.IssueNumber, task.Title, task.Body, task.Labels, target)
@@ -1752,7 +1855,9 @@ func (d *Daemon) cleanupTerminalTaskWorktree(ctx context.Context, task *workflow
d.Log.WarnContext(ctx, "terminal worktree cleanup task lookup failed", "task", task.ID, "err", err)
return
}
if latest == nil {
// A run that handed off shares its work item's worktree with its
// successor, which owns it from here.
if latest == nil || latest.HandoffToTaskID != 0 {
return
}
// Settled statuses. Keep the worktree while a PR exists.
@@ -2603,26 +2708,28 @@ func (d *Daemon) allowConcurrentForTask(task *workflow.Task) bool {
return ok && repo.AllowConcurrent
}
// LastPollAt reports when the least recently polled loop last began a pass,
// or the zero time when no pass has started yet.
func (d *Daemon) LastPollAt() time.Time {
// StalestLoop reports the run loop that least recently began a pass and when,
// or the zero time when no loop has started yet. The systemd watchdog beats
// only while this is fresh, so every loop Run starts must mark its passes.
func (d *Daemon) StalestLoop() (string, time.Time) {
var loop string
var oldest int64
d.lastPollAt.Range(func(_, v any) bool {
if ns, ok := v.(int64); ok && (oldest == 0 || ns < oldest) {
oldest = ns
d.loopPasses.Range(func(k, v any) bool {
name, okName := k.(string)
if ns, ok := v.(int64); ok && okName && (oldest == 0 || ns < oldest) {
loop, oldest = name, ns
}
return true
})
if oldest == 0 {
return time.Time{}
return "", time.Time{}
}
return time.Unix(0, oldest).UTC()
return loop, time.Unix(0, oldest).UTC()
}
// markPoll stamps the start of a poll pass for one loop, so a hung pass shows
// as stale.
func (d *Daemon) markPoll(loop string) {
d.lastPollAt.Store(loop, time.Now().UnixNano())
// markPass stamps the start of one loop's pass, so a hung pass shows as stale.
func (d *Daemon) markPass(loop string) {
d.loopPasses.Store(loop, time.Now().UnixNano())
}
// errContainerExited is the cancellation cause when a task's agent container
-1
View File
@@ -1 +0,0 @@
package daemon
+77
View File
@@ -5,6 +5,7 @@ import (
"log/slog"
"runtime"
"sync"
"sync/atomic"
"testing"
"time"
@@ -573,3 +574,79 @@ func TestDrainPassDoesNotWaitForItsTasks(t *testing.T) {
t.Fatal("WaitForTasks did not return after the task finished")
}
}
// countingTasks is an empty stream that counts how often a pass waits on it.
type countingTasks struct {
stubTasks
fetches atomic.Int32
}
func (c *countingTasks) Fetch(context.Context) (eventbus.Message, error) {
c.fetches.Add(1)
return nil, eventbus.ErrNoMessage
}
// queuedStore hands out its queue of claimed tasks one at a time.
type queuedStore struct {
stubStore
queue []*workflow.Task
}
func (s *queuedStore) ClaimNext(context.Context) (*workflow.Task, error) {
if len(s.queue) == 0 {
return nil, nil
}
task := s.queue[0]
s.queue = s.queue[1:]
return task, nil
}
// A backlog of requeued tasks is claimed without waiting on the empty stream
// between claims. Each wait is a full poll timeout, so after a restart left
// fourteen tasks running the first pass outlasted the systemd watchdog and
// archied was killed.
func TestDrainPassClaimsABacklogWithoutWaitingPerTask(t *testing.T) {
store := &queuedStore{park: func() {}}
for id := range int64(5) {
store.queue = append(store.queue, &workflow.Task{ID: id + 1, Owner: "acme", Repo: "app"})
}
tasks := &countingTasks{}
d := &Daemon{
Cfg: config.NewHolder(config.Config{}),
Log: slog.New(slog.DiscardHandler),
Store: store,
Tasks: tasks,
}
d.drainNATS(context.Background())
d.WaitForTasks()
if len(store.queue) != 0 {
t.Fatalf("%d tasks left unclaimed", len(store.queue))
}
if got := tasks.fetches.Load(); got != 1 {
t.Fatalf("the pass waited on the stream %d times for 5 claims, want 1", got)
}
}
// A drain pass claims only what the dispatcher can run. Submit never blocks,
// so claiming past capacity marked the whole requeued backlog as running while
// the tasks sat waiting on slots.
func TestDrainPassClaimsOnlyWhatTheDispatcherCanRun(t *testing.T) {
release := make(chan struct{})
defer close(release)
store := &queuedStore{park: func() { <-release }}
for id := range int64(10) {
store.queue = append(store.queue, &workflow.Task{ID: id + 1, Owner: "acme", Repo: "app"})
}
cfg := config.Config{}
cfg.Containers.MaxConcurrency = 2
d := &Daemon{
Cfg: config.NewHolder(cfg),
Log: slog.New(slog.DiscardHandler),
Store: store,
Tasks: &countingTasks{},
}
d.drainNATS(context.Background())
if got := len(store.queue); got != 8 {
t.Fatalf("pass left %d tasks unclaimed, want 8", got)
}
}
-1
View File
@@ -1 +0,0 @@
package daemon
+71
View File
@@ -0,0 +1,71 @@
package daemon
import (
"context"
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/forge"
)
type taskLookup struct {
storecontract.TaskStore
have map[int]bool
}
func (s taskLookup) TaskByIssue(_ context.Context, _, _ string, number int) (*workflow.Task, error) {
if s.have[number] {
return &workflow.Task{IssueNumber: number}, nil
}
return nil, nil
}
type publishCounter struct {
stubTasks
published int
}
func (p *publishCounter) PublishUnique(context.Context, string, string, []byte) error {
p.published++
return nil
}
// One poll creates at most the cap of tasks; the rest wait for a later poll,
// and an issue that already has a task neither counts nor is created twice.
func TestPublishDiscoveredCap(t *testing.T) {
tests := []struct {
name string
issues int
existing []int
cap int
want int
}{
{"cap below backlog", 10, nil, 3, 3},
{"backlog below cap", 2, nil, 3, 2},
{"existing tasks do not use the cap", 6, []int{1, 2}, 3, 3},
{"no cap", 10, nil, 0, 10},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
bus := &publishCounter{}
have := map[int]bool{}
for _, n := range tt.existing {
have[n] = true
}
d := &Daemon{Log: slog.New(slog.DiscardHandler), Store: taskLookup{have: have}, Tasks: bus}
var issues []forge.Issue
for n := 1; n <= tt.issues; n++ {
issues = append(issues, forge.Issue{Number: n, Labels: []string{"archie"}})
}
room := tt.cap
repo := config.Repo{Owner: "acme", Name: "widget"}
d.publishDiscovered(t.Context(), nil, config.Config{}, repo, issues, "", &room)
if bus.published != tt.want {
t.Fatalf("published %d tasks, want %d", bus.published, tt.want)
}
})
}
}
+47
View File
@@ -0,0 +1,47 @@
package daemon
import (
"context"
"log/slog"
"testing"
"time"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
workflowtask "github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/taskstate"
)
type retryStore struct {
storecontract.TaskStore
parked []workflow.Task
retried []int64
}
func (s *retryStore) TasksPage(context.Context, storecontract.TaskPage) ([]workflow.Task, error) {
return s.parked, nil
}
func (s *retryStore) TaskByID(_ context.Context, id int64) (*workflow.Task, error) {
return &workflow.Task{ID: id}, nil
}
func (s *retryStore) RetryTask(_ context.Context, id int64, _, _, _ string, _ workflowtask.Resume, _ bool) error {
s.retried = append(s.retried, id)
return nil
}
func TestRetryTransientParks(t *testing.T) {
old := time.Now().Add(-24 * time.Hour)
store := &retryStore{parked: []workflow.Task{
{ID: 1, ParkClass: taskstate.ParkTransient, UpdatedAt: old},
{ID: 2, ParkClass: taskstate.ParkTransient, UpdatedAt: time.Now()},
{ID: 3, ParkClass: taskstate.ParkNeedsDecision, UpdatedAt: old},
{ID: 4, ParkClass: taskstate.ParkTransient, RetryCount: taskstate.MaxTransientRetries, UpdatedAt: old},
}}
d := &Daemon{Store: store, Log: slog.New(slog.DiscardHandler)}
d.retryTransientParks(t.Context())
if len(store.retried) != 1 || store.retried[0] != 1 {
t.Fatalf("retried = %v, want only task 1 (due, transient, retries left)", store.retried)
}
}
-4
View File
@@ -56,10 +56,6 @@ func (s *orgBindingStore) ListBindings(context.Context) ([]binding.Binding, erro
return s.bindings, nil
}
func (s *orgBindingStore) ArmedBindingsForSource(_ context.Context, source string) ([]binding.Binding, error) {
return slices.DeleteFunc(slices.Clone(s.bindings), func(b binding.Binding) bool { return b.Matcher.Source != source }), nil
}
func (s *orgBindingStore) ListUndispatchedCaptures(_ context.Context, bindings []string, _ int) ([]storecontract.CapturedEvent, error) {
var captures []storecontract.CapturedEvent
for _, b := range s.bindings {
+59
View File
@@ -0,0 +1,59 @@
package access
import "github.com/samcharles93/archie-core/internal/domain/org"
// CanaryGrantID is the ID the canary's scoped grant is known by in the policy
// store and in denial records. A stored policy must not reuse it: the store's
// seeding and the reset command overwrite shipped IDs, and this one is
// installed by the operator from CanaryGrantPolicy's text.
const CanaryGrantID = "org-canary-grant"
// CanaryGrantForbidID is the matching forbid's ID: the grant only scopes the
// canary if everything else it could reach is forbidden, because the identity
// may also carry a role (API-created service accounts are assigned developer)
// whose shipped policy permits broadly within the org. A forbid wins within
// the level, so the pair scopes the identity regardless of its role.
const CanaryGrantForbidID = "org-canary-grant-forbid"
// canaryGrantActions is the exact action surface the canary needs, as one
// Cedar condition shared by the grant's permit and its forbid.
func canaryGrantActions() string {
return `(
(action == Archie::Action::"read" && ["dashboard", "task"].contains(resource.kind)) ||
(action == Archie::Action::"read" && resource == Archie::Object::"update-settings") ||
(action == Archie::Action::"update" && resource == Archie::Object::"update") ||
(action == Archie::Action::"manage_identities" && resource == Archie::Object::"update-settings")
)`
}
func canaryPrincipal(identityID string) string {
return `principal == Archie::Identity::"` + identityID + `"`
}
// CanaryGrantPolicy is the grant a CI canary carries instead of instance
// admin: exactly one named identity may read the dashboard's signal surface
// (chat update, alerts, logs, tasks), read and write the update-settings
// resource, and trigger an update install or deferral. Install it together
// with CanaryGrantForbidPolicy, which forbids the same identity from
// everything else. Every clause is guarded by the resource belonging to the
// principal's own org, which the engine enforces structurally anyway.
func CanaryGrantPolicy(orgID org.OrgID, identityID string) Policy {
text := `permit(principal, action, resource) when {
resource.org == principal.org &&
` + canaryPrincipal(identityID) + ` &&
` + canaryGrantActions() + `
};`
return Policy{ID: CanaryGrantID, Level: LevelOrg, OrgID: orgID, Text: text}
}
// CanaryGrantForbidPolicy forbids the canary identity from everything outside
// CanaryGrantPolicy's surface, so a role assigned to the identity (service
// accounts created through the API carry developer) cannot widen it.
func CanaryGrantForbidPolicy(orgID org.OrgID, identityID string) Policy {
text := `forbid(principal, action, resource) when {
resource.org == principal.org &&
` + canaryPrincipal(identityID) + ` &&
!` + canaryGrantActions() + `
};`
return Policy{ID: CanaryGrantForbidID, Level: LevelOrg, OrgID: orgID, Text: text}
}
+54
View File
@@ -0,0 +1,54 @@
package access
import (
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/domain/org"
)
// TestCanaryGrantPolicy pins the shape of the canary grant: it names exactly
// the one identity it is built for, scoped to the org it serves, so a token
// carrying it cannot act as anyone else or reach another org.
func TestCanaryGrantPolicy(t *testing.T) {
p := CanaryGrantPolicy(org.DefaultOrgID, "canary-svc")
if err := p.Validate(); err != nil {
t.Fatalf("Validate: %v", err)
}
if p.ID != CanaryGrantID || p.Level != LevelOrg || p.OrgID != org.DefaultOrgID {
t.Fatalf("policy = %+v, want ID %q at org level in %q", p, CanaryGrantID, org.DefaultOrgID)
}
if !strings.Contains(p.Text, `principal == Archie::Identity::"canary-svc"`) {
t.Fatalf("text does not name the canary identity:\n%s", p.Text)
}
other := CanaryGrantPolicy(org.DefaultOrgID, "another")
if strings.Contains(other.Text, "canary-svc") || !strings.Contains(other.Text, `Archie::Identity::"another"`) {
t.Fatalf("grant for another identity must name that identity only:\n%s", other.Text)
}
}
// TestCanaryGrantForbidPolicy pins the forbid that keeps a role assigned to
// the canary identity from widening the grant: it names the same identity and
// negates exactly the permit's action surface.
func TestCanaryGrantForbidPolicy(t *testing.T) {
permit := CanaryGrantPolicy(org.DefaultOrgID, "canary-svc")
forbid := CanaryGrantForbidPolicy(org.DefaultOrgID, "canary-svc")
if err := forbid.Validate(); err != nil {
t.Fatalf("Validate: %v", err)
}
if forbid.ID != CanaryGrantForbidID || forbid.Level != LevelOrg || forbid.OrgID != org.DefaultOrgID {
t.Fatalf("forbid = %+v, want ID %q at org level in %q", forbid, CanaryGrantForbidID, org.DefaultOrgID)
}
if !strings.HasPrefix(forbid.Text, "forbid(") {
t.Fatalf("forbid text must be a forbid:\n%s", forbid.Text)
}
if !strings.Contains(forbid.Text, `principal == Archie::Identity::"canary-svc"`) {
t.Fatalf("forbid does not name the canary identity:\n%s", forbid.Text)
}
// The forbid must negate the permit's surface, not the permit itself.
permitBody := strings.TrimSuffix(strings.SplitN(permit.Text, "when {", 2)[1], "};")
forbidBody := strings.TrimSuffix(strings.SplitN(forbid.Text, "when {", 2)[1], "};")
if !strings.Contains(forbidBody, "!"+canaryGrantActions()) {
t.Fatalf("forbid does not negate the grant's action surface:\npermit:%s\nforbid:%s", permitBody, forbidBody)
}
}
+7 -1
View File
@@ -4,6 +4,7 @@ package applystatus
import (
"context"
"errors"
"log/slog"
"maps"
"slices"
@@ -166,7 +167,12 @@ func (r *Reporter) restamp(ctx context.Context) {
}
func (r *Reporter) write(ctx context.Context, status storecontract.ApplyStatus) {
if err := r.store.PutApplyStatus(ctx, status); err != nil {
err := r.store.PutApplyStatus(ctx, status)
switch {
case err == nil:
case errors.Is(err, context.Canceled):
r.log.DebugContext(ctx, "apply status not reported; cancelled", "kind", status.Kind)
default:
r.log.WarnContext(ctx, "apply status not reported", "kind", status.Kind, "err", err)
}
}
+13 -1
View File
@@ -13,6 +13,10 @@ import (
// registry's activity surface and events.
const ActionToolCalled = "tool.called"
// ActionSummary is the Action.Type recorded for the pass's final text: the
// report a definition pass produces, kept inspectable in the activity trail.
const ActionSummary = "pass.summary"
// defaultDefinitionMaxSteps bounds the model/tool loop of one definition pass.
const defaultDefinitionMaxSteps = 10
@@ -84,7 +88,7 @@ func (e *DefinitionEngine) Pass(ctx context.Context, in PassInput) (PassResult,
return PassResult{}, err
}
actions := make([]Action, 0, len(res.ToolCalls))
actions := make([]Action, 0, len(res.ToolCalls)+1)
for _, call := range res.ToolCalls {
actions = append(actions, Action{
At: e.host.Clock.Now(),
@@ -93,6 +97,14 @@ func (e *DefinitionEngine) Pass(ctx context.Context, in PassInput) (PassResult,
Reason: in.Reason,
})
}
if summary := strings.TrimSpace(res.Text); summary != "" {
actions = append(actions, Action{
At: e.host.Clock.Now(),
Type: ActionSummary,
Detail: summary,
Reason: in.Reason,
})
}
return PassResult{Actions: actions}, nil
}
Loaded 100 of 553 files, more files were not shown because too many files have changed in this diff. Show more