Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3e64e5485 | ||
|
|
13ec693726
|
||
|
|
e3ffefdc7d
|
||
|
|
04798b990a
|
||
|
|
0e889977c0
|
||
|
|
47e3d8d837 | ||
|
|
9a9629400e | ||
|
|
0525edd3bb
|
||
|
|
82313e4af5
|
||
|
|
e34941b1eb
|
||
|
|
67c9b7a00a
|
||
|
|
20ffe63367
|
||
|
|
bcbd09fc08
|
||
|
|
a3fdbddfc0
|
||
|
|
70eef0ec99
|
||
|
|
96236b6186
|
||
|
|
e75d5c8ade
|
||
|
|
f44db54948
|
||
|
|
44b52c54c0
|
||
|
|
ec79c8123e
|
||
|
|
4b0adac674
|
||
|
|
dc2c3b983f
|
||
|
|
e3dc7fc2e9
|
||
|
|
2ae471398b
|
||
|
|
6437c8009c
|
||
|
|
f9b6077595
|
||
|
|
00f62a5772
|
||
|
|
3db75f9e28
|
||
|
|
f27e9853cc
|
||
|
|
561863613f
|
||
|
|
fce5fab2a1
|
||
|
|
3b840d7847
|
||
|
|
8e5d4e8061
|
||
|
|
c98666d6b7
|
||
|
|
055f2da9cd
|
||
|
|
fd14b8d358
|
||
|
|
2365e5ede9
|
||
|
|
c9248a251a
|
||
|
|
eb4b2fab5a
|
||
|
|
e0eb1dfdb7
|
||
|
|
031291a4bf
|
||
|
|
618b22db15
|
||
|
|
fc50b026cf
|
||
|
|
e9f5d136b4
|
||
|
|
403d5f8427
|
||
|
|
5539835dd6
|
||
|
|
b16dd6add4
|
||
|
|
a053d98d7c
|
||
|
|
f5a04ce8c5
|
||
|
|
9616dd72ce
|
||
|
|
6871abd7ee
|
||
|
|
32fcbf1a2b
|
||
|
|
632ceb0f85
|
||
|
|
5414405ceb
|
||
|
|
cdbdbbc72d | ||
|
|
2a04abb84e
|
||
|
|
98f5af3eef
|
||
|
|
d1b1bac4fb
|
||
|
|
45b368af2e
|
||
|
|
0f6448c048
|
||
|
|
b15858adc9
|
||
|
|
1ef576ca7b
|
||
|
|
50cb0b4276
|
||
|
|
472478cf83
|
||
|
|
90c7d137fb
|
||
|
|
2d51cf5106
|
||
|
|
1167f8a51e
|
||
|
|
17e6e66e72
|
||
|
|
fa76f4c994
|
||
|
|
21a523bd35
|
||
|
|
db377380a0
|
||
|
|
81fcea7a03
|
||
|
|
011d22c24c
|
||
|
|
83c8614418
|
||
|
|
ac98b68bda
|
||
|
|
ad63692781
|
||
|
|
090b220d25
|
||
|
|
514219b6a5
|
||
|
|
6a5ba67cf5
|
||
|
|
c09ece6064
|
||
|
|
43ba64684e
|
||
|
|
67fa57008e
|
||
|
|
074ebbd931
|
||
|
|
10d23e3e06
|
||
|
|
6a4e1964f6
|
||
|
|
5939ef6ff1
|
||
|
|
1d9eff6529
|
||
|
|
6ae7f319cb
|
||
|
|
260e9fc46e
|
||
|
|
52b5740c39
|
||
|
|
d11a0cd245
|
||
|
|
860b2c85e0
|
||
|
|
af7577625f
|
||
|
|
617a312ed5
|
||
|
|
a7d202fb04
|
||
|
|
2a52508a5d
|
||
|
|
98fb9dfddf
|
||
|
|
64bb195700
|
||
|
|
c8a46fd9e7
|
||
|
|
93db9a6395
|
||
|
|
89808d0719
|
||
|
|
ef99b7d74e
|
||
|
|
62ddbea0c1
|
||
|
|
b548cabcbf
|
||
|
|
8f37cc79cd
|
||
|
|
031521550a
|
||
|
|
3b67ef746f | ||
|
|
18838105f0
|
||
|
|
d70596f4bf | ||
|
|
a9878c329d | ||
|
|
558659bcf4 | ||
|
|
00e7603932 | ||
|
|
33f7323eb0 | ||
|
|
184038a918
|
||
|
|
8cb76092b6 | ||
|
|
49d7619ba3
|
||
|
|
ae53e83ff3 | ||
|
|
ef84e18f46
|
||
|
|
cf1be16763
|
||
|
|
cc8428643a
|
||
|
|
70251ff3ce | ||
|
|
76dc34a17c
|
||
|
|
a6a0c7c11e
|
||
|
|
f759387eb7
|
||
|
|
21b3591da1
|
||
|
|
e9937ded6b
|
||
|
|
bd1acdd0cc
|
||
|
|
a2c6341544
|
||
|
|
cb3372ac76
|
||
|
|
48e605a545
|
||
|
|
9a4e59f0e0
|
||
|
|
820beda72f
|
||
|
|
c6f70de82d
|
||
|
|
f37f6e2453
|
||
|
|
f7a999e317
|
||
|
|
45494d5b43
|
||
|
|
9ca9545847
|
||
|
|
fa14e7da80
|
||
|
|
12eea5eee3
|
||
|
|
ef623f6c68
|
||
|
|
ee2d19d011
|
||
|
|
53c6b3e413
|
||
|
|
d58125c0bc
|
||
|
|
029198ff61
|
||
|
|
0b08fc5242
|
||
|
|
93609c7ab3
|
||
|
|
461d3dc1f7
|
||
|
|
94f79177a2
|
||
|
|
9169e9db09
|
||
|
|
0d0cd09124
|
||
|
|
0dc5bf9a9b
|
||
|
|
ca107f6977
|
||
|
|
4dad1415e6
|
||
|
|
5bf0a696c6
|
||
|
|
7a8d948fcb
|
||
|
|
d90f7d48d0
|
||
|
|
c5a43f21aa
|
||
|
|
d3fbb0842f
|
||
|
|
dafd426316
|
||
|
|
bec374aa92
|
||
|
|
85b21578d8
|
||
|
|
03c25e7214
|
||
|
|
c30624a59e
|
||
|
|
3cf025fb4a
|
||
|
|
81b784876b
|
||
|
|
6c42f64bfa | ||
|
|
d74216c6b7
|
||
|
|
0b7ce448ab
|
||
|
|
2fb8c09a00
|
||
|
|
0442f1849f
|
||
|
|
cf049797b0
|
||
|
|
18e6fe6af6
|
||
|
|
e8a84d3e41
|
||
|
|
c5f4541cbf
|
||
|
|
369e5038ca
|
||
|
|
66862a1bab
|
||
|
|
25dcdb2d19
|
||
|
|
1830a89898
|
||
|
|
6e718e165a
|
||
|
|
0a37b551f5
|
||
|
|
864b87faa6
|
||
|
|
d55d8580cf
|
||
|
|
63229d1711
|
||
|
|
56044476fc | ||
|
|
796bfd0045
|
||
|
|
abcb72a76a
|
||
|
|
443a7a501b
|
||
|
|
88e86776e8
|
||
|
|
e10bb161fe
|
||
|
|
3b525b7482
|
||
|
|
c2cc10ebfa
|
||
|
|
2f8076d7f8
|
||
|
|
c180a2debb
|
||
|
|
5356745968
|
||
|
|
5b5059615b
|
||
|
|
bca1f3b412 | ||
|
|
3af96fd818
|
||
|
|
1043982529
|
||
|
|
6abfe32540 | ||
|
|
1f9807a99c
|
||
|
|
b2edf1fa8b
|
||
|
|
bb897e76b8 | ||
|
|
07062352b4 | ||
|
|
856c15858b
|
||
|
|
69a46249cc
|
||
|
|
6f10ecc04f
|
||
|
|
d6ca6a72a5
|
||
|
|
243832fee6
|
||
|
|
e8c2c844a8
|
||
|
|
6220387ed6
|
||
|
|
efd3eb2854
|
||
|
|
c78063eba0 | ||
|
|
0e931485a0
|
||
|
|
1bf536d4ab
|
||
|
|
2181b5fd08
|
||
|
|
a4a7c96da6
|
||
|
|
a7f6e517ad
|
||
|
|
812d9004a7
|
||
|
|
ebc6dd67e6
|
No files matched your search
@@ -0,0 +1,49 @@
|
||||
name: canary
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "*/15 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: canary
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
judge:
|
||||
if: vars.CANARY_URL != ''
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
|
||||
- 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: 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
|
||||
+54
-107
@@ -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,11 +35,33 @@ 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
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
@@ -84,27 +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. This step used to inline
|
||||
# its own list, which drifted weaker than `task check`: it ran no
|
||||
# db:check, news:check or ui:check, so a release could ship stale
|
||||
# generated SQL, a stale ui/dist, or release notes that disagree with
|
||||
# CHANGELOG.md. It also ran the dashboard suite here rather than in the
|
||||
# gate, where test:ui runs it with the type check. 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
|
||||
@@ -134,12 +122,11 @@ jobs:
|
||||
if [ $fail -ne 0 ]; then
|
||||
echo
|
||||
echo "A release tag points at this commit but its changelog does not"
|
||||
echo "describe that version. Run: task release:prepare VERSION=<ver>"
|
||||
echo "edit the generated notes, then: task release VERSION=<ver>"
|
||||
echo "describe that version. Cut releases with the release workflow."
|
||||
exit 1
|
||||
fi
|
||||
if ! git tag --points-at HEAD | grep -qE '^v[0-9]' ; then
|
||||
echo "This commit is not a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest release."
|
||||
echo "This commit isn't a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest promoted release."
|
||||
fi
|
||||
|
||||
archied-image:
|
||||
@@ -151,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: |
|
||||
@@ -170,35 +154,18 @@ 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 RELEASE, so only a commit that IS one
|
||||
# publishes it. A push to main publishes :edge (mutable, newest main)
|
||||
# and sha-<sha> (immutable) instead. That is what stops a release's
|
||||
# :latest stamping from being overwritten minutes later by the next
|
||||
# ordinary commit, which left a host reporting dev and made the update
|
||||
# path unable to tell current from stale (archie-core-i5nb).
|
||||
#
|
||||
# `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
|
||||
echo "git.catlow.cloud/sam/archied:latest"
|
||||
echo "git.catlow.cloud/sam/archied:$RELEASE_TAG"
|
||||
fi
|
||||
echo "git.catlow.cloud/sam/archied:edge"
|
||||
echo "git.catlow.cloud/sam/archied:sha-${{ steps.commit.outputs.sha }}"
|
||||
@@ -218,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 }}
|
||||
@@ -230,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: |
|
||||
@@ -261,30 +226,16 @@ jobs:
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
git.catlow.cloud/sam/archie-agent:latest
|
||||
git.catlow.cloud/sam/archie-agent:${{ steps.versions.outputs.release_tag }}
|
||||
git.catlow.cloud/sam/archie-agent:sha-${{ steps.commit.outputs.sha }}
|
||||
build-args: |
|
||||
RUNTIME_VERSION=${{ steps.versions.outputs.runtime }}
|
||||
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
|
||||
@@ -294,10 +245,26 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
package_json_file: ui/package.json
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Build the dashboard
|
||||
working-directory: ui
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
|
||||
- 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:
|
||||
@@ -306,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
|
||||
@@ -339,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"
|
||||
@@ -352,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>, next, and stable
|
||||
# unless it is a prerelease.
|
||||
- name: Log in to the Gitea registry
|
||||
run: echo "${{ secrets.DEPLOY_TOKEN }}" | docker login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
@@ -373,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 }}
|
||||
@@ -395,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")" \
|
||||
@@ -403,9 +347,12 @@ jobs:
|
||||
"$api/repos/$repo/releases" >/dev/null
|
||||
echo "published release notes for $tag"
|
||||
|
||||
# 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: 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 }}"
|
||||
|
||||
- name: Link the packages to this repository
|
||||
env:
|
||||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
@@ -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
|
||||
@@ -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: |
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
description: "major, minor, patch, or an exact version such as 1.57.0"
|
||||
required: true
|
||||
default: minor
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
cut:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- 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:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: false
|
||||
|
||||
- name: Install Task
|
||||
run: go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
|
||||
- name: Cut the release
|
||||
env:
|
||||
RELEASE: ${{ inputs.release }}
|
||||
run: |
|
||||
git config user.name "Sam Catlow"
|
||||
git config user.email "sam@catlow.tech"
|
||||
task release RELEASE="$RELEASE"
|
||||
|
||||
- name: Push the release
|
||||
run: git push --atomic origin main "$(git describe --exact-match --match 'v*' HEAD)"
|
||||
+3
-1
@@ -25,7 +25,7 @@ config.production.toml
|
||||
/ui/node_modules/
|
||||
/ui/.vite/
|
||||
/ui/*.tsbuildinfo
|
||||
# ui/dist IS committed: the Go build must not need a Node toolchain.
|
||||
/ui/dist/
|
||||
|
||||
# air live-reload
|
||||
/.air/
|
||||
@@ -47,3 +47,5 @@ __pycache__/
|
||||
|
||||
# Local symlink to the archipelago marketplace repo
|
||||
/archipelago
|
||||
.agents-run/
|
||||
/.pnpm-store/
|
||||
+15
-1
@@ -82,8 +82,22 @@ linters:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archiegateway", desc: "the Gateway is another service"}
|
||||
- {pkg: "github.com/nats-io", desc: "the State Store serves gRPC only"}
|
||||
dashboard-service:
|
||||
files: ["**/internal/webui/**", "**/internal/app/archieui/**", "**/cmd/archie-ui/**"]
|
||||
deny:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/container", desc: "only the daemon owns containers"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "only the daemon owns containers"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/app/archied", desc: "the daemon is another service"}
|
||||
messaging-service:
|
||||
files: ["**/internal/app/archiemessaging/**", "**/cmd/archie-messaging/**"]
|
||||
deny:
|
||||
- {pkg: "github.com/jackc/pgx", desc: "reach the State Store through its contract"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/postgres", desc: "reach the State Store through its contract"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore", desc: "reach the State Store through its contract"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/domain/workflow", desc: "the workflow engine is the daemon's"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/agentexec", desc: "agent execution is the daemon's"}
|
||||
shared:
|
||||
files: ["**/internal/app/servicekit/**", "**/internal/app/chattask/**"]
|
||||
files: ["**/internal/app/servicekit/**"]
|
||||
deny:
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/daemon", desc: "shared code must not pull in a service"}
|
||||
- {pkg: "github.com/samcharles93/archie-core/internal/webui", desc: "shared code must not pull in a service"}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Generated output: only its generator writes it, and the gate byte-checks it.
|
||||
docs/data/generated/
|
||||
internal/contracts/
|
||||
ui/dist/
|
||||
@@ -0,0 +1,51 @@
|
||||
# Canary judge: check the release the canary is running, then promote it, pick
|
||||
# up a newer `next`, or roll it back. Every fifteen minutes, and on demand.
|
||||
#
|
||||
# Requires repo secrets canary_url, canary_token and deploy_token (the registry
|
||||
# credentials the `-latest` re-tagging needs). canary_window is optional.
|
||||
# Shell-side references are written $$name (see the note in deploy.yaml).
|
||||
#
|
||||
# Written to fail loudly when canary_url is missing: the schedule only exists
|
||||
# because the maintainer asked for one, so a canary nobody configured is a
|
||||
# misconfiguration, not a quiet skip.
|
||||
|
||||
when:
|
||||
- event: [cron]
|
||||
- event: [manual]
|
||||
|
||||
# A judging run takes longer than the interval when the canary is unhealthy;
|
||||
# overlapping runs would judge the same release twice.
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
- name: judge
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
CANARY_WINDOW:
|
||||
from_secret: canary_window
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to judge"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- |
|
||||
set -eu
|
||||
set --
|
||||
if [ -n "$$CANARY_WINDOW" ]; then
|
||||
set -- -window "$$CANARY_WINDOW"
|
||||
fi
|
||||
/tmp/archied release canary check -dashboard "$$CANARY_URL" "$$@" \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -0,0 +1,333 @@
|
||||
# Publish pipeline: a push to main builds the edge images, a v* tag also cuts a
|
||||
# signed release. The release workflow pushes main and the tag in one command,
|
||||
# so both events are delivered for the same commit; `plan` decides which
|
||||
# pipeline does the work and the other one skips.
|
||||
#
|
||||
# Requires repo secrets: deploy_token (pushes images, publishes the Gitea
|
||||
# release, links the packages) and release_signing_key (the ed25519 seed the
|
||||
# release statement is signed with). canary_url and canary_token are optional;
|
||||
# without them the canary install is skipped.
|
||||
#
|
||||
# Every shell-side reference is written $$name, which arrives at the shell as
|
||||
# $name. Woodpecker rewrites only the braced form: ${name} is substituted before
|
||||
# the shell runs, and an operator inside it is dropped, so ${version:-none}
|
||||
# becomes empty instead of defaulting. The escaped form is used everywhere so the
|
||||
# rule is mechanical rather than a judgement per line.
|
||||
|
||||
when:
|
||||
- event: push
|
||||
branch: [main]
|
||||
- event: tag
|
||||
ref: refs/tags/v*
|
||||
|
||||
# Two deployments at once would race on the released tags and on `latest`.
|
||||
concurrency: 1
|
||||
|
||||
variables:
|
||||
# The gate and the distribution step both build the dashboard. Anchored here
|
||||
# rather than written twice, so the digest and the pnpm version can only
|
||||
# change in one place.
|
||||
- &node-setup |
|
||||
set -eu
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends xz-utils
|
||||
curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz
|
||||
echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c -
|
||||
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
||||
# pnpm's version belongs to the lockfile; installing any other one makes
|
||||
# `pnpm install --frozen-lockfile` reject the tree.
|
||||
npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')"
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# A tag pipeline must see the tag it is building, and a branch pipeline
|
||||
# must see a tag pointing at HEAD to know the tag pipeline owns it.
|
||||
tags: true
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: plan
|
||||
image: alpine:3
|
||||
commands:
|
||||
- apk add --no-cache git
|
||||
- |
|
||||
set -eu
|
||||
# An annotated tag makes CI_COMMIT_SHA the tag object, so the commit is
|
||||
# resolved from the ref: image tags and the release statement pin it.
|
||||
sha=$(git rev-parse "$$CI_COMMIT_REF^{commit}")
|
||||
version=$(git tag --points-at HEAD --list 'v*' | sed -e 's|^v||' | sort -V | tail -1)
|
||||
run=true
|
||||
case "$$CI_PIPELINE_EVENT" in
|
||||
tag) ;;
|
||||
*) [ -z "$$version" ] || run=false ;;
|
||||
esac
|
||||
{
|
||||
echo "COMMIT_SHA=$$sha"
|
||||
echo "RELEASE_VERSION=$$version"
|
||||
echo "RUN=$$run"
|
||||
} > "$$CI_WORKSPACE/.git/ci-plan.env"
|
||||
echo "commit $$sha, release $${version:-none}, run $$run"
|
||||
|
||||
- name: gate
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [plan]
|
||||
# The full test suite starts containers. It drives the host daemon through
|
||||
# the Go client, so the socket is enough - this step needs no docker CLI.
|
||||
# The one test that needs the daemon binds a temporary directory into the
|
||||
# container it starts, so that directory has to exist at the same path on
|
||||
# the host; TMPDIR points the test at it.
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /var/tmp/woodpecker-archie-gate:/var/tmp/woodpecker-archie-gate
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
TMPDIR: /var/tmp/woodpecker-archie-gate
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "a release tag owns this commit; the tag pipeline publishes it"; exit 0; }'
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
||||
- go install mvdan.cc/gofumpt@v0.11.0
|
||||
- bash tools/proto.sh install
|
||||
- *node-setup
|
||||
- |
|
||||
set -eu
|
||||
if ! git show-ref --verify --quiet refs/heads/main; then
|
||||
if git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
git branch main origin/main
|
||||
else
|
||||
# A tag pipeline clones the tag alone. HEAD is the released commit,
|
||||
# which was on main, so the contract baseline is that same tree.
|
||||
echo "no origin/main in this clone; using the released commit as the contract baseline"
|
||||
git branch main HEAD
|
||||
fi
|
||||
fi
|
||||
- task check TEST_FLAGS=-count=1
|
||||
- git diff --exit-code
|
||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
- govulncheck ./...
|
||||
- |
|
||||
set -eu
|
||||
fail=0
|
||||
for tag in $(git tag --points-at HEAD); do
|
||||
case "$$tag" in
|
||||
v*)
|
||||
ver=$(echo "$$tag" | sed -e 's|^v||')
|
||||
echo " release tag $$tag -> looking for [$$ver] in CHANGELOG.md"
|
||||
grep -q "^## \[$$ver\]" CHANGELOG.md || {
|
||||
echo " FAIL: CHANGELOG.md has no [$$ver] section"
|
||||
fail=1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $$fail -ne 0 ]; then
|
||||
echo
|
||||
echo "A release tag points at this commit but its changelog does not"
|
||||
echo "describe that version. Cut releases with the release workflow."
|
||||
exit 1
|
||||
fi
|
||||
if ! git tag --points-at HEAD | grep -qE '^v[0-9]'; then
|
||||
echo "This commit isn't a release, so the images are published as :edge and sha-<sha>; :latest keeps naming the newest promoted release."
|
||||
fi
|
||||
|
||||
- name: archied-image
|
||||
image: docker:29-cli
|
||||
depends_on: [gate]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
# A release reports its version; anything else is a build of main and
|
||||
# says so, so a running binary can always name its commit.
|
||||
if [ -n "$$RELEASE_VERSION" ]; then
|
||||
component=$$RELEASE_VERSION
|
||||
else
|
||||
component="dev+$(echo "$$COMMIT_SHA" | cut -c1-12)"
|
||||
fi
|
||||
set -- \
|
||||
--tag "git.catlow.cloud/sam/archied:edge" \
|
||||
--tag "git.catlow.cloud/sam/archied:sha-$$COMMIT_SHA"
|
||||
if [ -n "$$RELEASE_VERSION" ]; then
|
||||
set -- "$$@" --tag "git.catlow.cloud/sam/archied:v$$RELEASE_VERSION"
|
||||
fi
|
||||
# No cache flags: the agent's daemon keeps its layer cache between
|
||||
# pipelines, which is what type=gha bought on ephemeral runners.
|
||||
docker buildx build --push --file Dockerfile.archied \
|
||||
--build-arg GATEWAY_VERSION="$$component" \
|
||||
--build-arg RUNTIME_VERSION="$$component" \
|
||||
--provenance=false \
|
||||
"$$@" .
|
||||
|
||||
- name: agent-image
|
||||
image: docker:29-cli
|
||||
depends_on: [gate]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_HOST: unix:///var/run/docker.sock
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; the agent image is only published with a release"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
|
||||
- |
|
||||
set -eu
|
||||
apk add --no-cache jq
|
||||
docker buildx build --push --file Dockerfile \
|
||||
--build-arg RUNTIME_VERSION="$$RELEASE_VERSION" \
|
||||
--tag "git.catlow.cloud/sam/archie-agent:v$$RELEASE_VERSION" \
|
||||
--tag "git.catlow.cloud/sam/archie-agent:sha-$$COMMIT_SHA" \
|
||||
--provenance=false \
|
||||
--metadata-file "$$CI_WORKSPACE/.git/agent-image.json" \
|
||||
.
|
||||
# The release statement pins the agent image by digest, so the digest is
|
||||
# what the distribution records, not the tag.
|
||||
jq -er '."containerimage.digest"' "$$CI_WORKSPACE/.git/agent-image.json" \
|
||||
> "$$CI_WORKSPACE/.git/agent-image.digest"
|
||||
echo "agent image $(cat "$$CI_WORKSPACE/.git/agent-image.digest")"
|
||||
|
||||
- name: dist
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [archied-image, agent-image]
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no distribution to build"; exit 0; }'
|
||||
- apt-get update -qq
|
||||
- apt-get install -y -qq --no-install-recommends jq zip
|
||||
- *node-setup
|
||||
# A subshell: a bare `cd ui` here would leave every later command in this
|
||||
# step building from the dashboard directory.
|
||||
- |
|
||||
set -eu
|
||||
(
|
||||
cd ui
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
)
|
||||
- |
|
||||
set -eu
|
||||
base=github.com/samcharles93/archie-core
|
||||
ldflags="-X $${base}/internal/installtype.buildType=binary -X $${base}/internal/buildinfo.Version=$$RELEASE_VERSION -X $${base}/internal/buildinfo.Runtime=$$RELEASE_VERSION -X $${base}/internal/app/agentworker.version=$$RELEASE_VERSION"
|
||||
cmds=$(jq -r '.required_topology.units[], .required_topology.binaries[]?' release.json)
|
||||
mkdir -p dist
|
||||
for cmd in $$cmds; do
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$$ldflags" -o "dist/$$cmd" "./cmd/$$cmd"
|
||||
done
|
||||
name="archie-core-archied-v$$RELEASE_VERSION-linux-amd64"
|
||||
mkdir -p "$$name"
|
||||
for cmd in $$cmds; do
|
||||
cp "dist/$$cmd" "$$name/"
|
||||
done
|
||||
cp deployments/INSTRUCTIONS.md CHANGELOG.md "$$name/"
|
||||
if [ -f README.md ]; then cp README.md "$$name/"; fi
|
||||
digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest")
|
||||
test -n "$$digest"
|
||||
jq --arg image "git.catlow.cloud/sam/archie-agent@$$digest" '. + {agent_image: $$image}' \
|
||||
release.json > "$$name/release.json"
|
||||
zip -qr "$$name.zip" "$$name"
|
||||
echo "RELEASE_ZIP=$$name.zip" >> "$$CI_WORKSPACE/.git/ci-plan.env"
|
||||
echo "built $$name.zip"
|
||||
|
||||
- name: publish
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [dist]
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
ARCHIE_RELEASE_SEED:
|
||||
from_secret: release_signing_key
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to publish"; exit 0; }'
|
||||
- '[ -n "$$ARCHIE_RELEASE_SEED" ] || { echo "repo secret release_signing_key is not set"; exit 1; }'
|
||||
# archied pushes the release artifact with oras, which reads the registry
|
||||
# credentials a docker login would have written.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- |
|
||||
set -eu
|
||||
prerelease=false
|
||||
case "$$RELEASE_VERSION" in *-*) prerelease=true ;; esac
|
||||
digest=$(cat "$$CI_WORKSPACE/.git/agent-image.digest")
|
||||
./dist/archied release publish -source git.catlow.cloud/sam/archie \
|
||||
-version "$$RELEASE_VERSION" -prerelease="$$prerelease" \
|
||||
-zip "$$RELEASE_ZIP" \
|
||||
-agent-image "git.catlow.cloud/sam/archie-agent@$$digest" \
|
||||
-changelog "https://git.catlow.cloud/sam/archie/releases/tag/v$$RELEASE_VERSION"
|
||||
|
||||
- name: notes
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [dist]
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; no notes to publish"; exit 0; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set"; exit 1; }'
|
||||
- apt-get update -qq
|
||||
- apt-get install -y -qq --no-install-recommends jq
|
||||
- |
|
||||
set -eu
|
||||
tag="v$$RELEASE_VERSION"
|
||||
notes=$(mktemp)
|
||||
awk -v hdr="## [$$RELEASE_VERSION]" '
|
||||
index($$0, hdr) == 1 { printing = 1 }
|
||||
printing && /^## \[/ && index($$0, hdr) != 1 { exit }
|
||||
printing { print }
|
||||
' CHANGELOG.md > "$$notes"
|
||||
if ! [ -s "$$notes" ]; then
|
||||
echo "no [$$RELEASE_VERSION] section extracted from CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
api=https://git.catlow.cloud/api/v1
|
||||
repo=sam/archie
|
||||
auth="Authorization: token $$DEPLOY_TOKEN"
|
||||
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$$RELEASE_VERSION" --arg body "$(cat "$$notes")" \
|
||||
'{tag_name: $$tag, name: $$name, body: $$body, draft: false, prerelease: false}')" \
|
||||
"$$api/repos/$$repo/releases" >/dev/null
|
||||
echo "published release notes for $$tag"
|
||||
# The packages exist under this repository's namespace but are not
|
||||
# linked to it, so the package pages stay empty until this runs.
|
||||
for name in archied archie-agent archie; do
|
||||
curl -sS -o /dev/null -X POST -H "$$auth" \
|
||||
"$$api/packages/sam/container/$$name/-/link/archie" || true
|
||||
done
|
||||
|
||||
- name: canary
|
||||
image: golang:1.27.3-bookworm
|
||||
depends_on: [publish]
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
commands:
|
||||
- '. "$$CI_WORKSPACE/.git/ci-plan.env"'
|
||||
- '[ "$$RUN" = true ] || { echo "skipped: the tag pipeline publishes this commit"; exit 0; }'
|
||||
- '[ -n "$$RELEASE_VERSION" ] || { echo "not a release; nothing to install on the canary"; exit 0; }'
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "canary_url is not set; skipping the canary install"; exit 0; }'
|
||||
- ./dist/archied release canary start -dashboard "$$CANARY_URL" -version "$$RELEASE_VERSION"
|
||||
@@ -0,0 +1,41 @@
|
||||
# Manual promotion: move stable to the release the canary is running, without
|
||||
# waiting for its verdict. Same rules as the canary's own promotion, minus the
|
||||
# window.
|
||||
#
|
||||
# Start it with the pipeline variable VERSION set to the release the canary
|
||||
# runs (woodpecker-cli pipeline create --branch main --var VERSION=1.57.0).
|
||||
#
|
||||
# Requires repo secrets canary_url, canary_token and deploy_token.
|
||||
|
||||
when:
|
||||
- event: [manual]
|
||||
|
||||
concurrency: 1
|
||||
|
||||
steps:
|
||||
- name: promote
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
CANARY_URL:
|
||||
from_secret: canary_url
|
||||
ARCHIE_CANARY_TOKEN:
|
||||
from_secret: canary_token
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$VERSION" ] || { echo "VERSION is empty: start this workflow with the pipeline variable VERSION=<release the canary runs>"; exit 1; }'
|
||||
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to read"; exit 1; }'
|
||||
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
|
||||
- go build -tags no_ui -o /tmp/archied ./cmd/archied
|
||||
# archied reads the registry credentials a docker login would have
|
||||
# written; this step has no docker CLI, so the file is written directly.
|
||||
- |
|
||||
set -eu
|
||||
mkdir -p "$$HOME/.docker"
|
||||
auth=$(printf '%s:%s' "$$CI_REPO_OWNER" "$$DEPLOY_TOKEN" | base64 -w0)
|
||||
printf '{"auths":{"git.catlow.cloud":{"auth":"%s"}}}\n' "$$auth" > "$$HOME/.docker/config.json"
|
||||
- >-
|
||||
/tmp/archied release canary promote -dashboard "$$CANARY_URL"
|
||||
-version "$$VERSION"
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
@@ -0,0 +1,60 @@
|
||||
# Pull-request gate: the same `task check` the maintainer runs locally.
|
||||
#
|
||||
# One step, not one step per check: `task check` installs task, golangci-lint,
|
||||
# gofumpt, buf and sqlc into the container it runs in, and a second step starts
|
||||
# from an empty container and pays for that again.
|
||||
|
||||
when:
|
||||
- event: [pull_request]
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# The gate compares the contracts against main and reads the release tags
|
||||
# for the version a build reports, so a partial clone will not do.
|
||||
tags: true
|
||||
# A pull-request pipeline otherwise clones only the pull request's own
|
||||
# ref, leaving no main for the contract baseline to compare against.
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: check
|
||||
image: golang:1.27.3-bookworm
|
||||
commands:
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(cat .golangci-version)
|
||||
- go install mvdan.cc/gofumpt@v0.11.0
|
||||
- bash tools/proto.sh install
|
||||
# The gate builds and tests the dashboard, so Node and pnpm sit next to
|
||||
# Go. Pinned tarball verified by digest, not a third-party setup script:
|
||||
# the gate must not change under the repository.
|
||||
- |
|
||||
set -eu
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends xz-utils
|
||||
curl -fsSL -o /tmp/node.tar.xz https://nodejs.org/dist/v24.22.2/node-v24.22.2-linux-x64.tar.xz
|
||||
echo "48cc0e21e048790e54c0cf5749c2725005313d652651c40b7a21feb9697aaf75 /tmp/node.tar.xz" | sha256sum -c -
|
||||
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1
|
||||
# pnpm's version belongs to the lockfile; installing any other one makes
|
||||
# `pnpm install --frozen-lockfile` reject the tree.
|
||||
npm install -g "pnpm@$(node -p 'require("./ui/package.json").packageManager.split("@")[1]')"
|
||||
node --version
|
||||
pnpm --version
|
||||
- |
|
||||
set -eu
|
||||
# The contract baseline is a local main. plugin-git fetches with an explicit
|
||||
# refspec, so it creates no remote-tracking branch itself; only the target
|
||||
# branch fetch above does, which is why this fails rather than comparing
|
||||
# the pull request against its own tree.
|
||||
if ! git show-ref --verify --quiet refs/heads/main; then
|
||||
if ! git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
echo "no main in this clone, so the contracts cannot be compared against a baseline" >&2
|
||||
exit 1
|
||||
fi
|
||||
git branch main origin/main
|
||||
fi
|
||||
- task --concurrency 1 check
|
||||
# The gate rewrites the tree (fmt, generated contracts and queries); a
|
||||
# rewrite the author did not commit is a failure, not a side effect.
|
||||
- git diff --exit-code
|
||||
@@ -0,0 +1,50 @@
|
||||
# Manual release: turn [Unreleased] in CHANGELOG.md into a release commit, tag
|
||||
# it, and push main and the tag in one command. The deploy pipeline publishes
|
||||
# what this pushes, so this workflow commits and tags but never builds.
|
||||
#
|
||||
# Start it with the pipeline variable RELEASE=minor (or major, patch, or an
|
||||
# exact 1.2.3): woodpecker-cli pipeline create --branch main --var RELEASE=minor
|
||||
# sam/archie, or the same variable in the web UI's pipeline dialog.
|
||||
#
|
||||
# Shell-side references are written $$name (see the note in deploy.yaml).
|
||||
#
|
||||
# Requires repo secret deploy_token, a token that may push to main and to tags.
|
||||
|
||||
when:
|
||||
- event: [manual]
|
||||
|
||||
# Two releases at once would read the same last tag and try to write it twice.
|
||||
concurrency: 1
|
||||
|
||||
clone:
|
||||
git:
|
||||
image: woodpeckerci/plugin-git:2.8.0
|
||||
settings:
|
||||
# `task release` derives the next version from the release tags.
|
||||
tags: true
|
||||
fetch_target_branch: true
|
||||
|
||||
steps:
|
||||
- name: cut
|
||||
image: golang:1.27.3-bookworm
|
||||
environment:
|
||||
DEPLOY_TOKEN:
|
||||
from_secret: deploy_token
|
||||
commands:
|
||||
- '[ -n "$$RELEASE" ] || { echo "RELEASE is empty: start this workflow with the pipeline variable RELEASE=major|minor|patch|x.y.z"; exit 1; }'
|
||||
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the release cannot push its commit and tag"; exit 1; }'
|
||||
- go install github.com/go-task/task/v3/cmd/task@v3.48.0
|
||||
- git config user.name "Sam Catlow"
|
||||
- git config user.email "sam@catlow.tech"
|
||||
- task release RELEASE="$$RELEASE"
|
||||
- |
|
||||
set -eu
|
||||
tag=$(git describe --exact-match --match 'v*' HEAD)
|
||||
# HEAD, not a local main: the clone checks out the fetched ref detached,
|
||||
# so there is no branch to name. The release commit is a child of main,
|
||||
# so this is the fast-forward an atomic push needs.
|
||||
#
|
||||
# Gitea authenticates a token in the password position and ignores the
|
||||
# user name, so the token never has to be a real login.
|
||||
git push --atomic "https://x-access-token:$$DEPLOY_TOKEN@git.catlow.cloud/sam/archie.git" HEAD:refs/heads/main "$$tag"
|
||||
echo "released $$tag"
|
||||
+106
@@ -5,6 +5,112 @@ release's per-component sections are labelled beneath its heading.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.62.0] - 2026-11-10
|
||||
|
||||
### archied
|
||||
|
||||
- When an agent step reaches its step budget, the task asks to continue instead of parking. Approving resumes the stopped step with its conversation, including inside a parallel branch.
|
||||
- A parked task is flagged when the credential, connection or setting its blocker names changes, so you can see which parks are worth retrying.
|
||||
- Merging, closing and issue tools use the repository's own forge connection. A repository on Gitea no longer gets a GitHub 404 when its pull request is merged from archie.
|
||||
- A restart re-queues a running task at the step it was interrupted in, and parks it after three restarts instead of looping.
|
||||
- Issues and pull request review activity from authors without write access are ignored.
|
||||
- A baseline repair made by the repository gate is opened as its own pull request before the task continues.
|
||||
- Closing an issue that still has open dependencies is recorded as refused, rather than parking the task.
|
||||
- When the work volume fills, stale task clones are reclaimed; clones with uncommitted or unpushed work are kept. Clones need 1 GiB free, not 5.
|
||||
- A corrupt repository mirror is rebuilt, and a push that hits a missing object rebuilds the mirror and retries once.
|
||||
- Readiness reports degraded when the run loop stalls.
|
||||
- Execution budgets set in the dashboard are no longer reverted when the model catalogue loads.
|
||||
- A full volume is reported as an environment failure, and an unreachable secret engine as unavailable, rather than as a bad or missing credential.
|
||||
- A park from the workflow identity check now appears in the task log.
|
||||
- Every task records the identity that created it, and its queued event names the task, actor and principal. System is the one instance identity: it polls forge connections and owns the root grants and connection permits the bot-named identity used to hold, which existing tasks, grants and permits move to on upgrade.
|
||||
|
||||
### archie-ui
|
||||
|
||||
- A chat reply is no longer lost when you switch conversation or reload mid-answer: the turn finishes and its reply is in the conversation when you come back. Stop is the only way to cancel it.
|
||||
- The task page offers every action the task list does.
|
||||
- Workflows have row actions, enabling or disabling one confirms with a toast, and the editor toolbar wraps on narrow screens.
|
||||
- The dashboard lists five tasks needing attention, not every one.
|
||||
- Dismiss all no longer covers the unread badge.
|
||||
|
||||
### archie-agent
|
||||
|
||||
- The agent image includes Task, so the repository gate no longer downloads it on every run.
|
||||
|
||||
## [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
|
||||
|
||||
- Running `install.sh` over an install whose services are already running now restarts them, so they run the new binaries.
|
||||
|
||||
## [1.57.0] - 2026-10-31
|
||||
|
||||
### archied
|
||||
|
||||
- A release reaches `stable` only after it has run on a canary for a day and passed: `archied release publish` now publishes to `next` alone, `archied release canary start|check` installs a release on a canary and judges it from the canary's dashboard, promoting it or rolling the canary back, and `archied release promote` moves `stable` by hand. Promotion refuses a prerelease and a release older than the one `stable` names. The `archied` and `archie-agent` images are published as `:v<version>`, and `:latest` moves only when a release is promoted.
|
||||
|
||||
## [1.56.0] - 2026-10-31
|
||||
|
||||
### archied
|
||||
|
||||
@@ -105,7 +105,7 @@ When sources disagree, the higher one wins:
|
||||
- If a fix fails twice, throw the block away and rewrite it simply.
|
||||
- Comments say why, briefly. No migration history, phase names or issue
|
||||
narration in code.
|
||||
- Generated files (`ui/dist/`, protobuf, sqlc) are regenerated and committed
|
||||
- Generated files (protobuf, sqlc) are regenerated and committed
|
||||
with the change that caused them, never hand-edited.
|
||||
|
||||
## Tests
|
||||
|
||||
+24
-1
@@ -58,6 +58,12 @@ 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
|
||||
# Repository gates run `task`; fetching it per run parks the task when the
|
||||
# download fails.
|
||||
ARG TASK_VERSION=3.54.0
|
||||
|
||||
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 +72,12 @@ 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
|
||||
curl -fsSL "https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_amd64.tar.gz" \
|
||||
| tar -xz -C /usr/local/bin task && \
|
||||
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 +85,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.
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
# archied — the archie daemon
|
||||
# Run via docker compose alongside NATS.
|
||||
|
||||
FROM node:24-trixie-slim AS dashboard
|
||||
WORKDIR /src/ui
|
||||
RUN corepack enable
|
||||
COPY ui/package.json ui/pnpm-lock.yaml ui/pnpm-workspace.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY ui/ ./
|
||||
RUN pnpm run build
|
||||
|
||||
FROM golang:1.27-trixie AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY --from=dashboard /src/ui/dist ./ui/dist
|
||||
ARG GATEWAY_VERSION=dev
|
||||
ARG RUNTIME_VERSION=dev
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
|
||||
@@ -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**
|
||||
|
||||
|
||||
+227
-110
@@ -1,141 +1,258 @@
|
||||
# Releasing
|
||||
|
||||
One release stream. `CHANGELOG.md` carries every release section, one generated
|
||||
page per version describes it, and one tag names the release. A release is one
|
||||
version covering whatever changed; the components' entries are labelled sections
|
||||
inside it (`### archied`, `### archie-agent`), not separate numbers or separate
|
||||
pages.
|
||||
page per version describes it, and one `v*` tag names the release. One version
|
||||
covers every process in the host bundle (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`) and the `archie-agent`
|
||||
image; per-component detail is a labelled section inside the version
|
||||
(`### archied`, `### archie-agent`).
|
||||
|
||||
The host bundle ships five processes (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`), and
|
||||
one version covers all of them. `archie-agent`, the per-task sandboxed runtime,
|
||||
ships as a container image and its changes are the `## [version]` release's
|
||||
`### archie-agent` section.
|
||||
A release is cut by CI, published to `next`, run on the canary for a day, and
|
||||
promoted to `stable` only if the canary's signals pass. Nothing is run locally.
|
||||
|
||||
`tools/release.sh` decides which commits a release carries from the package
|
||||
closure of **every shipped binary**, not from commit-message guessing: a change
|
||||
to a package only the messaging service, state store, playbook runner or UI
|
||||
links still lands in the changelog. Read its header comment for how it
|
||||
partitions commits and enforces `main`-only, clean-tree releases.
|
||||
## Notes are written with the change
|
||||
|
||||
## What justifies a version
|
||||
|
||||
`task release:preview VERSION=X.Y.Z` shows exactly what would land, before
|
||||
anything is written. A commit set that justifies no version produces no version:
|
||||
`release.sh` exits **3** with "nothing to release" rather than inventing one, so
|
||||
a pipeline can finish green without tagging.
|
||||
|
||||
Most sessions touch the gateway side (daemon, gateway, web UI, chat, messaging)
|
||||
and leave the agent runtime alone. That is no longer a per-component `skip`
|
||||
decision — one version covers the release — but a runtime code change being
|
||||
merged to `main` is still not the same as it being in production: the
|
||||
`archie-agent` image is rebuilt by the release, and a host that runs the agent
|
||||
must pull the new image (`docker compose pull agent`) to get it.
|
||||
|
||||
## What the notes are for
|
||||
A commit that changes what a reader experiences adds its bullet under
|
||||
`## [Unreleased]` in `CHANGELOG.md`, in the same commit. The release takes that
|
||||
section as it stands, so write the bullet as the release note, not as a commit
|
||||
subject.
|
||||
|
||||
**Release notes describe the reader's experience of what shipped.** The test is
|
||||
the reader, not whether a sentence is negative:
|
||||
|
||||
- A capability that **never existed** leaves no expectation to correct, so a
|
||||
note about it reads as a feature to someone who never had the thing — out.
|
||||
- **The implementation's journey** — what was rebuilt, what a guard finally
|
||||
covers, what a browser API refuses to surface — is not the reader's experience
|
||||
either — out.
|
||||
- A capability that **shipped but is not yet wired** _is_ the reader's
|
||||
note about it reads as a feature to someone who never had the thing: out.
|
||||
- **The implementation's journey** (what was rebuilt, what a guard finally
|
||||
covers, what a browser API refuses to surface) isn't the reader's experience
|
||||
either: out.
|
||||
- A capability that **shipped but isn't yet wired** _is_ the reader's
|
||||
experience, so it belongs, worded as a caveat on the capability and paired
|
||||
with the behaviour that compensates for it.
|
||||
|
||||
Design constraints and withheld capabilities are not release news.
|
||||
Do not apply this mechanically: deleting a caveat a reader needs misleads them,
|
||||
which is the failure this rule exists to prevent.
|
||||
Design constraints and withheld capabilities are not release news. Deleting a
|
||||
caveat a reader needs misleads them, which is the failure this rule exists to
|
||||
prevent.
|
||||
|
||||
## Cutting a release
|
||||
|
||||
```bash
|
||||
task release:preview VERSION=1.3.0 # preview what would land
|
||||
task release:prepare VERSION=1.3.0 # write the section into CHANGELOG.md, uncommitted
|
||||
# edit CHANGELOG.md -- generated notes are a starting point, not the release
|
||||
task release VERSION=1.3.0 # commit + annotated tag
|
||||
git push --atomic origin main v1.3.0 # both refs or neither
|
||||
```
|
||||
Dispatch the **release** workflow (`.github/workflows/release.yml`) with
|
||||
`major`, `minor`, `patch` or an exact version. It runs `task release` on `main`:
|
||||
|
||||
Pushing the tag is the release. The deploy workflow builds the images and the
|
||||
zip, then `archied release publish` signs the release with the
|
||||
`RELEASE_SIGNING_KEY` Actions secret and pushes it to
|
||||
`git.catlow.cloud/sam/archie` as `v1.3.0`, `next`, and `stable` unless the
|
||||
version is a prerelease. `install.sh` and the updater install only what that
|
||||
key signed.
|
||||
1. refuses a dirty tree, an existing tag, or an `[Unreleased]` with no entries;
|
||||
2. turns `[Unreleased]` into `## [x.y.z] - date` under a new empty
|
||||
`[Unreleased]`, and runs `task news`;
|
||||
3. commits `chore(release): vx.y.z` and tags `vx.y.z`;
|
||||
|
||||
`release:prepare` emits bare commit subjects; they are a starting point. Rewrite
|
||||
them to say what a reader gets, per "What the notes are for" above.
|
||||
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.
|
||||
|
||||
Pushing is a separate, explicit step — never push without confirming first (see
|
||||
the repo's general "check before doing anything hard to reverse" rule). The
|
||||
deploy workflow reads tags pointing at `HEAD`; pushing the commit without its
|
||||
tag gets images stamped `dev`, which is why the push names the tag and is
|
||||
`--atomic`.
|
||||
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:
|
||||
|
||||
### After a release, `main` and the working branch have diverged
|
||||
| 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 |
|
||||
|
||||
The release commit lands on `main` — `tools/release.sh` refuses to run anywhere
|
||||
else — while the working branch keeps advancing. So after every release, `main`
|
||||
is ahead by exactly that commit and the branch is ahead by however far it has
|
||||
moved: **neither tip is an ancestor of the other**, and `--ff-only` fails in
|
||||
both directions. That refusal reads as "the tree is not ready" when in fact the
|
||||
tree is fine.
|
||||
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.
|
||||
|
||||
Merge the release commit into the branch first, so any conflict is resolved on
|
||||
the branch, where it is reversible and nobody is reading the tip:
|
||||
|
||||
```bash
|
||||
git merge main # on the branch
|
||||
git merge --ff-only <branch> # then, in whichever worktree holds main
|
||||
```
|
||||
|
||||
Confirm which worktree holds `main` with `git worktree list` before the
|
||||
`--ff-only`. A detached worktree sitting at the same commit will accept it and
|
||||
move nothing, which looks like success.
|
||||
After a release, pull `main` before committing on it again: CI has added the
|
||||
release commit.
|
||||
|
||||
## What a release publishes
|
||||
|
||||
Tagging one version produces, from a single `deploy` run:
|
||||
The tag push runs `deploy.yml`:
|
||||
|
||||
- **Container images** — `git.catlow.cloud/sam/archied:latest` and, on a
|
||||
release tag, `git.catlow.cloud/sam/archie-agent:latest`. The runtime image is
|
||||
rebuilt by the release, so runtime commits merged to `main` do not reach a
|
||||
running sandbox until the host pulls the new image. The hand-run
|
||||
`tools/publish.sh` publishes the same two images to
|
||||
`git.catlow.cloud/sam` instead, which is the registry the binary's default
|
||||
`[containers].image` names.
|
||||
- **`:latest` names the newest release, not the newest commit.** A push to
|
||||
`main` that is not a release publishes `archied:edge` (mutable, tracking
|
||||
`main`) and `archied:sha-<commit>` (immutable) instead, so a release's
|
||||
`:latest` stamping is not overwritten minutes later by the next ordinary
|
||||
commit. A host that runs releases follows `:latest`; a host that tracks `main`
|
||||
follows `:edge`.
|
||||
- **A GitHub Release with a distribution zip** — `dist-zip` builds every process
|
||||
the reference deployment runs (`archied`, `archie-gateway`,
|
||||
`archie-state-store`, `archie-ui`, `archie-messaging`) for
|
||||
linux/amd64, packs them with `deployments/INSTRUCTIONS.md` and `CHANGELOG.md`,
|
||||
and attaches the zip to the Release. The Release body is that version's
|
||||
`## [version]` section of `CHANGELOG.md`.
|
||||
- **Gate.** `task check TEST_FLAGS=-count=1` (uncached, including the
|
||||
Docker-backed tests `-short` skips) and `govulncheck`, then a check that the
|
||||
tag has a `[version]` section in `CHANGELOG.md`.
|
||||
- **Images.** `archied:v<version>` and `archie-agent:v<version>` on a release
|
||||
tag; `archied:edge` and `archied:sha-<commit>` on any other push to `main`.
|
||||
`:latest` moves only on promotion, so it names the newest promoted release.
|
||||
- **The signed release.** `archied release publish` signs a statement
|
||||
(version, issued_at, zip digest, agent image by digest) with
|
||||
`RELEASE_SIGNING_KEY` and pushes it with the distribution zip to
|
||||
`git.catlow.cloud/sam/archie` as `v<version>` and `next`. It never moves
|
||||
`stable`.
|
||||
- **The release-notes page** on Gitea, from that version's `CHANGELOG.md`
|
||||
section, which the statement links to.
|
||||
- **The canary install**: `archied release canary start` points the canary at
|
||||
`next` and installs the release through its dashboard.
|
||||
|
||||
The zip is also uploaded as an Actions artifact, but that is a backup copy:
|
||||
artifacts expire after 90 days and need an Actions login to download. The
|
||||
Release asset is the durable, operator-reachable one.
|
||||
GitHub-style Actions run the workflow from the tagged commit, so a fix to
|
||||
`deploy.yml` reaches a release only if it is an ancestor of the tag. Re-cut the
|
||||
release rather than committing the fix on top of a tagged one.
|
||||
|
||||
## Gate
|
||||
## The canary
|
||||
|
||||
CI (`deploy.yml`) runs `task check TEST_FLAGS=-count=1` before building images,
|
||||
then verifies any release tag at `HEAD` has a matching `[version]` section in
|
||||
`CHANGELOG.md`. The gate has one definition, in the Taskfile: the release runs
|
||||
it with the uncached suite, including the Docker-backed tests `-short` skips.
|
||||
A tag with no changelog entry is a hard failure. No tags at `HEAD` is a
|
||||
warning, not a failure -- images get stamped `dev`.
|
||||
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 the canary actually runs**,
|
||||
not the moving `next` tag:
|
||||
|
||||
One consequence worth knowing when a release commit needs amending: GitHub
|
||||
Actions runs the workflow **from the commit that triggered it**, so a fix to
|
||||
`deploy.yml` only takes effect for a release if it is an ancestor of the tagged
|
||||
commit. Delete and re-cut the tag (`git tag -d`, `task release`) rather than
|
||||
committing the fix on top of an already-tagged release.
|
||||
| Signal | Source | Fails when |
|
||||
| --- | --- | --- |
|
||||
| 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 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 window before the release was installed. With
|
||||
one production host there's no simultaneous control.
|
||||
- **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 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 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
|
||||
|
||||
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.
|
||||
|
||||
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. 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`.
|
||||
|
||||
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 | 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:
|
||||
|
||||
```bash
|
||||
archied release promote -version 1.57.0 \
|
||||
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent
|
||||
```
|
||||
+41
-30
@@ -100,18 +100,12 @@ tasks:
|
||||
- pnpm install --frozen-lockfile
|
||||
|
||||
ui:
|
||||
desc: Build the dashboard into ui/dist (committed; the Go build embeds it)
|
||||
desc: Build the dashboard into ui/dist, which the Go build embeds
|
||||
dir: ui
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- pnpm run build
|
||||
|
||||
ui:check:
|
||||
desc: Rebuild the dashboard into a temporary directory and reject a stale ui/dist
|
||||
deps: [ui:deps]
|
||||
cmds:
|
||||
- bash tools/uidist.sh check
|
||||
|
||||
test:ui:
|
||||
desc: Test and type-check the dashboard
|
||||
dir: ui
|
||||
@@ -227,8 +221,16 @@ 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]
|
||||
vars:
|
||||
GATEWAY_VERSION: '{{.GATEWAY_VERSION | default .VERSION}}'
|
||||
RUNTIME_VERSION: '{{.RUNTIME_VERSION | default .VERSION}}'
|
||||
@@ -278,13 +280,14 @@ tasks:
|
||||
desc: Run the full quality gate
|
||||
# Finish mutations before starting parallel checks.
|
||||
cmds:
|
||||
# Node packages land under ui/, which `go test ./...` walks: installing
|
||||
# them while the parallel checks scan the tree makes a lockfile update
|
||||
# delete Go sources mid-walk. Install first, then fan out. Every Go step
|
||||
# embeds ui/dist, so the dashboard is built before any of them.
|
||||
- task: ui
|
||||
- task: fmt
|
||||
- task: proto:check
|
||||
- task: db:check
|
||||
# Node packages land under ui/, which `go test ./...` walks: installing
|
||||
# them while the parallel checks scan the tree makes a lockfile update
|
||||
# delete Go sources mid-walk. Install first, then fan out.
|
||||
- task: ui:deps
|
||||
- task: check:readonly
|
||||
|
||||
check:readonly:
|
||||
@@ -297,25 +300,33 @@ tasks:
|
||||
- task: build
|
||||
- task: test
|
||||
- task: test:ui
|
||||
- task: ui:check
|
||||
|
||||
release:preview:
|
||||
desc: "Show the release notes that would be generated (VERSION=1.2.0)"
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --dry-run
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:prepare:
|
||||
desc: Prepare changelog notes for editing (VERSION=1.2.0)
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --prepare
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
|
||||
release:
|
||||
desc: Commit and tag the prepared release (VERSION=1.2.0)
|
||||
cmds:
|
||||
- tools/release.sh --version {{.VERSION}} --tag
|
||||
desc: "Turn [Unreleased] into a release, then commit and tag it (RELEASE=major|minor|patch|1.2.3)"
|
||||
requires:
|
||||
vars: [VERSION]
|
||||
vars: [RELEASE]
|
||||
cmds:
|
||||
- |
|
||||
set -euo pipefail
|
||||
die() { echo "release: $*" >&2; exit 1; }
|
||||
[ "$(git rev-parse --abbrev-ref HEAD)" = main ] || die "releases are cut from main"
|
||||
[ -z "$(git status --porcelain)" ] || die "the working tree is dirty"
|
||||
last="$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1 || true)"
|
||||
IFS=. read -r major minor patch <<<"${last#v}"
|
||||
case "{{.RELEASE}}" in
|
||||
major) version="$((major + 1)).0.0" ;;
|
||||
minor) version="$major.$((minor + 1)).0" ;;
|
||||
patch) version="$major.$minor.$((patch + 1))" ;;
|
||||
*) version="$(echo "{{.RELEASE}}" | sed 's/^v//')" ;;
|
||||
esac
|
||||
echo "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$' || die "$version is not a version"
|
||||
! git rev-parse -q --verify "refs/tags/v$version" >/dev/null || die "v$version already exists"
|
||||
awk '/^## \[Unreleased\]/ { u = 1; next } u && /^## \[/ { exit } u && /^- / { found = 1 } END { exit !found }' CHANGELOG.md ||
|
||||
die "[Unreleased] in CHANGELOG.md has no entries"
|
||||
awk -v hdr="## [$version] - $(date -u +%F)" '{ print } /^## \[Unreleased\]/ { print ""; print hdr }' CHANGELOG.md >CHANGELOG.md.tmp
|
||||
mv CHANGELOG.md.tmp CHANGELOG.md
|
||||
go -C tools run -mod=readonly ./newsgen --repo-root ..
|
||||
git add CHANGELOG.md docs/news
|
||||
git commit -q -m "chore(release): v$version"
|
||||
git tag -a "v$version" -m "v$version"
|
||||
echo "tagged v$version"
|
||||
@@ -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._
|
||||
|
||||
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -1,9 +0,0 @@
|
||||
package configtemplate
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// Changelog is the verbatim contents of CHANGELOG.md, so a binary carries the
|
||||
// release notes for the version it was built as.
|
||||
//
|
||||
//go:embed CHANGELOG.md
|
||||
var Changelog string
|
||||
@@ -1,39 +0,0 @@
|
||||
// The Messaging Service reaches the State Store and the workflow engine only
|
||||
// through their contracts. Go imports are atomic, so one reference relinks a
|
||||
// runtime, and the boundary holds only while something re-measures it.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMessagingDoesNotLinkStoreOrWorkflowRuntime(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
out, err := exec.CommandContext(ctx, "go", "list", "-deps", ".").Output()
|
||||
if err != nil {
|
||||
t.Fatalf("go list -deps .: %v", err)
|
||||
}
|
||||
linked := map[string]bool{}
|
||||
for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") {
|
||||
linked[line] = true
|
||||
}
|
||||
for _, pkg := range []string{
|
||||
"github.com/jackc/pgx/v5/pgxpool",
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/postgres",
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore",
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow",
|
||||
"github.com/samcharles93/archie-core/internal/agentexec",
|
||||
} {
|
||||
t.Run(pkg, func(t *testing.T) {
|
||||
if linked[pkg] {
|
||||
t.Errorf("cmd/archie-messaging links %s: services reach each other only through contracts", pkg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// This file enforces the dashboard's process boundary
|
||||
// (docs/prds/external-agent-harness.md, "Session contract", Transport): the
|
||||
// dashboard must not link the container or daemon internals, because only the
|
||||
// daemon owns containers. Go imports are atomic, so a single reference
|
||||
// relinks a runtime, and the boundary holds only while something re-measures
|
||||
// it. archie-core-h3s0 names this check; it was purged with the test suite and
|
||||
// is restored here.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestDashboardDoesNotLinkContainerRuntime(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
out, err := exec.CommandContext(ctx, "go", "list", "-deps", ".").Output()
|
||||
if err != nil {
|
||||
t.Fatalf("go list -deps .: %v", err)
|
||||
}
|
||||
linked := map[string]bool{}
|
||||
for line := range strings.SplitSeq(strings.TrimSpace(string(out)), "\n") {
|
||||
linked[line] = true
|
||||
}
|
||||
for _, pkg := range []string{
|
||||
"github.com/samcharles93/archie-core/internal/container",
|
||||
"github.com/samcharles93/archie-core/internal/app/archied",
|
||||
"github.com/samcharles93/archie-core/internal/agentexec",
|
||||
} {
|
||||
t.Run(pkg, func(t *testing.T) {
|
||||
if linked[pkg] {
|
||||
t.Errorf("cmd/archie-ui links %s: only the daemon owns containers", pkg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -7,12 +7,11 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/archied"
|
||||
"github.com/samcharles93/archie-core/internal/app/archieplaybooks"
|
||||
"github.com/samcharles93/archie-core/internal/app/prbench"
|
||||
)
|
||||
|
||||
const commandUsage = "usage: archied [flags] # run the daemon; archied -h lists the flags\n" +
|
||||
"subcommands: setup, update, release, status, prbench, playbooks"
|
||||
"subcommands: setup, update, release, status, prbench"
|
||||
|
||||
func main() {
|
||||
os.Exit(run(os.Args[1:]))
|
||||
@@ -35,8 +34,6 @@ func run(args []string) int {
|
||||
return archied.RunStatus(args[1:], os.Stdout, os.Stderr)
|
||||
case "prbench":
|
||||
return prbench.Main(args[1:], os.Stdout, os.Stderr)
|
||||
case "playbooks":
|
||||
return archieplaybooks.Run(args[1:], os.Stderr)
|
||||
}
|
||||
// A word that is not a subcommand is refused rather than ignored: a
|
||||
// stale `archied update-topology` would otherwise start a second
|
||||
|
||||
+17
-3
@@ -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.
|
||||
@@ -1,8 +1,6 @@
|
||||
# Running this distribution
|
||||
|
||||
This archive contains five linux/amd64 binaries:
|
||||
|
||||
Each service owns its data and reaches the others only through their gRPC
|
||||
This archive holds the linux/amd64 binary for each service. Each service owns its data and reaches the others only through their gRPC
|
||||
contracts (or NATS, for task actions):
|
||||
|
||||
| Service | Owns | Reaches |
|
||||
@@ -13,9 +11,6 @@ contracts (or NATS, for task actions):
|
||||
| `archie-messaging` | the Telegram, email and webhook channel connections | Gateway; State Store for channel settings |
|
||||
| `archie-ui` | the dashboard and the webhook capture receiver | Gateway; State Store |
|
||||
|
||||
`archied playbooks lint` checks playbook binding YAML before it reaches the
|
||||
daemon, and `archied playbooks serve` is its language server for editors.
|
||||
|
||||
Without `archie-messaging` the channels are simply absent, so it needs a unit
|
||||
of its own (`deployments/systemd-user-service.md`).
|
||||
|
||||
@@ -67,12 +62,6 @@ that reference is on a registry that needs a login -- see
|
||||
systemd user-unit runbook:
|
||||
<https://offloaded.dev>.
|
||||
|
||||
## Verifying an install
|
||||
|
||||
`archied playbooks lint -dir <playbooks-dir>` validates playbook binding YAML
|
||||
against the same schema `archied` loads at startup — run it against your
|
||||
playbooks directory before pointing `archied` at it.
|
||||
|
||||
## Version
|
||||
|
||||
This archive's binaries are built from the `archied` release tag in its
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
@@ -169,47 +169,24 @@ fall back to a host model loop.
|
||||
|
||||
## 6. Pinning the archie-agent Image
|
||||
|
||||
`archie-agent:latest` is a moving target: every release re-publishes it, so it
|
||||
can change under a running deployment with no warning and no way to reproduce a
|
||||
prior build. Two paths publish it, to different references:
|
||||
The release pipeline publishes
|
||||
`git.catlow.cloud/sam/archie-agent` as `:v<version>` and `:sha-<commit>` when
|
||||
the commit carries a release tag; an ordinary push to `main` publishes nothing
|
||||
for the agent image, and `:latest` moves only when a release is promoted. A
|
||||
distribution zip pins the image its own release
|
||||
published, by digest, in `release.json`, and `archied update install` pulls
|
||||
exactly that.
|
||||
|
||||
- `.github/workflows/deploy.yml` publishes `git.catlow.cloud/sam/archie-agent`
|
||||
as `:latest` and `:sha-<commit>` when the commit carries a release tag; an
|
||||
ordinary push to `main` publishes nothing for the agent image.
|
||||
- `tools/publish.sh`, run by hand for a release, publishes
|
||||
`git.catlow.cloud/sam/archie-agent` as `:latest` and `:sha-<commit>`, which is
|
||||
the registry the shipped default above names.
|
||||
|
||||
A distribution zip pins whichever one its own release published, by digest, in
|
||||
`release.json`; `archied update install` then pulls exactly that.
|
||||
|
||||
As of this writing, `archie-agent` has **no published semantic-version tag** --
|
||||
both paths publish only `:latest` and an immutable `:sha-<commit>` (`archied`
|
||||
is versioned independently per `RELEASING.md`, but that versioning is not yet
|
||||
reflected as a registry tag for the agent image). Until one publishes it, the
|
||||
only reproducible reference is a content digest, resolved once and pinned
|
||||
explicitly:
|
||||
To pin by hand, prefer the version tag for readability, or a digest where you
|
||||
need byte-for-byte reproducibility (a tag can be overwritten, a digest cannot):
|
||||
|
||||
```toml
|
||||
[containers]
|
||||
image = "git.catlow.cloud/sam/archie-agent:v<version>"
|
||||
# or
|
||||
image = "git.catlow.cloud/sam/archie-agent@sha256:<digest>"
|
||||
```
|
||||
|
||||
This is the digest `latest` resolved to on 2026-09-05. Digest pinning is the
|
||||
strongest option for production: it is immutable and independently
|
||||
verifiable (`docker manifest inspect git.catlow.cloud/sam/archie-agent@sha256:...`),
|
||||
at the cost of being opaque in a config file a human is meant to edit --
|
||||
resolve a fresh digest deliberately (`docker pull ...:latest` followed by
|
||||
`docker inspect --format '{{index .RepoDigests 0}}'`) rather than editing this
|
||||
one in place expecting it to track new releases.
|
||||
|
||||
If/when CI starts publishing a semantic-version tag for `archie-agent`
|
||||
(e.g. `git.catlow.cloud/sam/archie-agent:v1.21.0`), prefer that tag for
|
||||
day-to-day config readability, and reserve digest pinning for deployments
|
||||
that need byte-for-byte reproducibility guarantees a tag alone cannot give
|
||||
(tags are mutable pointers; a compromised or accidentally-overwritten tag
|
||||
still resolves, a digest cannot).
|
||||
|
||||
A reference on a registry that needs a login needs the credential in
|
||||
`[containers].registry_auth` -- the release's own
|
||||
`git.catlow.cloud/sam/archie-agent` digest is one, since an anonymous pull
|
||||
|
||||
@@ -85,7 +85,17 @@
|
||||
"/news/archie/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archie/1.55.0/": "/news/1.55.0/",
|
||||
"/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.62.0/": "/news/1.62.0/",
|
||||
"/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/",
|
||||
@@ -186,7 +196,17 @@
|
||||
"/news/archied/1.54.3/": "/news/1.54.3/",
|
||||
"/news/archied/1.55.0/": "/news/1.55.0/",
|
||||
"/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.62.0/": "/news/1.62.0/",
|
||||
"/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/",
|
||||
|
||||
@@ -1,4 +1,54 @@
|
||||
[
|
||||
{
|
||||
"version": "1.62.0",
|
||||
"date": "2026-11-10",
|
||||
"body": "### archied\n\n- When an agent step reaches its step budget, the task asks to continue instead of parking. Approving resumes the stopped step with its conversation, including inside a parallel branch.\n- A parked task is flagged when the credential, connection or setting its blocker names changes, so you can see which parks are worth retrying.\n- Merging, closing and issue tools use the repository's own forge connection. A repository on Gitea no longer gets a GitHub 404 when its pull request is merged from archie.\n- A restart re-queues a running task at the step it was interrupted in, and parks it after three restarts instead of looping.\n- Issues and pull request review activity from authors without write access are ignored.\n- A baseline repair made by the repository gate is opened as its own pull request before the task continues.\n- Closing an issue that still has open dependencies is recorded as refused, rather than parking the task.\n- When the work volume fills, stale task clones are reclaimed; clones with uncommitted or unpushed work are kept. Clones need 1 GiB free, not 5.\n- A corrupt repository mirror is rebuilt, and a push that hits a missing object rebuilds the mirror and retries once.\n- Readiness reports degraded when the run loop stalls.\n- Execution budgets set in the dashboard are no longer reverted when the model catalogue loads.\n- A full volume is reported as an environment failure, and an unreachable secret engine as unavailable, rather than as a bad or missing credential.\n- A park from the workflow identity check now appears in the task log.\n- Every task records the identity that created it, and its queued event names the task, actor and principal. System is the one instance identity: it polls forge connections and owns the root grants and connection permits the bot-named identity used to hold, which existing tasks, grants and permits move to on upgrade.\n\n### archie-ui\n\n- A chat reply is no longer lost when you switch conversation or reload mid-answer: the turn finishes and its reply is in the conversation when you come back. Stop is the only way to cancel it.\n- The task page offers every action the task list does.\n- Workflows have row actions, enabling or disabling one confirms with a toast, and the editor toolbar wraps on narrow screens.\n- The dashboard lists five tasks needing attention, not every one.\n- Dismiss all no longer covers the unread badge.\n\n### archie-agent\n\n- The agent image includes Task, so the repository gate no longer downloads it on every run."
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"body": "### archied\n\n- Running `install.sh` over an install whose services are already running now restarts them, so they run the new binaries."
|
||||
},
|
||||
{
|
||||
"version": "1.57.0",
|
||||
"date": "2026-10-31",
|
||||
"body": "### archied\n\n- A release reaches `stable` only after it has run on a canary for a day and passed: `archied release publish` now publishes to `next` alone, `archied release canary start|check` installs a release on a canary and judges it from the canary's dashboard, promoting it or rolling the canary back, and `archied release promote` moves `stable` by hand. Promotion refuses a prerelease and a release older than the one `stable` names. The `archied` and `archie-agent` images are published as `:v<version>`, and `:latest` moves only when a release is promoted."
|
||||
},
|
||||
{
|
||||
"version": "1.56.0",
|
||||
"date": "2026-10-31",
|
||||
|
||||
@@ -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.
|
||||
@@ -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` |
|
||||
|
||||
@@ -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)})`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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 };
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
@@ -20,7 +20,7 @@ require (
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/fatih/color v1.19.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.1.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.6 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.10.0 // indirect
|
||||
github.com/go-git/gcfg/v2 v2.0.2 // indirect
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 // indirect
|
||||
github.com/go-logr/logr v1.4.4 // indirect
|
||||
@@ -29,20 +29,19 @@ require (
|
||||
github.com/go-webauthn/x v0.3.1 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/go-tpm v0.9.8 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.33.0 // indirect
|
||||
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
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
|
||||
github.com/minio/highwayhash v1.0.4 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.2 // indirect
|
||||
github.com/nats-io/nkeys v0.4.16 // indirect
|
||||
github.com/nats-io/jwt/v2 v2.8.3 // indirect
|
||||
github.com/nats-io/nkeys v0.4.17 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/oklog/run v1.2.0 // indirect
|
||||
github.com/philhofer/fwd v1.2.1 // indirect
|
||||
@@ -60,45 +59,43 @@ require (
|
||||
go.opentelemetry.io/otel/log v1.47.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.47.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.5 // indirect
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.6 // indirect
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0 // indirect
|
||||
golang.org/x/sync v0.24.0 // indirect
|
||||
golang.org/x/text v0.43.0 // indirect
|
||||
golang.org/x/time v0.16.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/cel-go v0.32.0
|
||||
cel.dev/cel-go v0.33.2
|
||||
github.com/BurntSushi/toml v1.6.0
|
||||
github.com/cedar-policy/cedar-go v1.8.0
|
||||
github.com/cedar-policy/cedar-go v1.9.0
|
||||
github.com/containerd/errdefs v1.0.0
|
||||
github.com/coreos/go-oidc/v3 v3.21.0
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12
|
||||
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-jose/go-jose/v4 v4.1.9
|
||||
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/jackc/pgx/v5 v5.11.0
|
||||
github.com/hiddeco/sshsig v0.2.0
|
||||
github.com/jackc/pgx/v5 v5.12.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
|
||||
github.com/nats-io/nats-server/v2 v2.15.1
|
||||
github.com/nats-io/nats-server/v2 v2.15.2
|
||||
github.com/nats-io/nats.go v1.55.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.1
|
||||
github.com/pressly/goose/v3 v3.29.0
|
||||
github.com/samcharles93/ai-sdk v0.6.0
|
||||
go.lsp.dev/jsonrpc2 v1.0.1
|
||||
go.lsp.dev/protocol v1.0.1
|
||||
go.lsp.dev/uri v1.0.1
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0
|
||||
go.opentelemetry.io/otel v1.47.0
|
||||
@@ -107,7 +104,7 @@ require (
|
||||
go.opentelemetry.io/otel/sdk v1.47.0
|
||||
go.opentelemetry.io/otel/trace v1.47.0
|
||||
go.opentelemetry.io/proto/otlp v1.11.1
|
||||
golang.org/x/crypto v0.58.0
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2
|
||||
golang.org/x/mod v0.42.0
|
||||
golang.org/x/net v0.62.0
|
||||
golang.org/x/oauth2 v0.37.0
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
cel.dev/cel-go v0.32.0 h1:irvpFKr5EuGPyxeME03ERh0rii1TX+BDAnB9eL3IvNk=
|
||||
cel.dev/cel-go v0.32.0/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
|
||||
cel.dev/cel-go v0.33.2 h1:eAcEdBguc6AFrGbPOyE0g168Uey4kKFW9J6qsBLSeMU=
|
||||
cel.dev/cel-go v0.33.2/go.mod h1:DnVip7tpJSsgZymwfT+m1tnEVy3ivAjSMXPx12YrMkU=
|
||||
cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0=
|
||||
cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
|
||||
@@ -20,6 +22,8 @@ github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/
|
||||
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
||||
github.com/cedar-policy/cedar-go v1.8.0 h1:9gcU7EHXwHC2RMdpph68yTAkdB3behTTssC+kt4GoS8=
|
||||
github.com/cedar-policy/cedar-go v1.8.0/go.mod h1:h5+3CVW1oI5LXVskJG+my9TFCYI5yjh/+Ul3EJie6MI=
|
||||
github.com/cedar-policy/cedar-go v1.9.0 h1:p6KSbPT0E79gO5mXNdwAqbDPn4ypz7gX5WV0ScLWmFc=
|
||||
github.com/cedar-policy/cedar-go v1.9.0/go.mod h1:+pmZnfwQkIUKO9qHzoL2wg8Q6xn7c9le15sexhinvVw=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
@@ -46,6 +50,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
|
||||
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8 h1:ay2XEj0yW3uzsNwN3KXS/c4nlneHONFKaHlrVhu2WCQ=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.8/go.mod h1:4G6VgFAp9eaQkwy7DbZbOfWRD/Mjvc/TnEtQBRRMEsA=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12 h1:ZPkgVmmfBTEYUdVpEHVFF8BxTXFrYONQ3cDTgAc/JXc=
|
||||
github.com/docker/sandbox-kit-spec/v3 v3.0.0-m.12/go.mod h1:s/lMVROKewN90s0OQ4WrOi6v3+IBDtRI75Hmol8rG4Y=
|
||||
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
|
||||
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
@@ -57,6 +63,8 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO
|
||||
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
|
||||
github.com/fxamacker/cbor/v2 v2.9.6 h1:NHZPxuUjJXQjX9itA785y/5NKSlI4HQ+S7noZsmI7hs=
|
||||
github.com/fxamacker/cbor/v2 v2.9.6/go.mod h1:4EaZp6ClVunETjQ4GHmGNzysDK91Lr+r6Yz6tJqzVCw=
|
||||
github.com/fxamacker/cbor/v2 v2.10.0 h1:HVF3T5vYwLqO81ebPirWEPNv2SMrUMD3HLnKgEr6uWE=
|
||||
github.com/fxamacker/cbor/v2 v2.10.0/go.mod h1:uSwlToFuT9BZAKRxxVm3qQC8DR4tlWl7D6pf20iRYH4=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
|
||||
github.com/go-git/gcfg/v2 v2.0.2 h1:MY5SIIfTGGEMhdA7d7JePuVVxtKL7Hp+ApGDJAJ7dpo=
|
||||
@@ -69,6 +77,8 @@ github.com/go-git/go-git/v6 v6.0.0-beta.1 h1:1t+vJYGDBN6f9GRWskgWx5UjXPFUa7wfffZ
|
||||
github.com/go-git/go-git/v6 v6.0.0-beta.1/go.mod h1:ugDlr38Wwc+fOw85J+Oluh5TNXQtJgYMcriOljg3l4s=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-jose/go-jose/v4 v4.1.9 h1:pKfeQkig1NmgK4hJrZYXLEYURXfoJB61Larw0uIW4gY=
|
||||
github.com/go-jose/go-jose/v4 v4.1.9/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 h1:UADEEmDKgfXbtnGJZ97beY5XLo9ZechG1nlU4KnRrkE=
|
||||
github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
@@ -76,8 +86,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=
|
||||
@@ -100,18 +108,24 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0 h1:QMILzF8BA7xftE4zVORkRrlv08m12St3csK4RsyRgRs=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.32.0/go.mod h1:+ZQ6iUL8+ATyxGDQNuRKpNwJFdGDUi0e7E1QL9MvI7U=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.33.0 h1:5T5Ns3kMpWr+z3s5ZA0e7ljVyWNVNxK76sHPAxi5D1k=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.33.0/go.mod h1:oWNYw09cH8wl8fFgC5hKlBLxR4XfKy2KQpP8MJjeCcc=
|
||||
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
|
||||
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs=
|
||||
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=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.11.0 h1:IzBBtyK9AHqf98cctWFifYSci2hgQR/cd56wB4p+ogg=
|
||||
github.com/jackc/pgx/v5 v5.11.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4=
|
||||
github.com/jackc/pgx/v5 v5.12.0 h1:hWwax8YiGT0YiN50U1oIDn5kgR7KC2tG3rmavwpPkxY=
|
||||
github.com/jackc/pgx/v5 v5.12.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds=
|
||||
github.com/jackc/puddle/v2 v2.2.3 h1:f8HoREISb3l5eO9coPgK7U3hKLhWGokOFVcThl5jrao=
|
||||
github.com/jackc/puddle/v2 v2.2.3/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
|
||||
@@ -149,12 +163,18 @@ github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtw
|
||||
github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts=
|
||||
github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
|
||||
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
|
||||
github.com/nats-io/jwt/v2 v2.8.3 h1:pqImTmlqH2zPHKNdRXO0YRyWif2diGRlrtLFJ2RxM2I=
|
||||
github.com/nats-io/jwt/v2 v2.8.3/go.mod h1:OOY2rP/UU8tcfoqhbHmBKcNdpFMKvmxIkmFFa16M4wI=
|
||||
github.com/nats-io/nats-server/v2 v2.15.1 h1:fK3AeYFIji1Smng60jB0hVoAPZezA/UzsaI3BqXFNEI=
|
||||
github.com/nats-io/nats-server/v2 v2.15.1/go.mod h1:yeuYRtKVKIFtmMz2/YPk+6hvmNBnk+WwTUzErBdH6IE=
|
||||
github.com/nats-io/nats-server/v2 v2.15.2 h1:yLsgt2kslgymvxvjFq1WGWck5hkat2YYfbXvQ145tzU=
|
||||
github.com/nats-io/nats-server/v2 v2.15.2/go.mod h1:VXHCZgDglV5wO2B8ZE58yG2HzqxQxYUbQqibUh5Xcr8=
|
||||
github.com/nats-io/nats.go v1.55.0 h1:Ng8QKHdvdHIWoaiq0+d/aH1BWkxvcJxWJ0Y/9BPKx3M=
|
||||
github.com/nats-io/nats.go v1.55.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
|
||||
github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg=
|
||||
github.com/nats-io/nkeys v0.4.16/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nkeys v0.4.17 h1:JAJrlDhOyQqOt0a1eg4cbIZ1Kc7+vmkCigAltpwQpVA=
|
||||
github.com/nats-io/nkeys v0.4.17/go.mod h1:llLgWoI0o4z/Q57q2R1kHfmocyhGV6VG/U18Glg1Afs=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
|
||||
@@ -203,12 +223,6 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
|
||||
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
|
||||
go.lsp.dev/jsonrpc2 v1.0.1 h1:JZAchpm6RcOuwEOnZ7kF3kA1EpEjdJZ/6rMSfOF3+F4=
|
||||
go.lsp.dev/jsonrpc2 v1.0.1/go.mod h1:WN+TesqrPumBmUdsuWyn9DHq3zl4i85L/qG0NLdj8qg=
|
||||
go.lsp.dev/protocol v1.0.1 h1:kLWUIk1v/deXxo1D0VO4avjZnfeuZ82mouJgJd/NbdU=
|
||||
go.lsp.dev/protocol v1.0.1/go.mod h1:e//i41aEqc9ml32xiNuneUwbjOjuvTA4+uv+AkssJgk=
|
||||
go.lsp.dev/uri v1.0.1 h1:ywxJN1UXoQ+v0I9lkoQNMmsm7lub5G9ZG7KXT8YTx30=
|
||||
go.lsp.dev/uri v1.0.1/go.mod h1:06a0ghafs4PuqkLsJGUmlgPHw6+kH79edRXjOT/rA8s=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 h1:Tq+E65HaNbZTeqcLw6QUhsV+/EIWdkfUH2CQzcrlE5M=
|
||||
@@ -241,10 +255,16 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
|
||||
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
|
||||
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
|
||||
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
|
||||
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2 h1:zGDaB+/Mus2mScKvZ23k+W9NAUbP56sNM9SptgvWI5A=
|
||||
golang.org/x/crypto v0.58.1-0.20261009181718-2f1f834330b2/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e h1:HgI6W1OolKK6tcV74is+rl9SMT0njsHlp0TbQiGXI/A=
|
||||
golang.org/x/exp v0.0.0-20261014143641-f0251eb4aa3e/go.mod h1:DBoxwWhjaW8DJJw/YeM4zpeOKMC1FMXSblsYy+1mFSw=
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0 h1:1GO4fJiyGakz0Liu2Ve1qPAwQYPkKlG1Q8iO2CYjtFA=
|
||||
golang.org/x/exp v0.0.0-20261106192419-47ce03d25ef0/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs=
|
||||
golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg=
|
||||
golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs=
|
||||
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
|
||||
@@ -270,12 +290,19 @@ golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
|
||||
golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
|
||||
golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs=
|
||||
golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
|
||||
golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a h1:Yqozs0FNPRoPGS4hNGlrNwRENWr5H5nVG9sN/f+5640=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b h1:nB3spRIaSPtxJpxb0k41yljROvm2Jrwfs2pSNdKS5y8=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261019180522-ce908d29299b/go.mod h1:9N4vtjEwvgQKEdlFVQO0M44ErhecQ9DCSQfGoZ51M6w=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261026165753-2ffab32bce7e h1:e789sLZjeTdc02ZCQGTSzHOu0fR73+dwPQVKUp67Z88=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261026165753-2ffab32bce7e/go.mod h1:vHV3wJM9WZyfV7GyB+OQGq5dWVrFwCDxapPK4WlRD88=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab h1:n6IDWZ1RzI/NberLoLLFNrjl1H45uhc4+WYsUf5lPPc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20261104224025-d1e00e9f33ab/go.mod h1:vHV3wJM9WZyfV7GyB+OQGq5dWVrFwCDxapPK4WlRD88=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b h1:6WNWHZk91dp4gZ25642OALkuG1UVNZbwENJD19DnB8k=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab h1:8sYjjefPfQ+FZEh1ZwBAqK/NifJVhOxut8nRh3SJzZM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20261104224025-d1e00e9f33ab/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/grpc v1.86.0-dev h1:FLq7hcApuJeJ70J9+k0FvmXsNCwS8B2/MeAfYdy3GHY=
|
||||
google.golang.org/grpc v1.86.0-dev/go.mod h1:Ovl0ECo4xx5r4kn/6d4BPSNB7OIFuu6EAjOzjtVAKaM=
|
||||
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||
|
||||
+4
-2
@@ -475,10 +475,12 @@ EOF
|
||||
fi
|
||||
|
||||
# Auto-enable and start the services, the store first so a fresh boot does
|
||||
# not race a dial it depends on.
|
||||
# not race a dial it depends on. Restart rather than start, because a
|
||||
# reinstall over running services would otherwise leave the old binaries
|
||||
# running.
|
||||
if [ "${AUTO_START}" = true ]; then
|
||||
echo "==> Enabling and starting Archie services..."
|
||||
systemctl --user enable --now $INSTANCE_UNITS ||
|
||||
{ systemctl --user enable $INSTANCE_UNITS && systemctl --user restart $INSTANCE_UNITS; } ||
|
||||
echo " Notice: Could not start every service automatically. Check: systemctl --user status ${INSTANCE_UNITS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -52,7 +52,7 @@ type HarnessStages struct {
|
||||
Spec agentrun.HarnessSpec
|
||||
}
|
||||
|
||||
func (r HarnessStages) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r HarnessStages) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
spec := r.Spec
|
||||
req.Harness = &spec
|
||||
return r.Runner.Run(ctx, workspace, req, report)
|
||||
|
||||
@@ -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, nil)
|
||||
result, err := NewHarnessRunner().Run(t.Context(), workspace, req, agentrun.Reporter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func newClaudeCodeHarnessOutput() *claudeCodeHarnessOutput {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"session_id"`
|
||||
@@ -44,7 +44,7 @@ func (o *claudeCodeHarnessOutput) Line(line []byte, report agentrun.ToolCallRepo
|
||||
|
||||
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.ToolCallRepo
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage) {
|
||||
var message struct {
|
||||
ID string `json:"id"`
|
||||
Usage json.RawMessage `json:"usage"`
|
||||
@@ -79,7 +79,7 @@ func (o *claudeCodeHarnessOutput) assistant(raw json.RawMessage, _ agentrun.Tool
|
||||
}
|
||||
}
|
||||
|
||||
func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.ToolCallReporter) {
|
||||
func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.Reporter) {
|
||||
var message struct {
|
||||
Content []struct {
|
||||
Type string `json:"type"`
|
||||
@@ -100,12 +100,10 @@ func (o *claudeCodeHarnessOutput) user(raw json.RawMessage, report agentrun.Tool
|
||||
continue
|
||||
}
|
||||
delete(o.pending, block.ToolUseID)
|
||||
if report != nil {
|
||||
report(agentrun.ToolCallReport{
|
||||
Tool: tool, Detail: ClipToolCallDetail(claudeResultContent(block.Content)),
|
||||
Failed: block.IsError,
|
||||
})
|
||||
}
|
||||
report.ReportToolCall(agentrun.ToolCallReport{
|
||||
Tool: tool, Detail: ClipToolCallDetail(claudeResultContent(block.Content)),
|
||||
Failed: block.IsError,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type codexHarnessOutput struct {
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *codexHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *codexHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ThreadID string `json:"thread_id"`
|
||||
@@ -43,8 +43,8 @@ func (o *codexHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter)
|
||||
})
|
||||
}
|
||||
case "item.completed":
|
||||
if call, ok := event.Item.report(); ok && report != nil {
|
||||
report(call)
|
||||
if call, ok := event.Item.report(); ok {
|
||||
report.ReportToolCall(call)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func newCopilotHarnessOutput() *copilotHarnessOutput {
|
||||
return &copilotHarnessOutput{pending: make(map[string]string)}
|
||||
}
|
||||
|
||||
func (o *copilotHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *copilotHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
SessionID string `json:"sessionId"`
|
||||
@@ -52,9 +52,7 @@ func (o *copilotHarnessOutput) Line(line []byte, report agentrun.ToolCallReporte
|
||||
return
|
||||
}
|
||||
delete(o.pending, event.Data.ToolCallID)
|
||||
if report != nil {
|
||||
report(agentrun.ToolCallReport{Tool: tool, Detail: ClipToolCallDetail(event.Data.Result.Content), Failed: !event.Data.Success})
|
||||
}
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: tool, Detail: ClipToolCallDetail(event.Data.Result.Content), Failed: !event.Data.Success})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type piHarnessOutput struct {
|
||||
usage agentrun.Usage
|
||||
}
|
||||
|
||||
func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
func (o *piHarnessOutput) Line(line []byte, report agentrun.Reporter) {
|
||||
var event struct {
|
||||
Type string `json:"type"`
|
||||
ID string `json:"id"`
|
||||
@@ -49,7 +49,7 @@ func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
o.usage = addUsage(o.usage, usageFromFields(u.Input, u.Output, u.CacheRead, u.CacheWrite))
|
||||
}
|
||||
case "tool_execution_end":
|
||||
if event.ToolName == "" || report == nil {
|
||||
if event.ToolName == "" {
|
||||
return
|
||||
}
|
||||
texts := make([]string, 0, len(event.Result.Content))
|
||||
@@ -58,7 +58,7 @@ func (o *piHarnessOutput) Line(line []byte, report agentrun.ToolCallReporter) {
|
||||
texts = append(texts, block.Text)
|
||||
}
|
||||
}
|
||||
report(agentrun.ToolCallReport{Tool: event.ToolName, Detail: ClipToolCallDetail(strings.Join(texts, "\n")), Failed: event.IsError})
|
||||
report.ReportToolCall(agentrun.ToolCallReport{Tool: event.ToolName, Detail: ClipToolCallDetail(strings.Join(texts, "\n")), Failed: event.IsError})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
// knows its CLI's stream format; it reports tool calls as they complete and
|
||||
// the session to resume.
|
||||
type HarnessOutput interface {
|
||||
Line(line []byte, report agentrun.ToolCallReporter)
|
||||
Line(line []byte, report agentrun.Reporter)
|
||||
SessionID() string
|
||||
Usage() agentrun.Usage
|
||||
}
|
||||
@@ -54,20 +54,13 @@ 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.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if err := validateHarness(req); err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
@@ -95,7 +88,7 @@ func (r *HarnessRunner) Run(ctx context.Context, workspace string, req agentrun.
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.Request, mcpConfig string, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r *HarnessRunner) run(ctx context.Context, workspace string, req agentrun.Request, mcpConfig string, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
res := agentrun.Result{Version: agentrun.ProtocolVersion, TaskID: req.TaskID, Attempt: req.Attempt, Stage: req.Stage}
|
||||
before, err := snapshotRepo(workspace)
|
||||
if 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,13 +234,13 @@ 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
|
||||
// stdout to out line by line. Cancelling ctx kills the whole group, so a
|
||||
// CLI's children cannot outlive the step.
|
||||
func invoke(ctx context.Context, workspace string, h *agentrun.HarnessSpec, argv []string, out HarnessOutput, report agentrun.ToolCallReporter) error {
|
||||
func invoke(ctx context.Context, workspace string, h *agentrun.HarnessSpec, argv []string, out HarnessOutput, report agentrun.Reporter) error {
|
||||
cmd := exec.CommandContext(ctx, argv[0], argv[1:]...)
|
||||
cmd.Dir = workspace
|
||||
cmd.WaitDelay = killGrace
|
||||
@@ -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)),
|
||||
@@ -467,9 +481,9 @@ func policyViolation(before, after repoState, changes []string, req agentrun.Req
|
||||
|
||||
type silentOutput struct{}
|
||||
|
||||
func (silentOutput) Line([]byte, agentrun.ToolCallReporter) {}
|
||||
func (silentOutput) SessionID() string { return "" }
|
||||
func (silentOutput) Usage() agentrun.Usage { return agentrun.Usage{} }
|
||||
func (silentOutput) Line([]byte, agentrun.Reporter) {}
|
||||
func (silentOutput) SessionID() string { return "" }
|
||||
func (silentOutput) Usage() agentrun.Usage { return agentrun.Usage{} }
|
||||
|
||||
// tailBuffer keeps the last stderrTailBytes written to it.
|
||||
type tailBuffer struct{ buf bytes.Buffer }
|
||||
@@ -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 {
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestHarnessLiveOutput(t *testing.T) {
|
||||
if os.Geteuid() == 0 {
|
||||
user = "65534"
|
||||
}
|
||||
err := invoke(t.Context(), "/tmp", &agentrun.HarnessSpec{User: user}, []string{"sh", "-c", `printf '%s\n' '{"type":"thread.started","thread_id":"live-thread"}'; printf '%s\n' 'live diagnostic' >&2`}, adapter, nil)
|
||||
err := invoke(t.Context(), "/tmp", &agentrun.HarnessSpec{User: user}, []string{"sh", "-c", `printf '%s\n' '{"type":"thread.started","thread_id":"live-thread"}'; printf '%s\n' 'live diagnostic' >&2`}, adapter, agentrun.Reporter{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
// missionWithHistory puts the conversation of an earlier run of the stage
|
||||
// ahead of the mission, cut to fit the model's context window. agentloop has no
|
||||
// field for prior messages, so the conversation goes in the first user message
|
||||
// as text.
|
||||
func missionWithHistory(req agentrun.Request) string {
|
||||
entries := agentrun.BoundHistory(req.History, agentrun.HistoryBytes(req.ContextWindow))
|
||||
if len(entries) == 0 {
|
||||
return req.Mission
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString("<previous_run>\nAn earlier run of this stage stopped at its step budget and was approved to continue. " +
|
||||
"Its conversation follows and its edits are already in the worktree. Continue from where it stopped; do not start over.\n\n")
|
||||
for _, e := range entries {
|
||||
switch e.Kind {
|
||||
case agentrun.TranscriptModel:
|
||||
if e.Text != "" {
|
||||
fmt.Fprintf(&b, "[you] %s\n", e.Text)
|
||||
}
|
||||
for _, call := range e.ToolCalls {
|
||||
fmt.Fprintf(&b, "[you called %s] %s\n", call.Name, call.Args)
|
||||
}
|
||||
case agentrun.TranscriptTool:
|
||||
if e.Error != "" {
|
||||
fmt.Fprintf(&b, "[%s failed] %s\n", e.Tool, e.Error)
|
||||
} else {
|
||||
fmt.Fprintf(&b, "[%s returned] %s\n", e.Tool, e.Output)
|
||||
}
|
||||
case agentrun.TranscriptUser:
|
||||
fmt.Fprintf(&b, "[feedback] %s\n", e.Text)
|
||||
case agentrun.TranscriptCompaction:
|
||||
fmt.Fprintf(&b, "[summary of earlier steps] %s\n", e.Text)
|
||||
}
|
||||
}
|
||||
b.WriteString("</previous_run>\n\n")
|
||||
return b.String() + req.Mission
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func NewLoopRunner(
|
||||
// work on the chat workspace and bypass ReadOnly and ProtectPaths.
|
||||
const workspaceToolset = "workspace"
|
||||
|
||||
func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return agentrun.Result{}, err
|
||||
}
|
||||
@@ -67,19 +67,25 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
notes := &memoryNotes{initial: req.Notes}
|
||||
captures := make(map[string][]json.RawMessage)
|
||||
toolOpts := r.Limits.Options(workspaceToolset)
|
||||
toolOpts.OnToolCall = report
|
||||
toolOpts.OnToolCall = report.ToolCall
|
||||
centralTools, err := BuildToolSet(r.tools, toolOpts)
|
||||
if err != nil {
|
||||
return agentrun.Result{}, fmt.Errorf("build central tool set: %w", err)
|
||||
}
|
||||
captureTools := captureToolSet(req.CaptureTools, captures)
|
||||
var modelHooks []core.ModelHook
|
||||
var toolHooks []core.ToolHook
|
||||
if report.Transcript != nil {
|
||||
recorder := newTranscript(report.Transcript)
|
||||
modelHooks, toolHooks = []core.ModelHook{recorder}, []core.ToolHook{recorder}
|
||||
}
|
||||
res, err := r.run(ctx, agentloop.Config{
|
||||
Runtime: r.runtime,
|
||||
ModelRef: req.Model,
|
||||
WorkDir: workspace,
|
||||
|
||||
MaxParallelToolCalls: MaxParallelToolCalls,
|
||||
Mission: req.Mission,
|
||||
Mission: missionWithHistory(req),
|
||||
ExtraRules: agentexec.ProjectScopedRules(workspace, req.ExtraRules),
|
||||
Notes: notes,
|
||||
Gate: toAgentGate(req.Gate),
|
||||
@@ -101,7 +107,9 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
|
||||
allowedTools(centralTools, r.AllowTools),
|
||||
captureTools,
|
||||
),
|
||||
Logger: r.logger(req),
|
||||
ModelHooks: modelHooks,
|
||||
ToolHooks: toolHooks,
|
||||
Logger: r.logger(req),
|
||||
})
|
||||
result := resultFromRun(req, res, notes.appended, captures)
|
||||
if cause := context.Cause(ctx); cause != nil {
|
||||
|
||||
@@ -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
|
||||
@@ -74,12 +72,11 @@ type ToolSetOptions struct {
|
||||
// OnToolCall, when non-nil, is notified once per completed tool call.
|
||||
// LoopRunner populates it so a workflow stage can surface tool activity on
|
||||
// the task timeline. Nil means no one is listening.
|
||||
OnToolCall agentrun.ToolCallReporter
|
||||
OnToolCall func(agentrun.ToolCallReport)
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/chat"
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/webhookguard"
|
||||
)
|
||||
|
||||
// transcriptFieldLimit caps each recorded text field, in bytes.
|
||||
const transcriptFieldLimit = 32 << 10
|
||||
|
||||
// compactionPrefix starts the instruction agentloop sends to summarise the
|
||||
// history, which marks a model call as a compaction rather than a step.
|
||||
const compactionPrefix = "Compact the conversation history above"
|
||||
|
||||
// transcript records one agent run's conversation through agentloop's model
|
||||
// and tool hooks. Tool hooks run concurrently, so entries are numbered and
|
||||
// reported under one lock to keep their order.
|
||||
type transcript struct {
|
||||
report func(agentrun.TranscriptEntry)
|
||||
|
||||
mu sync.Mutex
|
||||
seq int
|
||||
prompted bool
|
||||
lastUser string
|
||||
started map[string]time.Time
|
||||
}
|
||||
|
||||
func newTranscript(report func(agentrun.TranscriptEntry)) *transcript {
|
||||
return &transcript{report: report, started: map[string]time.Time{}}
|
||||
}
|
||||
|
||||
func (t *transcript) add(entry agentrun.TranscriptEntry) {
|
||||
t.seq++
|
||||
entry.Seq = t.seq
|
||||
t.report(entry)
|
||||
}
|
||||
|
||||
func (t *transcript) ModelCallStarted(context.Context, chat.Request) {}
|
||||
|
||||
func (t *transcript) ModelCallFinished(_ context.Context, req chat.Request, resp *chat.Response, err error, latency time.Duration, usage *chat.Usage) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
entry := agentrun.TranscriptEntry{Kind: agentrun.TranscriptModel, LatencyMS: latency.Milliseconds(), Usage: transcriptUsage(usage)}
|
||||
if isCompaction(req) {
|
||||
entry.Kind = agentrun.TranscriptCompaction
|
||||
} else {
|
||||
t.recordInput(req.Messages)
|
||||
}
|
||||
if err != nil {
|
||||
entry.Error = clip(err.Error(), nil)
|
||||
}
|
||||
if resp != nil {
|
||||
entry.Text = clip(resp.Content, &entry.TextBytes)
|
||||
entry.Reasoning = clip(reasoning(resp.Parts), &entry.ReasoningBytes)
|
||||
entry.FinishReason = resp.FinishReason
|
||||
for _, call := range resp.ToolCalls {
|
||||
recorded := agentrun.TranscriptToolCall{ID: call.ID, Name: call.Name}
|
||||
recorded.Args = clipArgs(call.Arguments, &recorded.ArgsBytes)
|
||||
entry.ToolCalls = append(entry.ToolCalls, recorded)
|
||||
}
|
||||
}
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
// recordInput records the prompt on the first call, and after that each user
|
||||
// message the loop appended since the model last answered: gate feedback,
|
||||
// recovery nudges. Assistant and tool messages are recorded from the response
|
||||
// and the tool hooks instead.
|
||||
func (t *transcript) recordInput(messages []chat.Message) {
|
||||
if !t.prompted {
|
||||
t.prompted = true
|
||||
for _, message := range messages {
|
||||
t.recordMessage(message)
|
||||
}
|
||||
return
|
||||
}
|
||||
start := len(messages)
|
||||
for start > 0 && messages[start-1].Role == chat.RoleUser {
|
||||
start--
|
||||
}
|
||||
for _, message := range messages[start:] {
|
||||
if message.Content != t.lastUser {
|
||||
t.recordMessage(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *transcript) recordMessage(message chat.Message) {
|
||||
kind := agentrun.TranscriptUser
|
||||
switch message.Role {
|
||||
case chat.RoleSystem:
|
||||
kind = agentrun.TranscriptSystem
|
||||
case chat.RoleUser:
|
||||
t.lastUser = message.Content
|
||||
default:
|
||||
return
|
||||
}
|
||||
entry := agentrun.TranscriptEntry{Kind: kind}
|
||||
entry.Text = clip(message.Content, &entry.TextBytes)
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
func (t *transcript) BeforeToolExecute(_ context.Context, call *core.ToolCall) (*core.Skip, error) {
|
||||
t.mu.Lock()
|
||||
t.started[call.ToolCallID] = time.Now()
|
||||
t.mu.Unlock()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (t *transcript) AfterToolExecute(_ context.Context, call core.ToolCall, result *core.ToolResult) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
entry := agentrun.TranscriptEntry{Kind: agentrun.TranscriptTool, CallID: call.ToolCallID, Tool: call.ToolName}
|
||||
if started, ok := t.started[call.ToolCallID]; ok {
|
||||
entry.LatencyMS = time.Since(started).Milliseconds()
|
||||
delete(t.started, call.ToolCallID)
|
||||
}
|
||||
entry.Args = clipArgs(call.Input, &entry.ArgsBytes)
|
||||
entry.Output = clip(result.Output, &entry.OutputBytes)
|
||||
entry.Error = clip(result.Error, nil)
|
||||
t.add(entry)
|
||||
}
|
||||
|
||||
func reasoning(parts chat.Parts) string {
|
||||
var texts []string
|
||||
for _, part := range parts {
|
||||
if thought, ok := part.(chat.ReasoningPart); ok && thought.Text != "" {
|
||||
texts = append(texts, thought.Text)
|
||||
}
|
||||
}
|
||||
return strings.Join(texts, "\n\n")
|
||||
}
|
||||
|
||||
func isCompaction(req chat.Request) bool {
|
||||
n := len(req.Messages)
|
||||
return n > 0 && req.Messages[n-1].Role == chat.RoleUser && strings.HasPrefix(req.Messages[n-1].Content, compactionPrefix)
|
||||
}
|
||||
|
||||
func transcriptUsage(usage *chat.Usage) *agentrun.Usage {
|
||||
if usage == nil {
|
||||
return nil
|
||||
}
|
||||
return &agentrun.Usage{
|
||||
PromptTokens: usage.PromptTokens,
|
||||
CompletionTokens: usage.CompletionTokens,
|
||||
TotalTokens: usage.TotalTokens,
|
||||
CachedTokens: usage.CachedTokens,
|
||||
CacheCreationTokens: usage.CacheCreationTokens,
|
||||
}
|
||||
}
|
||||
|
||||
// clipArgs redacts tool arguments by key when they are JSON, then clips them.
|
||||
func clipArgs(args string, full *int) string {
|
||||
if json.Valid([]byte(args)) {
|
||||
if redacted, err := webhookguard.RedactPayload([]byte(args)); err == nil {
|
||||
args = string(redacted)
|
||||
}
|
||||
}
|
||||
return clip(args, full)
|
||||
}
|
||||
|
||||
// clip redacts secret-shaped spans and cuts text to transcriptFieldLimit on a
|
||||
// rune boundary, storing the original size in full when it cuts.
|
||||
func clip(text string, full *int) string {
|
||||
text = webhookguard.RedactText(text)
|
||||
if len(text) <= transcriptFieldLimit {
|
||||
return text
|
||||
}
|
||||
if full != nil {
|
||||
*full = len(text)
|
||||
}
|
||||
cut := transcriptFieldLimit
|
||||
for cut > 0 && !utf8.RuneStart(text[cut]) {
|
||||
cut--
|
||||
}
|
||||
return text[:cut]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package modelloop
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/core"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
)
|
||||
|
||||
func TestTranscriptToolEntryRedactsAndClips(t *testing.T) {
|
||||
const jwt = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcmNoaWUifQ.c2lnbmF0dXJlc2lnbmF0dXJl"
|
||||
const pem = "-----BEGIN RSA PRIVATE KEY-----\nMIIEow\n-----END RSA PRIVATE KEY-----"
|
||||
long := strings.Repeat("x", transcriptFieldLimit+10)
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
output string
|
||||
wantArgs string
|
||||
wantOutput string
|
||||
wantBytes int
|
||||
}{
|
||||
{
|
||||
name: "secret key in arguments, token inside output",
|
||||
input: `{"path":"a.txt","api_key":"plain-value"}`,
|
||||
output: "curl -H 'Authorization: Bearer " + jwt + "' done",
|
||||
wantArgs: `{"api_key":"[redacted]","path":"a.txt"}`,
|
||||
wantOutput: "curl -H 'Authorization: Bearer [redacted]' done",
|
||||
},
|
||||
{
|
||||
name: "private key block inside output",
|
||||
input: `{}`,
|
||||
output: "before\n" + pem + "\nafter",
|
||||
wantArgs: `{}`,
|
||||
wantOutput: "before\n[redacted]\nafter",
|
||||
},
|
||||
{
|
||||
name: "oversized output keeps its full size",
|
||||
input: `{}`,
|
||||
output: long,
|
||||
wantArgs: `{}`,
|
||||
wantOutput: long[:transcriptFieldLimit],
|
||||
wantBytes: len(long),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
var got []agentrun.TranscriptEntry
|
||||
recorder := newTranscript(func(entry agentrun.TranscriptEntry) { got = append(got, entry) })
|
||||
call := core.ToolCall{ToolCallID: "c1", ToolName: "shell", Input: tt.input}
|
||||
if _, err := recorder.BeforeToolExecute(t.Context(), &call); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
recorder.AfterToolExecute(t.Context(), call, &core.ToolResult{Output: tt.output})
|
||||
if len(got) != 1 {
|
||||
t.Fatalf("entries = %d, want 1", len(got))
|
||||
}
|
||||
entry := got[0]
|
||||
if entry.Args != tt.wantArgs {
|
||||
t.Errorf("args = %q, want %q", entry.Args, tt.wantArgs)
|
||||
}
|
||||
if entry.Output != tt.wantOutput {
|
||||
t.Errorf("output = %q, want %q", entry.Output, tt.wantOutput)
|
||||
}
|
||||
if entry.OutputBytes != tt.wantBytes {
|
||||
t.Errorf("output bytes = %d, want %d", entry.OutputBytes, tt.wantBytes)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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"}
|
||||
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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"}
|
||||
@@ -44,7 +44,7 @@ func readProjectMemory(path string) (string, error) {
|
||||
return "Project memory from earlier sessions:\n" + strings.Join(entries, "\n"), nil
|
||||
}
|
||||
|
||||
func (r persistentRunner) Run(ctx context.Context, workspace string, request agentrun.Request, report agentrun.ToolCallReporter) (agentrun.Result, error) {
|
||||
func (r persistentRunner) Run(ctx context.Context, workspace string, request agentrun.Request, report agentrun.Reporter) (agentrun.Result, error) {
|
||||
if !r.enabled {
|
||||
return r.Runner.Run(ctx, workspace, request, report)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,11 +12,13 @@ import (
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/alert"
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
"github.com/samcharles93/archie-core/internal/domain/org"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/alertwebhook"
|
||||
"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"
|
||||
)
|
||||
|
||||
@@ -172,7 +174,7 @@ func providerAlerts(providers map[string]config.Provider) []alert.Input {
|
||||
// instance org always among them.
|
||||
func credentialOrgs(cfg config.Config) []org.OrgID {
|
||||
orgs := []org.OrgID{org.DefaultOrgID}
|
||||
for _, name := range append([]string{""}, identityNames(cfg)...) {
|
||||
for _, name := range append([]string{string(identity.SystemID)}, identityNames(cfg)...) {
|
||||
orgName, _ := cfg.CredentialAccess(name)
|
||||
if id := org.OrgID(credentialOrg(orgName)); !slices.Contains(orgs, id) {
|
||||
orgs = append(orgs, id)
|
||||
@@ -202,7 +204,7 @@ func credentialOrg(name string) string {
|
||||
func unboundAlerts(cfg config.Config) map[org.OrgID][]alert.Input {
|
||||
out := map[org.OrgID][]alert.Input{}
|
||||
seen := map[alert.Key]bool{}
|
||||
for _, name := range append([]string{""}, identityNames(cfg)...) {
|
||||
for _, name := range append([]string{string(identity.SystemID)}, identityNames(cfg)...) {
|
||||
orgName, granted := cfg.CredentialAccess(name)
|
||||
orgID := org.OrgID(credentialOrg(orgName))
|
||||
bound := cfg.Containers.BoundCredentials(orgName, granted, granted)
|
||||
@@ -301,7 +303,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 {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -23,7 +22,6 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/chattask"
|
||||
"github.com/samcharles93/archie-core/internal/app/servicekit"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/container"
|
||||
@@ -43,13 +41,12 @@ 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"
|
||||
@@ -178,8 +175,6 @@ type boot struct {
|
||||
// start, which read it as their resume points.
|
||||
runtimeVersions map[string]int64
|
||||
|
||||
chatTasks gateway.TaskCreator
|
||||
defaultChatIdentity string
|
||||
// messaging delivers outbound chat messages through the Messaging Service.
|
||||
messaging *messagingrpc.Client
|
||||
|
||||
@@ -294,7 +289,7 @@ func (b *boot) openStateStoreAdapter(ctx context.Context) error {
|
||||
if target == "" {
|
||||
return fmt.Errorf("services.state.target is required: archied/archie-gateway no longer own archie.db; the standalone archie-state-store process owns it (docs/prds/state-store-contract.md §12 step 7)")
|
||||
}
|
||||
client, cleanup, err := servicekit.StateStoreClient(presence.Daemon, b.cfg)
|
||||
client, cleanup, err := servicekit.StateStoreClient(presence.Daemon, b.cfg, staterpc.WithCallDeadline(stateCallDeadline))
|
||||
if err != nil {
|
||||
b.log.ErrorContext(ctx, "state store adapter", "err", err)
|
||||
return err
|
||||
@@ -500,10 +495,8 @@ func (b *boot) setupContainers(ctx context.Context) func() {
|
||||
return closeDocker
|
||||
}
|
||||
|
||||
// setupGatewayClient dials the Gateway, which owns every model call. The daemon
|
||||
// only enqueues the chat tasks scheduled workflows create.
|
||||
// setupGatewayClient dials the Gateway, which owns every model call.
|
||||
func (b *boot) setupGatewayClient(ctx context.Context) error {
|
||||
b.setupChatTasks(b.cfg)
|
||||
contract, cleanup, err := composeChatContract(b.cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -587,9 +580,21 @@ func (b *boot) registerNATSRPC() error {
|
||||
return err
|
||||
}
|
||||
b.addCleanup(unsubscribeTaskActions)
|
||||
|
||||
unsubscribeIssues, err := (&issuerpc.Server{Forge: b.issueForge, 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 forge of owner/repo's own connection.
|
||||
func (b *boot) issueForge(ctx context.Context, owner, repo string) (forge.IssueForge, error) {
|
||||
return b.repositoryForge(ctx, owner, repo)
|
||||
}
|
||||
|
||||
func (b *boot) buildDaemon() {
|
||||
log := b.log
|
||||
b.d = &daemon.Daemon{
|
||||
@@ -614,7 +619,6 @@ func (b *boot) buildDaemon() {
|
||||
TaskInstructions: b.taskInstructions,
|
||||
IssueSources: b.issueSources,
|
||||
OrgPrincipals: b.orgPrincipals,
|
||||
RootIdentityID: identity.StableID(servicekit.IdentityNames(b.cfg)[0]),
|
||||
TaskLogs: b.taskLogs,
|
||||
AgentStatus: b.agentStatus,
|
||||
WorkflowDefinitions: b.workflowDefinitions,
|
||||
@@ -658,7 +662,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 +672,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.
|
||||
@@ -822,18 +788,6 @@ func (b *boot) runLoop(ctx context.Context, once bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// setupChatTasks wires the task creator scheduled workflows enqueue through.
|
||||
func (b *boot) setupChatTasks(cfg config.Config) {
|
||||
profiles, defaultChatIdentity := chattask.Profiles(cfg)
|
||||
if len(profiles) > 0 {
|
||||
b.chatTasks = gateway.NewStoreTaskCreatorForProfiles(
|
||||
chattask.Writer{Enqueue: b.stateStore.EnqueueChatTask},
|
||||
profiles,
|
||||
)
|
||||
}
|
||||
b.defaultChatIdentity = defaultChatIdentity
|
||||
}
|
||||
|
||||
func (b *boot) addCleanup(fn func()) {
|
||||
b.cleanups = append(b.cleanups, fn)
|
||||
}
|
||||
@@ -849,7 +803,12 @@ func (b *boot) loadCatalog(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
models := modelcatalog.Apply(&b.cfg, snapshot)
|
||||
b.cfgHolder.Set(b.cfg.Clone())
|
||||
// Layer the catalog over the live config, not b.cfg: b.cfg predates the
|
||||
// execution-settings watch, so publishing it would put the file's budgets
|
||||
// back over the control plane's.
|
||||
live := b.cfgHolder.Get().Clone()
|
||||
modelcatalog.Apply(&live, snapshot)
|
||||
b.cfgHolder.Set(live)
|
||||
b.catalog.Set(snapshot)
|
||||
b.log.InfoContext(ctx, "model catalog loaded", "providers", len(snapshot.Providers), "models", len(models))
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/app/servicekit"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/daemon"
|
||||
"github.com/samcharles93/archie-core/internal/domain/access"
|
||||
@@ -14,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// orgAgents is every organisation with the principals that may act in it,
|
||||
// system org first. The system org's own root identity leads its list.
|
||||
// system org first. System leads the system org's list.
|
||||
type orgAgents struct {
|
||||
owner org.OrgID
|
||||
principals []access.Principal
|
||||
@@ -63,8 +62,7 @@ func (b *boot) organisations(ctx context.Context) []orgAgents {
|
||||
for _, owner := range b.owners(ctx, directory) {
|
||||
entry := orgAgents{owner: owner}
|
||||
if owner == org.DefaultOrgID && directory != nil {
|
||||
root := identity.StableID(servicekit.IdentityNames(b.cfgHolder.Get())[0])
|
||||
if principal, err := directory.PrincipalFor(ctx, root); err == nil {
|
||||
if principal, err := directory.PrincipalFor(ctx, identity.SystemID); err == nil {
|
||||
entry.principals = append(entry.principals, principal)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,25 +343,13 @@ 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
|
||||
}}
|
||||
messages := &messagerpc.Server{Runs: runs, Deliver: deliver, Log: log}
|
||||
for _, identity := range []string{"", "*"} {
|
||||
stop, err := messages.RegisterFor(nc, identity)
|
||||
if err != nil {
|
||||
unsubscribe()
|
||||
return nil, err
|
||||
}
|
||||
unsubs = append(unsubs, stop)
|
||||
stop, err = fg.RegisterFor(nc, identity)
|
||||
if err != nil {
|
||||
unsubscribe()
|
||||
return nil, err
|
||||
}
|
||||
unsubs = append(unsubs, stop)
|
||||
stop, err = trees.RegisterFor(nc, identity)
|
||||
for _, register := range []func(*natsio.Conn, string) (func(), error){messages.RegisterFor, fg.RegisterFor, trees.RegisterFor} {
|
||||
stop, err := register(nc, "*")
|
||||
if err != nil {
|
||||
unsubscribe()
|
||||
return nil, err
|
||||
|
||||
@@ -104,7 +104,7 @@ func validOrigin(origin string) bool {
|
||||
|
||||
func outcomeText(t *task.Task) string {
|
||||
title := notificationTitle(t.Title)
|
||||
if kind := taskstate.ApprovalKind(t.Status, t.ReviewGate); kind != "" {
|
||||
if kind := taskstate.ApprovalKind(t.Status, t.ReviewGate, t.RetryMode); kind != "" {
|
||||
return fmt.Sprintf("Task %d (%s) needs your approval of its %s. Approve or reject it on the task page.", t.ID, title, approvalNoun[kind])
|
||||
}
|
||||
if t.Status == task.StatusPROpen {
|
||||
@@ -141,4 +141,5 @@ func notificationTitle(title string) string {
|
||||
var approvalNoun = map[string]string{
|
||||
taskstate.ApprovalPlan: "plan",
|
||||
taskstate.ApprovalReview: "review findings",
|
||||
taskstate.ApprovalBudget: "request to continue past its step budget",
|
||||
}
|
||||
@@ -34,6 +34,12 @@ func (b *boot) setupReadinessProbes() {
|
||||
_, err := b.stateStore.StatusCounts(ctx)
|
||||
return err
|
||||
}),
|
||||
runLoopProbe{stalest: func() (string, time.Time) {
|
||||
if b.d == nil {
|
||||
return "", time.Time{}
|
||||
}
|
||||
return b.d.StalestLoop()
|
||||
}, cadence: b.loopCadence},
|
||||
readiness.NewConfigProbe(b.cfgHolder.Get, configuration.Validate),
|
||||
readiness.NewDiskProbeTargets(diskProbeTargets(cfg)),
|
||||
// The daemon no longer runs a chat channel, so it cannot observe one's
|
||||
@@ -100,3 +106,32 @@ func (unscopedBroker) Name() string { return "nats_credential_scope" }
|
||||
func (unscopedBroker) Check(context.Context) health.Result {
|
||||
return health.Result{Status: health.StatusDegraded, Detail: "external NATS: containers get a broker token that reaches every subject; use the embedded broker"}
|
||||
}
|
||||
|
||||
// stateCallDeadline bounds each State Store call the daemon makes without a
|
||||
// deadline of its own.
|
||||
const stateCallDeadline = 20 * time.Second
|
||||
|
||||
// runLoopStallFactor is how many poll intervals a loop may go without
|
||||
// beginning a pass before it is reported degraded.
|
||||
const runLoopStallFactor = 3
|
||||
|
||||
// runLoopProbe reports a run loop that has stopped beginning passes, for
|
||||
// instance blocked on a slow State Store.
|
||||
type runLoopProbe struct {
|
||||
stalest func() (string, time.Time)
|
||||
cadence func() time.Duration
|
||||
}
|
||||
|
||||
func (runLoopProbe) Name() string { return "run_loop" }
|
||||
|
||||
func (p runLoopProbe) Check(context.Context) health.Result {
|
||||
loop, last := p.stalest()
|
||||
if last.IsZero() {
|
||||
return health.Result{Status: health.StatusOK}
|
||||
}
|
||||
limit := max(p.cadence()*runLoopStallFactor, time.Minute)
|
||||
if age := time.Since(last); age > limit {
|
||||
return health.Result{Status: health.StatusDegraded, Detail: loop + " loop has not begun a pass for " + age.Round(time.Second).String()}
|
||||
}
|
||||
return health.Result{Status: health.StatusOK}
|
||||
}
|
||||
@@ -17,7 +17,13 @@ import (
|
||||
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`
|
||||
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 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.
|
||||
@@ -31,6 +37,10 @@ func RunRelease(args []string, out, stderr io.Writer) int {
|
||||
return runReleaseKeygen(args[1:], out, stderr)
|
||||
case "publish":
|
||||
return runReleasePublish(args[1:], out, stderr)
|
||||
case "promote":
|
||||
return runReleasePromote(args[1:], out, stderr)
|
||||
case "canary":
|
||||
return runReleaseCanary(args[1:], out, stderr)
|
||||
default:
|
||||
fmt.Fprintln(stderr, releaseUsage)
|
||||
return 2
|
||||
@@ -79,7 +89,7 @@ func runReleasePublish(args []string, out, stderr io.Writer) int {
|
||||
flags.StringVar(&req.Repository, "source", "", "OCI repository to publish to")
|
||||
seedEnv := flags.String("seed-env", "ARCHIE_RELEASE_SEED", "environment variable holding the base64 private key seed")
|
||||
flags.StringVar(&req.Version, "version", "", "release version")
|
||||
flags.BoolVar(&req.Prerelease, "prerelease", false, "publish to next only")
|
||||
flags.BoolVar(&req.Prerelease, "prerelease", false, "mark the release a prerelease, which never reaches stable")
|
||||
flags.StringVar(&req.ZipPath, "zip", "", "distribution zip")
|
||||
flags.StringVar(&req.AgentImage, "agent-image", "", "agent image pinned by digest")
|
||||
flags.StringVar(&req.Changelog, "changelog", "", "URL of the release notes")
|
||||
@@ -97,10 +107,8 @@ func runReleasePublish(args []string, out, stderr io.Writer) int {
|
||||
}
|
||||
req.Signer = ed25519.NewKeyFromSeed(seed)
|
||||
public := distribution.EncodeKey(ed25519.PublicKey(req.Signer[ed25519.SeedSize:]))
|
||||
// stable moves only when the canary promotes the release.
|
||||
req.Channels = []string{"next"}
|
||||
if !req.Prerelease {
|
||||
req.Channels = append(req.Channels, "stable")
|
||||
}
|
||||
statement, err := releaseupdate.Publish(context.Background(), req)
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, err)
|
||||
@@ -110,3 +118,39 @@ func runReleasePublish(args []string, out, stderr io.Writer) int {
|
||||
strings.Join(req.Channels, ", "), public)
|
||||
return 0
|
||||
}
|
||||
|
||||
// runReleasePromote moves stable without a canary verdict, under the same
|
||||
// rules the canary promotes by.
|
||||
func runReleasePromote(args []string, out, stderr io.Writer) int {
|
||||
flags := flag.NewFlagSet("release promote", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
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")
|
||||
version := flags.String("version", "", "release to promote")
|
||||
latest := flags.String("latest", "", "comma-separated image repositories whose v<version> tag becomes latest")
|
||||
if err := flags.Parse(args); err != nil {
|
||||
return 2
|
||||
}
|
||||
source, err := distribution.Parse(*reference, *key, distribution.DefaultReleases())
|
||||
if err != nil || *version == "" {
|
||||
fmt.Fprintln(stderr, "release promote: -version is required, and -source with -key name another source")
|
||||
return 2
|
||||
}
|
||||
statement, err := releaseupdate.Promote(context.Background(), source.Reference, source.Key, *version, splitList(*latest))
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, err)
|
||||
return 1
|
||||
}
|
||||
fmt.Fprintf(out, "stable is %s\n", statement.Version)
|
||||
return 0
|
||||
}
|
||||
|
||||
func splitList(value string) []string {
|
||||
var items []string
|
||||
for item := range strings.SplitSeq(value, ",") {
|
||||
if item = strings.TrimSpace(item); item != "" {
|
||||
items = append(items, item)
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
@@ -0,0 +1,656 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"oras.land/oras-go/v2/errdef"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/distribution"
|
||||
"github.com/samcharles93/archie-core/internal/releaseupdate"
|
||||
)
|
||||
|
||||
// canaryInstallWait bounds how long an install on the canary may take,
|
||||
// including the watchdog's health wait and a rollback.
|
||||
const canaryInstallWait = 20 * time.Minute
|
||||
|
||||
// migrationsDir holds the schema migrations; a release that changes it can't
|
||||
// be rolled back without restoring the database snapshot.
|
||||
const migrationsDir = "internal/infrastructure/postgres/migrations"
|
||||
|
||||
func runReleaseCanary(args []string, out, stderr io.Writer) int {
|
||||
if len(args) == 0 {
|
||||
fmt.Fprintln(stderr, releaseUsage)
|
||||
return 2
|
||||
}
|
||||
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, 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, err := canaryDashboard(*dashboardURL, *tokenEnv)
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, "release canary status:", err)
|
||||
return 2
|
||||
}
|
||||
source, err := canarySource(*reference, *key)
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, "release canary status:", err)
|
||||
return 2
|
||||
}
|
||||
if err := printCanaryStatus(context.Background(), dashboard, source, *window, out); err != nil {
|
||||
fmt.Fprintln(stderr, "release canary status:", err)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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 err
|
||||
}
|
||||
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, run.installedAt, now, window)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read canary signals: %w", err)
|
||||
}
|
||||
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)
|
||||
}
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
if err != nil {
|
||||
return 1, err
|
||||
}
|
||||
fmt.Fprintf(out, "held on %s %s, nothing to judge\n", channel, pin)
|
||||
return 0, nil
|
||||
}
|
||||
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 !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)
|
||||
}
|
||||
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.
|
||||
// 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,14 @@ package archied
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/go-git/go-git/v6"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/daemon"
|
||||
@@ -12,6 +18,7 @@ import (
|
||||
"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"
|
||||
)
|
||||
@@ -52,6 +59,38 @@ func (b *boot) repositoryAccess(ctx context.Context, task *workflow.Task, operat
|
||||
return failure("connection_missing", "The selected connection no longer exists. Choose another connection.")
|
||||
}
|
||||
|
||||
// repositoryForge is the forge client of owner/repo's own connection, for
|
||||
// operator and chat actions, in the org ctx carries. The instance's default
|
||||
// forge may be a different host entirely.
|
||||
func (b *boot) repositoryForge(ctx context.Context, owner, repo string) (forge.Forge, error) {
|
||||
repository, err := b.repositoryBinding(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if repository.Connection == "" {
|
||||
return nil, &forge.AccessError{Code: "connection_required", Message: "Choose a connection for this repository."}
|
||||
}
|
||||
connections, err := b.repositoryConnections(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, connection := range connections {
|
||||
if connection.ID != repository.Connection {
|
||||
continue
|
||||
}
|
||||
token, code, message := b.connectionToken(ctx, connection)
|
||||
if code != "" {
|
||||
return nil, &forge.AccessError{Code: code, Connection: connection.ID, Message: message}
|
||||
}
|
||||
client := b.connectionForge(ctx, connection, org.OrgFromContext(ctx), token)
|
||||
if _, disabled := client.(*forge.NoopForge); disabled {
|
||||
return nil, &forge.AccessError{Code: "forge_unavailable", Connection: connection.ID, Message: "Enable the forge extension for this connection."}
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
return nil, &forge.AccessError{Code: "connection_missing", Connection: repository.Connection, Message: "The selected connection no longer exists. Choose another connection."}
|
||||
}
|
||||
|
||||
func (b *boot) repositoryBinding(ctx context.Context, owner, name string) (config.Repo, error) {
|
||||
var repos []config.Repo
|
||||
_, found, err := b.controlPlane.Query(ctx, controlplanestore.RepositoryPoliciesKind, func(value []byte) error { return json.Unmarshal(value, &repos) })
|
||||
@@ -90,24 +129,45 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
|
||||
if !connection.Permitted(string(principal.IdentityID), operation) {
|
||||
return failure("operation_denied", fmt.Sprintf("Allow this agent to %s through %s before continuing.", operation, connection.Name))
|
||||
}
|
||||
token, err := b.secrets.Resolve(connection.Token)
|
||||
if err != nil || token == "" {
|
||||
return failure("credential_unavailable", fmt.Sprintf("The credential for %s is unavailable. Check its secret reference.", connection.Name))
|
||||
token, code, message := b.connectionToken(ctx, connection)
|
||||
if code != "" {
|
||||
return failure(code, message)
|
||||
}
|
||||
host := strings.TrimRight(connection.Host, "/")
|
||||
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
|
||||
err error
|
||||
)
|
||||
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 +175,67 @@ func (b *boot) openRepositoryConnection(ctx context.Context, principal access.Pr
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// connectionToken resolves the connection's credential, or returns a failure
|
||||
// code and message. A full volume is reported as such, not as a bad reference.
|
||||
func (b *boot) connectionToken(ctx context.Context, connection config.ForgeConnection) (string, string, string) {
|
||||
token, err := b.secrets.Resolve(connection.Token)
|
||||
if volume, full := exhaustedVolume(err); full {
|
||||
b.log.ErrorContext(ctx, "secret resolution failed: host resource exhausted", "connection", connection.ID, "volume", volume, "error", err)
|
||||
return "", "environment_exhausted", fmt.Sprintf("The host has run out of space on %s, so the credential for %s cannot be read. Free space there.", volume, connection.Name)
|
||||
}
|
||||
if err != nil || token == "" {
|
||||
return "", "credential_unavailable", fmt.Sprintf("The credential for %s is unavailable. Check its secret reference.", connection.Name)
|
||||
}
|
||||
return token, "", ""
|
||||
}
|
||||
|
||||
// exhaustedVolume reports whether err is a full volume or quota and names the
|
||||
// volume, so the failure reads as an environment problem rather than a
|
||||
// misconfigured secret.
|
||||
func exhaustedVolume(err error) (string, bool) {
|
||||
if !errors.Is(err, syscall.ENOSPC) && !errors.Is(err, syscall.EDQUOT) {
|
||||
return "", false
|
||||
}
|
||||
if pathErr, ok := errors.AsType[*fs.PathError](err); ok {
|
||||
return filepath.Dir(pathErr.Path), true
|
||||
}
|
||||
return "the host volume", true
|
||||
}
|
||||
|
||||
// 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, "", ""
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package archied
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"net/http/cgi"
|
||||
@@ -28,6 +29,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
"github.com/samcharles93/archie-core/internal/domain/org"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanestore"
|
||||
"github.com/samcharles93/archie-core/internal/secret"
|
||||
@@ -299,3 +301,40 @@ func TestConnectionAccountRefusesRedirects(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type recordingForge struct {
|
||||
forge.Forge
|
||||
merged bool
|
||||
}
|
||||
|
||||
func (f *recordingForge) MergePR(context.Context, string, string, int) error {
|
||||
f.merged = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// An operator merge goes through the repository's own connection: the
|
||||
// instance's default forge may be another host that does not have the repo.
|
||||
func TestMergeUsesRepositoryConnection(t *testing.T) {
|
||||
t.Setenv("ARCHIE_TEST_CONNECTION_TOKEN", "token")
|
||||
docs := &repositoryDocuments{
|
||||
repos: map[org.OrgID][]config.Repo{"org-a": {{Owner: "acme", Name: "app", Connection: "gitea"}}},
|
||||
connections: map[org.OrgID][]config.ForgeConnection{"org-a": {{ID: "gitea", Name: "Gitea", Type: "gitea", Host: "git.example.test", Token: config.SecretRef{Engine: "env", Key: "ARCHIE_TEST_CONNECTION_TOKEN"}}}},
|
||||
}
|
||||
instance := &recordingForge{}
|
||||
b := &boot{controlPlane: controlplanestore.NewRPCClient(docs), forgeClient: instance, cfgHolder: config.NewHolder(config.Config{}), secrets: secret.NewRegistry(), log: slog.New(slog.DiscardHandler)}
|
||||
for _, tt := range []struct{ name, owner, repo, code string }{
|
||||
{"bound repository", "acme", "app", "forge_unavailable"},
|
||||
{"unmanaged repository", "acme", "other", "repository_not_configured"},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := b.mergePR(org.WithOrg(t.Context(), "org-a"), tt.owner, tt.repo, 1)
|
||||
accessErr, ok := errors.AsType[*forge.AccessError](err)
|
||||
if !ok || accessErr.Code != tt.code {
|
||||
t.Fatalf("error = %v, want code %s", err, tt.code)
|
||||
}
|
||||
if instance.merged {
|
||||
t.Fatal("merged through the instance forge")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/egress"
|
||||
)
|
||||
@@ -41,7 +42,7 @@ func TestEgressResolvesOnlyGrantedCredentials(t *testing.T) {
|
||||
}},
|
||||
}
|
||||
r := runCredentialResolver{
|
||||
runs: runsByToken{"dashboard-run": {ID: 9, Identity: "new-agent"}, "root-run": {ID: 1}, "acme-run": {ID: 2, Identity: "acme-bot", Org: "acme"}, "acme-row-run": {ID: 3, Org: "acme"}},
|
||||
runs: runsByToken{"dashboard-run": {ID: 9, Identity: "new-agent"}, "root-run": {ID: 1, Identity: string(identity.SystemID)}, "acme-run": {ID: 2, Identity: "acme-bot", Org: "acme"}, "acme-row-run": {ID: 3, Org: "acme"}},
|
||||
config: config.NewHolder(cfg),
|
||||
secrets: secretValues{"GH": "gh-secret", "ROOT_AI": "root-ai", "ACME_AI": "acme-ai", "ROOT_OPENAI": "root-openai", "ACME_OPENAI": "acme-openai", "ROOT_DEEPSEEK": "root-deepseek"},
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// sd_notify.go wires the daemon into internal/sdnotify's implementation of
|
||||
// systemd's sd_notify(3) protocol: one READY=1 when the run loop starts
|
||||
// serving, and a WATCHDOG=1 heartbeat while the run loop is demonstrably still
|
||||
// making progress.
|
||||
// serving, and a WATCHDOG=1 heartbeat while the process is alive.
|
||||
//
|
||||
// The protocol client and the heartbeat sampler live in internal/sdnotify
|
||||
// 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
|
||||
// without beginning a poll pass.
|
||||
// A run loop that stalls on a slow peer is reported by the run_loop readiness
|
||||
// probe, never by withholding the heartbeat.
|
||||
//
|
||||
// Nothing here is fatal -- a process with no NOTIFY_SOCKET (a plain terminal,
|
||||
// Docker, a user unit without WatchdogSec) sends nothing and serves exactly as
|
||||
@@ -37,7 +35,7 @@ func (b *boot) announceReady() {
|
||||
sdnotify.Ready(b.log)
|
||||
}
|
||||
|
||||
// startWatchdog arms the heartbeat sampler for the daemon's run loop. It does
|
||||
// startWatchdog arms the heartbeat. It does
|
||||
// nothing unless a manager named a notify socket and asked for a watchdog
|
||||
// (WATCHDOG_USEC), so every deployment without systemd is unaffected.
|
||||
func (b *boot) startWatchdog(ctx context.Context) {
|
||||
@@ -52,14 +50,10 @@ func (b *boot) startWatchdog(ctx context.Context) {
|
||||
|
||||
sampler := sdnotify.Watchdog{
|
||||
Interval: interval,
|
||||
Cadence: b.loopCadence,
|
||||
Progress: b.d.LastPollAt,
|
||||
Beat: func() { n.Send(sdnotify.WatchdogState) },
|
||||
Log: b.log,
|
||||
}
|
||||
b.log.InfoContext(ctx, "systemd watchdog armed",
|
||||
"heartbeat", interval.String(),
|
||||
"loop_cadence", b.loopCadence().String())
|
||||
"heartbeat", interval.String())
|
||||
|
||||
go func() {
|
||||
if err := sampler.Run(ctx); err != nil && !errors.Is(err, context.Canceled) {
|
||||
@@ -68,11 +62,8 @@ func (b *boot) startWatchdog(ctx context.Context) {
|
||||
}()
|
||||
}
|
||||
|
||||
// loopCadence is the longest interval at which the run loop may go without
|
||||
// beginning a fresh poll pass, and therefore how stale the progress marker may
|
||||
// be before the loop counts as stalled.
|
||||
//
|
||||
// The shared interval is re-read so live polling changes are honoured.
|
||||
// loopCadence is the interval at which the run loop begins a poll pass. The
|
||||
// shared interval is re-read so live polling changes are honoured.
|
||||
func (b *boot) loopCadence() time.Duration {
|
||||
return b.cfgHolder.Get().PollInterval.Std()
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package archied
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/taskactions"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
@@ -29,15 +28,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
|
||||
@@ -46,24 +36,27 @@ func (b *boot) cancelTask(id int64) bool {
|
||||
}
|
||||
|
||||
func (b *boot) closeIssue(ctx context.Context, owner, repo string, number int, comment string) error {
|
||||
if b.forgeClient == nil {
|
||||
return fmt.Errorf("forge is not configured")
|
||||
f, err := b.repositoryForge(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return b.forgeClient.CloseIssue(ctx, owner, repo, number, comment)
|
||||
return f.CloseIssue(ctx, owner, repo, number, comment)
|
||||
}
|
||||
|
||||
func (b *boot) closePR(ctx context.Context, owner, repo string, number int, comment string) error {
|
||||
if b.forgeClient == nil {
|
||||
return fmt.Errorf("forge is not configured")
|
||||
f, err := b.repositoryForge(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return b.forgeClient.ClosePR(ctx, owner, repo, number, comment)
|
||||
return f.ClosePR(ctx, owner, repo, number, comment)
|
||||
}
|
||||
|
||||
func (b *boot) mergePR(ctx context.Context, owner, repo string, number int) error {
|
||||
if b.forgeClient == nil {
|
||||
return fmt.Errorf("forge is not configured")
|
||||
f, err := b.repositoryForge(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return b.forgeClient.MergePR(ctx, owner, repo, number)
|
||||
return f.MergePR(ctx, owner, repo, number)
|
||||
}
|
||||
|
||||
func (b *boot) removeTaskLogs(id int64) error {
|
||||
@@ -77,6 +70,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})
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,10 +26,16 @@ func (b *server) setSkillList(entries []skill.CatalogEntry) {
|
||||
// channels, so channel reload is left unset and answers Unavailable.
|
||||
func (b *server) chatCatalog() gatewayrpc.Catalog {
|
||||
return gatewayrpc.Catalog{
|
||||
CheckSecret: func(ref secret.SecretRef) bool { _, err := b.secrets.Resolve(ref); return err == nil },
|
||||
Logs: b.recentLogs,
|
||||
Skills: b.skillEntries,
|
||||
Curators: b.curatorStates,
|
||||
CheckSecret: func(ref secret.SecretRef) (bool, error) {
|
||||
if _, ok := b.secrets.Get(ref.Engine); !ok {
|
||||
return false, fmt.Errorf("secret engine %q is not reachable", ref.Engine)
|
||||
}
|
||||
_, err := b.secrets.Resolve(ref)
|
||||
return err == nil, nil
|
||||
},
|
||||
Logs: b.recentLogs,
|
||||
Skills: b.skillEntries,
|
||||
Curators: b.curatorStates,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-11
@@ -1,6 +1,4 @@
|
||||
// Package chattask derives the chat task profiles a config allows and adapts
|
||||
// the State Store's enqueue call to the gateway's task writer.
|
||||
package chattask
|
||||
package archiegateway
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -12,8 +10,8 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/gateway"
|
||||
)
|
||||
|
||||
// Writer adapts an enqueue call returning the task to gateway.TaskWriter.
|
||||
type Writer struct {
|
||||
// chatTaskWriter adapts an enqueue call returning the task to gateway.TaskWriter.
|
||||
type chatTaskWriter struct {
|
||||
Enqueue func(
|
||||
ctx context.Context,
|
||||
owner, repo, title, body, workflow, identity, origin, draft string,
|
||||
@@ -21,7 +19,7 @@ type Writer struct {
|
||||
) (*workflow.Task, error)
|
||||
}
|
||||
|
||||
func (a Writer) EnqueueChatTask(
|
||||
func (a chatTaskWriter) EnqueueChatTask(
|
||||
ctx context.Context,
|
||||
owner, repo, title, body, workflow, identity, origin string,
|
||||
inputs map[string]any,
|
||||
@@ -36,15 +34,15 @@ func (a Writer) EnqueueChatTask(
|
||||
return task.ID, nil
|
||||
}
|
||||
|
||||
// Profiles returns the task profiles cfg allows and the default identity.
|
||||
func Profiles(cfg config.Config) ([]gateway.TaskProfile, string) {
|
||||
// chatTaskProfiles returns the task profiles cfg allows and the default identity.
|
||||
func chatTaskProfiles(cfg config.Config) ([]gateway.TaskProfile, string) {
|
||||
if len(cfg.Identities) > 0 {
|
||||
profiles := make([]gateway.TaskProfile, 0, len(cfg.Identities))
|
||||
for _, identity := range cfg.Identities {
|
||||
if len(identity.Repos) == 0 {
|
||||
continue
|
||||
}
|
||||
profiles = append(profiles, newProfile(identity.Name, identity.Repos))
|
||||
profiles = append(profiles, newChatTaskProfile(identity.Name, identity.Repos))
|
||||
}
|
||||
if len(profiles) == 0 {
|
||||
return nil, ""
|
||||
@@ -57,10 +55,10 @@ func Profiles(cfg config.Config) ([]gateway.TaskProfile, string) {
|
||||
// Chat acts as the control-plane operator, the identity the dashboard
|
||||
// stamps on the tasks it creates.
|
||||
operator := string(identity.OperatorID())
|
||||
return []gateway.TaskProfile{newProfile(operator, cfg.Repos)}, operator
|
||||
return []gateway.TaskProfile{newChatTaskProfile(operator, cfg.Repos)}, operator
|
||||
}
|
||||
|
||||
func newProfile(identity string, repos []config.Repo) gateway.TaskProfile {
|
||||
func newChatTaskProfile(identity string, repos []config.Repo) gateway.TaskProfile {
|
||||
allowed := make([]string, 0, len(repos))
|
||||
for _, repo := range repos {
|
||||
allowed = append(allowed, repo.Owner+"/"+repo.Name)
|
||||
@@ -107,7 +107,7 @@ func (a chatTaskListerAdapter) ListChatTasks(ctx context.Context, identity strin
|
||||
// started -- so the pinned definition answers there instead. A review wait and
|
||||
// every other status name the workflow the task is on or will run next.
|
||||
func (a chatTaskListerAdapter) chatWorkflow(ctx context.Context, task workflow.Task) string {
|
||||
if a.task == nil || taskstate.ApprovalKind(task.Status, task.ReviewGate) != taskstate.ApprovalPlan {
|
||||
if a.task == nil || taskstate.ApprovalKind(task.Status, task.ReviewGate, task.RetryMode) != taskstate.ApprovalPlan {
|
||||
return task.Workflow
|
||||
}
|
||||
full, err := a.task(ctx, task.ID)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/agentexec/modelloop"
|
||||
"github.com/samcharles93/archie-core/internal/app/chattask"
|
||||
"github.com/samcharles93/archie-core/internal/app/servicekit"
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
@@ -88,10 +87,10 @@ func (b *server) setupChatRuntime(ctx context.Context, cfg config.Config, actor
|
||||
// setupChatTasks wires the task creator chat commands and scheduled workflows
|
||||
// enqueue through.
|
||||
func (b *server) setupChatTasks(cfg config.Config) {
|
||||
profiles, defaultChatIdentity := chattask.Profiles(cfg)
|
||||
profiles, defaultChatIdentity := chatTaskProfiles(cfg)
|
||||
if len(profiles) > 0 {
|
||||
b.chatTasks = gateway.NewStoreTaskCreatorForProfiles(
|
||||
chattask.Writer{Enqueue: b.stateStore.EnqueueChatTask},
|
||||
chatTaskWriter{Enqueue: b.stateStore.EnqueueChatTask},
|
||||
profiles,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Loaded 100 of 807 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user