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.
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.
Schedules leave the schedules control-plane resource for State Store tables
behind a ScheduleService contract. A run is claimed per schedule slot, missed
slots fire once, the next run stays on the schedule's grid, cron is read in the
schedule-settings time zone, and failed runs are recorded and advance. Three
failures in a row raise a schedule.failing alert. A fired run records a
schedule-fired capture. Run history is pruned by age and count.
Removes the chat and spawn-task runners, the dangerous-payload guard and the
old schedules settings page.
The prd step returns the PRD as structured fields and human.approve takes
them as its document. The plan text every surface reads and the approval
card's layout are both rendered from that one document, so what the human
approves is what the implement workflow is handed. Replaces the separately
generated OpenUI view, which could drift from the plan.
agent.run gains views: the agent may return an OpenUI Lang view of its
answer through an optional view tool, read as steps.<id>.view. human.approve
stores it as the task's plan_view, and the approval card renders it with
the dashboard's own components, falling back to the plan text when there
is no view or it does not parse. The feasibility prd step uses it.
archied, archie-ui and the tool gateway re-read the stored policies on a 30s
ticker, so a forbid written seconds earlier did not stop a run. One
instance-wide revision now moves inside the transaction of every policy write,
and a decision reads it first and rebuilds the engine only when it moved.
A version read that fails, or a policy list that fails after a bump, refuses
with ErrChainUnavailable instead of standing on the last chain, so three call
sites now treat unavailable as availability rather than denial: dispatch leaves
the capture for the next cycle, a task start parks transient, and the tool
gateway reports the tool as unavailable.
* feat(state): durable operator alerts owned by the State Store
Alerts dedup on org+kind+subject, resolve themselves when a condition
clears, and are raised, resolved, dismissed and listed through the state
contract. Task transitions raise needs-human and failed alerts in the same
transaction; the store checks service health and prunes closed alerts.
Each raise and resolve queues a webhook delivery whose attempts are kept.
* feat(notify): deliver operator alerts to the webhook; raise config and release alerts
notify.webhook now receives raised and resolved alerts above a severity
threshold with HMAC-signed payloads, bounded retry and every attempt recorded
on the alert. archied raises model alias, provider and credential-binding
alerts from the effective configuration, an update alert from the release
channel, and a credential-rejected alert from the egress resolver. The
dashboard API lists and dismisses the caller's org's alerts.
* feat(ui): alert bell in the top bar and webhook alert settings
The bell lists the org's open alerts by severity with dismiss and a link per
alert, and refreshes from the event stream. The task settings page gains the
webhook severity threshold and signing secret. ui/dist rebuilt.
InsertChatTask and EnqueueCallTask computed MAX(issue_number)+1, so
concurrent inserts in one repository took the same number and the second
failed on the unique key. Both now bump a chat_issue_numbers row, seeded
from the existing maxima, whose row lock serializes allocation.
Sessions carry an org; listing, reading and writing a session, its
messages and its turns are limited to the caller's org. Another org's
session reads as not found and cannot be overwritten or appended to.
Sessions from before orgs belong to the system org.
Task agent runs and MCP sampling record against their task (billed to the
task's org); gateway chat turns, titles, sampling and curators record
against the system org. Rows carry source, workflow, step, alias,
provider/model and tokens for later chargeback.
A call site had no durable identity, so any retry of it -- a lost
EnqueueCallTask reply, a failed call-step record, a requeued attempt that
re-runs the stage -- started a second child and its work happened twice.
The call step's declared path within the run is that identity: wrapStep
sets it (branch-qualified, restored on return), a workflow.call step must
declare an id so two call sites cannot share one, and the key crosses
EnqueueCallTaskRequest.call_key into tasks.call_key, which EnqueueCallTask
upserts on so the retry returns the child already started.
A review reaction that landed while a remediate run owned the task failed the
pr_open guard, was acked and dropped, and the poll cursor advanced past it.
Runs against one task are serialised, so the unit is appended to
tasks.pending_reviews instead; the transition that returns the task to pr_open
promotes the oldest waiting review back to queued. A re-delivered unit is
absorbed by payload equality, never queued twice.
Each finished stage records the run's step results; a retry may name a resume
point, and the next attempt skips the steps before it with their results
loaded. A run with a repository resumes only on its pushed branch. The canvas
offers Resume/Re-run from here on parked runs.
A retry now carries the operator's worktree choice (refresh onto the base
branch or continue the work already pushed on the task branch) from the
dashboard through the task action to the daemon dispatch, and persists it
on the task row so it survives a reload. The daemon resolves the mode from
the task, never from the workflow; BeginRemediation records continue
explicitly so a remediation still resumes its pull request branch.
The operator-approval gate needs its conversation with the operator
persisted before it waits and its answer threaded back
(docs/prds/pr-review-operator-response.md, Decision 2). review_gate is a
text column beside review_payload, encoded by the package that owns the
type; rereview_rounds is a bigint counted only by the new guarded write.
RespondReviewGate is the one write beside RetryTask/BeginRemediation: a
transition-table guard, one from-status check, an optional round
increment, and a requeue in one transaction. The re-review cap is
enforced in the row under the guard's lock, and a refusal leaves the
task waiting and the row untouched, surfaced as ErrRereviewCapReached
(added to the wire error table and the conformance battery). The column
joins the column-listing ListTaskSummaries projection and UpdateTask, so
the dashboard reads the offer and the store round-trips the count.
A workflow declares named, typed outputs beside its inputs
(task.WorkflowInterface.Outputs). A run writes each one once through a
capture tool named after the output, or from a deterministic Go stage via
TaskContext.WriteOutput; the finish write persists them on tasks.outputs
before the outcome transition. A wait:true caller receives its successful
callee's outputs through WorkflowCallStatus and publishes one as its own
through a call step's outputs assignment.
Build authority: docs/prds/workflow-call-outputs.md.
- save time: WorkflowInterface.Validate checks output names and types;
checkCallOutputs checks a call's assignment against both declarations
and refuses outputs over a wait:false call.
- run time: undeclared, mistyped and required-but-missing values park the
run; published callee values are re-checked against the caller's type.
- storage/wire: tasks.outputs (goose 0024), reset by each claim so the set
is attempt-scoped; an encoded set past the structured-payload bound is
refused, not clipped. Task.outputs_json and
WorkflowCallStatusResponse.outputs_json carry it; task.Caller keeps its
two methods.
- examples: firewall-contain calls firewall-investigate and publishes its
summary as its own output.
An install that stayed in installed_packages left every contribution
unprojected: nothing made a package's workflow a usable org resource, and
nothing stopped it on removal. This lands projection for the workflow family,
the one kind whose org resource, validation and live read path all exist:
- storepkg.Service gains Projections (family -> projector): install resolves
each projected family's contributed names against the fetched
layer (FilesFromLayer), applies them, and on failure withdraws and removes
the half installation; remove withdraws before the record goes, so a failed
withdrawal keeps the package installed and usable.
- controlplane.WorkflowProjector merges the package's entries into the org's
workflow-definitions document — the same document the daemon's
WorkflowDefinitions client reads per dispatch, so a projected workflow is
usable at the next dispatch and a withdrawn one stops dispatching, without
restarts. A contributed id displacing an operator's own workflow is refused
(storepkg.ErrContributionCollision), never silently replaced.
- installed_package_contributions (migration 0023) records the entries a
package projected, so removal takes exactly its own contributions out.
- stateStoreDeps wires the projector set on the State Store's pool; the
composition is pinned by the live round-trip test over a real gRPC
connection.
Prompts, skills, MCP server definitions and default settings remain
unprojected: their contribution formats are not settled by docs/prds/store.md
and are left for their own slices rather than half-wired here.
An archie package declares its authority; nothing in the tree recorded the
operator's acceptance of it. This lands the acceptance-record slice of
docs/prds/store.md ("Authority"):
- storepkg.Authority gains Covers (the upper-bound predicate: equal or
narrower applies, wider does not) and Validate (forge-permission
vocabulary, no blank grants).
- Installed carries AcceptedAuthority (nil until accepted); install leaves it
unset, so an unaccepted package has no authority.
- AcceptPackageAuthority on the storepkg Manager records the acceptance
against the pinned digest and refuses grants the package does not declare
(storepkg.ErrAuthorityNotDeclared), carried over the wire.
- staterpc gains the admin-only AcceptPackageAuthority RPC;
InstalledPackage carries accepted_authority.
Telegram dropped every incoming photo, document, video and audio
message: the default handler required message text, and nothing on the
turn path knew media existed. The receiving path now closes the gap
end to end.
- telegram: extract the attachment from the update (largest photo, plus
document, video, video-note, audio and voice kinds), download its
bytes on the turn lane through getFile + the Bot API file link with a
20 MB gate, submit the turn with the attachment, and answer
unsupported content kinds (sticker, location, contact, poll) with a
clear notice instead of silence
- messaging: Inbound carries turn-scoped transport media and
MediaAttachment a Data field for in-process bytes; Message gains
Media attachment metadata which stores persist (Postgres jsonb via
migration 0020, memory store) with Data stripped at the persist
boundary, and pb.Message carries the metadata on the gateway wire
- gateway: TurnModelRequest threads the turn's media to the model seam
- archied: the chat turn model merges the attachments into the final
user message as ai-sdk image/file part entries, so vision-capable
models see the file for the turn it arrived in; stored history keeps
the placeholder note plus caption
Session log: messages carry what was sent as data (the attachment
metadata), not just prose. Transcript rendering of attachments and a
re-look capability are tracked as archie-core-jaba.
Recover the OAuth storage slice from f6079e9d and the missing workflow persistence error handling from f07c314e, adapted to the current step contract. Require encryption for OAuth token storage and verify RPC round trips and task-grant denial.
docs/prds/execution-tree-state-machine.md: step_executions (0017) is now the
durable per-step record; the dashboard's run detail (GET /api/tasks/{id}/
attempts) still folded stage_start/stage_finish events into a rail by hand,
and tasks.stage duplicated what StartStep/FinishStep already record properly.
Added the missing read:
- ListSteps(execution_id, attempt) -- attempt 0 lists every attempt of the
execution, oldest first, so the rail renders every attempt from one call.
New storecontract.StepReader (separate from StepRecorder: this is a
dashboard/API/dispatch action per the PRD's wire contract, never
task-scoped-grant callable), postgresdb.ListStepExecutions, staterpc
client/server/values.go plumbing, wired through state_store.go's Deps and
archieui/compose.go's Server.Steps the same optional-capability pattern
every other dashboard read uses.
- internal/webui/api_tasks_attempts.go: stageViewsFromSteps replaces
foldStages/finishStage/stageOutcome. Attempt bounds, event_count and which
attempt numbers exist stay sourced from events (an attempt can carry
events -- agent calls -- with no step), only the stage list itself moves.
The wire JSON contract is unchanged, so no frontend change was needed;
`task ui` confirms ui/dist still matches a fresh build.
- A running step past the task's own current attempt reads interrupted, not
running: RecoverStale (archie-core, still open per #1214) is what corrects
a crashed run's stale "running" row, and until it does this is the honest
read rather than trusting a row that may be stale.
Dropped tasks.stage and every reader, no fallback:
- Migration 0018 drops the column; tasks.sql's INSERT/UPDATE/RETURNING lists
and the sqlc-generated code no longer carry it.
- workflow.Task.Stage is gone; workflow.Run's in-flight "which stage is this"
bookkeeping moves to TaskContext.Stage (execution-time only, never
persisted -- park/finish's event tagging is its only reader).
- pb.Task.stage (wire field 10) is `[deprecated = true]`, not deleted (never
reuse a field number); staterpc's taskProto/taskValue no longer map it.
- taskactions.Task.Stage and the retry event's "previous_stage" data field
are gone: the operator-action package had no reader for the column beyond
echoing it.
- The chat /tasks command's per-task "workflow/stage" display drops to
workflow-only (ChatTaskSummary.Stage removed, workflowStage() deleted):
it was a genuine reader with no replacement in scope for this change.
Read the archie-web-ui skill and the state-store/daemon docs/development
pages first, per instruction. Stayed out of cancel/stop code throughout
(Pi's concurrent CancelExecution work); the only shared files touched
(workflow.go, daemon-adjacent SQL) got the smallest possible diff.
Plan item 3 of docs/prds/execution-tree-state-machine.md (archie-core-1220), on
top of the transition tables and ErrIllegalTransition enforcement (1214/1215,
archie-core-qdbo.5):
- Migration 0017 adds step_executions -- id, org_id, workspace_id, execution_id,
attempt, parent_id, depth, kind, name, called_execution_id, status, detail,
tokens_used, started_at, finished_at, indexed on (execution_id, attempt, id).
Ownership fields are stamped from the execution's row; depth is derived from
the parent, never supplied by a caller. Existing rows gain no backfilled
steps.
- task.Store (the workflow engine's mid-run facade) gains StartStep/FinishStep
(5 methods, within the 8 cap), with storecontract.StepRecorder fronting them
on the server; deadlineStore wraps both with its per-call timeout.
- The store enforces each write as one transaction: the guarded row write
under the shared step transition table plus the transition's own
stage_start/stage_finish event row. Staleness is decided before legality,
the way guardTransition decides it, and the store returns the persisted
event for the caller's post-commit publish -- the EmitDurable convention
(the daemon's event sink skips already-persisted rows by assigned ID), which
is why workflow.Run stops emitting stage events beside the store and no
longer discards step-write errors: a failed start or finish parks the
execution, and the stage does not run unrecorded. An interrupted stage
records interrupted rather than failed; a recording failure on that
shutdown path is logged and left to RecoverStale, which owns the
interrupted-execution sweep in plan item 6.
- The run credential of docs/prds/orgs-and-access.md authorises StartStep and
FinishStep on its own execution only: both requests carry the execution ID
the grant check verifies (FinishStep carries it because the interceptor
never reads the database), and FinishStep verifies handler-side that the
step really is that execution's. authorizesTaskScopedCall's sanctioned
widenings are now held as a lookup table so the next one stops growing a
switch.
- The PRD's wire contract is StartStep(execution, attempt, parent, kind, name)
-> step id; the responses also carry the persisted event (needed for the
post-commit publish) and FinishStep's request carries execution_id (needed
for the grant check) -- both noted here as deliberate additions to the PRD's
shorthand. called_execution_id exists in the table but not yet on the wire:
its named consumer is the workflow-call recording of plan item 4 (#1216).
Conformance drives both adapters; grant tests pin the own-execution scoping;
the wire sentinel set gains ErrInvalidStep (InvalidArgument, "step execution
invalid") for a step kind no consumer names.