704 Commits
Author SHA1 Message Date
sam 073959b4f9 feat(memory): scope chat notes and preserve deletions on restore (#2069)
Keep personal notes private by default and require review before publishing shared notes. Restore backups and replay forgotten notes in one transaction, and retain the installed release when an unattended rollback could bring back forgotten notes.
2026-11-21 13:20:31 +11:00
sam e70c27faf9 fix(configuration): one provider table, so OpenRouter gets an endpoint (#2048)
The provider step wrote class "openrouter", which no ai-sdk class serves and
which egress cannot resolve a host for, so a provider the wizard offered could
never build a model session. The table now names the class that serves each
provider and the base URL it needs where the class has no default, setup writes
base_url with it, and the flag help is built from the same list.
2026-11-21 03:48:28 +11:00
sam 0346bfef77 fix(configuration): require containers.image instead of a private-registry default (#2054)
applyContainerDefaults no longer fills containers.image with a hard-coded
private-registry reference. An unset image now fails configuration
validation with 'containers.image is required for autonomous workflow
workers', so a fresh instance is told at startup (and via the readiness
probe at runtime) instead of at the first failed container pull.

Configs that relied on the default now set it explicitly: dev.toml (the
local task image:agent build, which e2e also overlays), plus commented
[containers] blocks in config.example.toml and standalone.toml. The
deploy docs no longer describe a code-level default.
2026-11-21 01:16:41 +11:00
sam 9cd31e48ca fix(openshell): sandboxes install scoped npm packages; egress endpoints allow encoded slashes (#1864) 2026-11-15 00:12:07 +11:00
sam 14e2474a49 feat(ui): workflow list shows triggers, steps, last run and delivery with an inline enabled switch; the workflow page header carries them too 2026-11-14 23:11:38 +11:00
sam 990cd9408c chore(gatewayrpc): remove the session-store RPCs no client called 2026-11-14 23:09:57 +11:00
sam 5d620461fe fix(openshell): sandboxes reach the embedded broker by the services host, and may open /dev/null and /proc (#1864) 2026-11-14 22:06:09 +11:00
sam 411632548c fix(openshell): a sandbox that fails to start reports its last log lines (#1864) 2026-11-14 21:59:42 +11:00
sam a262151cb9 fix(daemon): park pr_open tasks on permanent forge resolution failures (#1975) 2026-11-14 20:09:19 +11:00
sam 9f830db510 fix(daemon): publish polled issues only from authors with write access (#1830)
The issue poller published title and body of every labelled or assigned
issue to the agent. It now keeps only write-access authors, failing closed
when the forge cannot answer. The filter moves to forge.WriterIssues,
shared with the issue_list tool.
2026-11-14 18:31:54 +11:00
sam 80129b7dd6 fix(webui): capture list narrows to the requested workspace in the store query (#1335) 2026-11-14 15:29:36 +11:00
sam a8f1fc9ea3 fix(openshell): keyless model providers get an egress rule on their base URL's host and port (#1972) 2026-11-14 14:22:29 +11:00
sam 7148579544 fix(controlplanestore): the container runtime document stores egress_hosts (#1967) 2026-11-14 11:37:16 +11:00
sam 3225396cf1 fix(agent): pass the State Store CA base64-encoded; the OpenShell gateway rejects newlines in the environment (#1864) 2026-11-14 04:04:16 +11:00
sam 811cab57ac fix(openshell): short random sandbox names the gateway accepts (#1864) 2026-11-14 04:04:15 +11:00
sam 3a965e2a4f feat(nats): an external broker defers logins to archie through auth callout (#1866)
Task containers log in with their run credential on an external broker and
reach only their own subjects, decided by the embedded broker's authenticator.
The broker token is never put in a container environment.
2026-11-14 04:04:15 +11:00
sam 7d664d7efb fix(archied): label OpenShell gateway providers and sweep leftovers at boot (#1970) 2026-11-14 04:04:15 +11:00
sam 5edf58fd68 fix(daemon): reconcile and merge tasks whose PR was merged on the forge (#1872)
ListOpenPRs dropped org_id, so the reconciler resolved the forge and
worktrees in the default org instead of the task's own and skipped the
task silently. Select the org, log a skipped task, and let the Merge
action succeed when the forge reports the PR already merged.
2026-11-14 04:01:31 +11:00
sam da1795c597 feat(egress): Docker task containers reach allowed hosts through the egress proxy (#1967)
The task session carries containers.egress_hosts and the profile's remote MCP
hosts, and the container gets ProxyEnv with the relay exempt from the proxy so
the State Store and NATS dials bypass it. A host the session lists exactly may
resolve to a private address; wildcard and any-host matches may not.
egress_hosts moves from openshell to containers, as it applies to both runtimes.
2026-11-14 04:01:31 +11:00
sam a18a4f7500 fix(controlplanestore): refuse workflow writes that drop a workflow an intake route names (#1962) 2026-11-14 03:58:15 +11:00
sam 7ab209fa7e fix(sdnotify,staterpc): log with the request context so lines carry a trace id (#1936) 2026-11-14 03:57:07 +11:00
sam 5c02207d48 feat(openshell): connect to a gateway that requires mutual TLS (#1864) 2026-11-14 03:41:24 +11:00
sam 6c287b48e6 fix: return write-side close errors; the gate checks unhandled errors 2026-11-14 03:31:46 +11:00
sam 2096ae8267 feat(openshell): each sandbox's network policy admits only what its task needs (#1864, #1967)
Runtimes now take a task launch: image, mounts, env, the daemon's NATS
and State Store with the task's credentials, its model providers and the
hosts its tools may reach. Docker addresses them through the egress relay
as before. An OpenShell sandbox reaches NATS and the State Store over
plain TCP, the model providers with their credential bound, and the
task's remote MCP hosts and the allowed package registries; services
addressed by IP or loopback are named by the configured services host,
since sandbox policy admits only DNS names.
2026-11-14 03:24:37 +11:00
sam a1ec538a87 feat(openshell): task agents can run as OpenShell sandboxes (#1864)
Container runtime policies gain a runtime (docker or openshell) and the
OpenShell gateway's address, workspace and token, set on the container
runtime page and applied on restart. The OpenShell backend creates a
sandbox per task with the worktree and volumes bound in, reports when
the agent exits or outlives its maximum uptime, deletes the sandbox on
release, and sweeps this instance's leftovers at boot. Storage volumes
are created attachable to OpenShell sandboxes.
2026-11-14 03:07:57 +11:00
sam e7d3ed72e4 fix(container): task containers run on their own sandbox network behind the egress relay (#1867)
Each task container now gets an internal bridge with no host address,
shared only with the egress relay. NATS, the State Store and the model
proxy are reached through the relay's ports; a loopback State Store is
forwarded to the host gateway. The network is removed with the task, and
boot sweeps any a previous daemon left. The per-task State Store relay on
the host bridge is gone.
2026-11-14 00:14:21 +11:00
sam 41f44c43a1 feat(workflow): issue routing is a control-plane setting edited in the dashboard (#1959)
Label to workflow rules and a default workflow are the intake-routes
resource: ordered, case-insensitive, first rule wins, seeded with bug to
tdd, feature to feasibility, default triage. A write naming an undefined
workflow or an empty label is refused. The daemon reads it through the
workflow definitions client when pinning a task and at intake.

The kind indirection only carried this routing, so it is removed: the
per-kind NATS subjects (every consumer already bound archie.task.>) are
one subject, the envelope and playbook triggers lose their kind, and
x-intake-routes is dropped. The dashboard gets an Issue routing page
under Automation; the trigger card reads the same setting.
2026-11-13 20:28:52 +11:00
sam ca4b039cb4 feat(workflow): serve step type titles with the step vocabulary (#1961)
Each step type declares its title beside its factory and settings; the
control plane serves it in x-step-types, and the dashboard reads it instead
of a hand-written TYPE_TITLES table. Parallel and switch are YAML shapes, not
registered types, so their titles stay with the graph.
2026-11-13 20:26:27 +11:00
sam f4c304cfba refactor: log through the injected logger with context; NATS handlers root in the registering context (#1927) 2026-11-13 03:56:12 +11:00
sam afaea346ee refactor(access): authorization takes the caller's context instead of a stored one (#1925) 2026-11-13 03:54:05 +11:00
sam 68e8552f0d fix: log NATS ack and nak failures instead of discarding them (#1924) 2026-11-13 03:52:38 +11:00
sam 60c0f19e63 fix(forge): a close refused for open dependencies is a typed error across the boundary (#1922) 2026-11-13 03:47:34 +11:00
sam 892ed291b9 refactor(mcp): use the official MCP Go SDK for the client
Deletes the hand-written internal/tools/mcp client and transports. The
provider talks to an SDK ClientSession over CommandTransport,
StreamableClientTransport or SSEClientTransport, and reconnects when the
server exits. The http transport now keeps a real streamable session
instead of stateless POSTs. Sampling goes through one adapter, since the
SDK marks it deprecated (SEP-2577). message_endpoint is removed: the
SSE transport takes the POST URL from the server's endpoint event.
2026-11-13 03:44:55 +11:00
sam c5f24ec914 chore: delete code no binary reaches
Removes the Kit task-tool result shim (and with it the MCP go-sdk
dependency), the messaging enable/disable/restart helpers and channel
rebuild closures nothing calls since channels became extensions, the
unused messaging capability, ephemeral and text-fallback types, and
single stragglers in telemetry, releaseupdate, skill, storepkg and
webui. The egress sandbox relay stays for #1867.
2026-11-13 03:33:32 +11:00
sam db346b159d fix(webui): mark cookies Secure behind a TLS proxy; run gosec in the gate (#1919)
Cookies took Secure from r.TLS, which is nil behind a proxy that terminates
TLS, so sign-in cookies went out without it. Every dashboard cookie now goes
through one builder that reads the scheme the way the origin check does.

The worktree reset and the agent worker's chown walk use os.Root, so a
symlink swapped in mid-walk can't point them outside the worktree.

gosec runs in golangci-lint, tests included. G104, G115, G204 and G304 are
excluded in config; each remaining finding is fixed or suppressed at the site
with its reason.
2026-11-13 03:16:15 +11:00
sam 061227708d chore(release): remove the canary, release news, changelog and Woodpecker pipelines (#1917) 2026-11-13 02:35:59 +11:00
sam 98941c20a0 fix(controlplanestore): legacy channel settings drop the retired models key on migration (#1903)
deploy / plan (push) Canceled after 0s
deploy / gate (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
ci/woodpecker/push/deploy Pipeline was canceled
2026-11-12 23:12:57 +11:00
sam b97eb45275 style(staterpc): drop a blank line left by the removal
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Successful in 8m16s
2026-11-12 21:42:27 +11:00
sam 658a4cb50e chore(runtime): remove code left dead by the Kit removal (#1877)
Quality / check (pull_request) Canceled after 0s
ci/woodpecker/pr/quality Pipeline was canceled
Drops Client.TaskPrincipalForCredential and the principal_id field only
it read, Reporter.ReportToolCall, Pool.EnsureImage and Pool.Instance,
and the binding cipher's exported domain API. Clears the remaining
harness references from the audit target kinds, docs and comments.
2026-11-12 21:42:17 +11:00
sam f92c5b4536 chore(runtime): delete Kit and external agent harness support (#1877)
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Canceled after 7m39s
Archie runs its own agent loop only. Removes Kit resolution and launch,
the harness runner and adapters, the setup terminal and sandbox view,
harness secrets and OAuth capture (table dropped in migration 0075), the
task-tools contract that only Kit containers reached, and the
sandbox-kit-spec dependency. Agent profiles carry image and tools only.
The egress proxy keeps the model-session path; the sandbox relay code
stays for #1867.
2026-11-12 21:29:05 +11:00
sam c54d328f0d feat(store): run services as a non-superuser role and name every connection (#1857)
Every service connected to PostgreSQL as the database owner, which is a
superuser, so anything that compromised an app process owned the cluster, and
every connection reached the server with an empty application_name, so
pg_stat_activity could not say which service a session belonged to.

Split the DB credential into two login roles and name every pool:

- archie_migrator owns public and its objects and runs goose. Migrations run
  on a short-lived pool opened from the new migration_database_url, before the
  serving pool opens. It is not a superuser.
- archie_runtime serves requests with SELECT, INSERT, UPDATE, DELETE, sequence
  USAGE/SELECT and function EXECUTE only. It has no CREATE privilege, so it
  cannot change the schema.
- Every pool sets application_name: archie-state-store, archie-gateway, and a
  -migrate / -recovery / -schema / -provision suffix on the transient
  administrative connections. Existing one-URL installs keep working: an
  absent migration_database_url falls back to database_url and the migration
  runs on the serving pool exactly as before.

Provisioning is a new idempotent `archie-state-store provision` subcommand: it
needs an admin URL the services never hold (database owner or superuser),
creates or reconciles both roles, hands every public-schema object to the
migration role, revokes PUBLIC's CREATE on public, sets row-level grants, and
sets the migration role's default privileges so tables future migrations
create are usable without a hand-run grant. It stores SCRAM verifiers, refuses
superuser roles, and verifies the boundary before committing.

install.sh now provisions the bundled path and separates the credentials: the
superuser password the Compose database is created with lives only in a
compose-only postgres.env, while the env file the units load holds the
non-superuser PGPASSWORD. A bundled install that predates the split is
upgraded in place: the roles are created, the superuser password is rotated
out of the env file, and config.toml is moved to the runtime and migration
URLs. External databases keep their operator-managed credential; the
deployments README documents the one-shot provision command.

setup writes both bundled URLs, dev:postgres provisions the dev database, the
e2e stack provisions its throwaway server, and the deployment templates point
at the two roles.
2026-11-11 03:12:54 +11:00
sam 161e8f95bf perf(store): share one control-plane version read across all watchers (#1858)
The control-plane Watch was a 250 ms database poll per subscription: an idle instance ran about 180 transactions a second (archied 14 streams, gateway 5, dashboard 26), almost all sequential scans of the small resources table. The State Store now keeps one shared view of every stored resource version, read once per 250 ms window and reused by every Watch stream; a stream reads its own resource only when its kind's version advanced, so idle database work is one read per interval for the whole process whatever the subscriber count.

The watch contract is unchanged: resume from AfterVersion, no missed update (versions are monotonic per org and kind), the immediate seed probe, the same 250 ms latency bound (streams wake on the same window boundary), and a store error still ends the stream with Unavailable so the clients' existing reconnect backoff applies.
2026-11-11 03:03:37 +11:00
sam 0033933a58 perf(store): index the six unindexed foreign keys (#1860)
Postgres does not index the referencing side of a foreign key, so deleting or updating a parent row scanned the child table once per referencing row for the six keys that had no matching index: identity aliases and subjects, org memberships and agents, installed package requirements, and the task a handoff came from. Migration 0074 adds one supporting index per key; the foreign-key integrity checks on the restored snapshot pass, with every one of the 17 constraints now covered.
2026-11-11 02:49:37 +11:00
sam dcc12582ce feat(audit): set per-kind event retention from the instance (#1856)
deploy / plan (push) Successful in 35s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / archied-image (push) Canceled after 0s
deploy / gate (push) Canceled after 25s
ci/woodpecker/push/deploy Pipeline was canceled
The retention sweep applied one window to a code-fixed allowlist, and the
largest event kind (agent transcripts) was outside it, so the events table
grew whatever the instance set. The audit-retention document now takes
per-kind overrides, the dashboard offers each prunable kind its own window
from the server's list, and a kind without an override follows the default.
A security kind is refused where the document is written, and the sweep cuts
each kind at its own cutoff in one bounded, locked transaction.
2026-11-11 02:31:46 +11:00
sam 4728c8c253 feat(usage): report model usage per org with identity and cost (#1855)
Model usage was recorded per call and never read, so an org could not see
what it spent. Add the read side:

- model_usage carries identity_id. Task calls take it from the task row,
  chat and curator calls from the calling principal carried in the usage
  record, so an outbox replay keeps its attribution. Existing task rows are
  backfilled from tasks.
- StatsService.UsageTotals sums the caller org's rows by UTC day, source,
  provider, model and identity. The org comes from the principal, with no
  org parameter, so cross-org reads do not exist.
- GET /api/usage prices tokens at the catalog's list rate, netting cache
  hits, and reports calls to unpriced models as tokens only. The published
  catalog view now carries each model's cost.
- A new org Usage page behind a read_usage grant: admin and owner only,
  with a 7, 30 or 90 day range, totals, the daily series, and model, source
  and identity breakdowns. The org shell keeps it on the caller's own org.
2026-11-11 02:15:29 +11:00
sam 255e0c7ee0 feat(chat): titles read the reply too, and session memory sees what it already holds
deploy / plan (push) Successful in 7s
deploy / archied-image (push) Successful in 30s
ci/woodpecker/push/deploy Pipeline was successful
deploy / gate (push) Successful in 7m39s
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped
2026-11-11 00:10:00 +11:00
sam 44237b448b refactor(prompts): every model prompt is a file in internal/prompts
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / plan (push) Successful in 6s
ci/woodpecker/push/deploy Pipeline was canceled
deploy / gate (push) Canceled after 2m58s
2026-11-11 00:01:43 +11:00
sam 5ea115746c fix(dashboard): blocked tasks say what they need, and a provider refusal names its fix
deploy / plan (push) Successful in 6s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 5m37s
ci/woodpecker/push/deploy Pipeline was canceled
2026-11-10 23:19:29 +11:00
sam cc49fecc77 fix(egress): default base URL for the gemini-interactions provider class (#457) 2026-11-10 21:56:06 +11:00
sam e3ffefdc7d fix(identity): use System as the one root identity and record who created every task (#1851)
deploy / plan (push) Successful in 25s
deploy / gate (push) Successful in 7m57s
deploy / agent-image (push) Successful in 21s
deploy / dist-zip (push) Skipped
deploy / archied-image (push) Successful in 2m12s
Drop the bot_user-derived root identity and the empty-identity sentinel. System
polls forge connections and owns instance-level work; a polled task stores the
polling identity, task_queued and work_request_submitted carry task id, actor
and principal, and an empty task identity is refused. Migration 0072 moves
empty tasks.identity, the identity-grants root key and the old root's
connection permits to System so a re-poll dedups.
2026-11-10 20:01:16 +11:00