bc215e8daa04500a161aff996ca2228ecbbdd9ce
67
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
845b192a89 |
feat(taskstate): count completed runs in the per-workflow stats
The transition table moved the no-change outcomes to StatusCompleted, so a run that opens no pull request now ends in a status the per-workflow stats did not count at all: it was not merged, not in review, not parked, and the workflows page would have shown it as a run that went nowhere. The count travels the whole State Store path, since every dashboard consumer reads it through the gRPC client rather than the local store. - WorkflowStats filters `completed` beside merged and pr_open; the SQL is the count, so a wrong filter reads as zero rather than failing, and TestWorkflowStatsCountsCompletedRuns holds it against a real store. - storecontract.WorkflowStat gains Completed (json "completed"), the proto message gains field 9, and workflowStatProto/workflowStatValue carry it; TestWorkflowStatProtoCarriesEveryField round-trips every field by name. - The gateway's chat task report names the status. - The dashboard counts a completed run as delivered in GatePulseCard's totals and badge numerator, and the WorkflowStat/WorkflowStats/WorkflowRow interfaces carry the field. - TestOutcomeSitesAreTransitionsFromRunning is the guard that keeps the producer and the table agreeing: it re-reads this package's tc.Outcome assignment sites from source and requires each status to be one internal/taskstate allows from running, so a new or moved site has to be adjudicated against the table instead of discovered on a live run. |
||
|
|
8ba0b90861 | feat(taskstate): end no-change runs as completed and clean their worktrees | ||
|
|
8274ecbc53 |
fix(prreview): cluster duplicate findings and read every diff shape
The duplicate merge compared each finding against the ones already kept, so overlap was transitive only through the survivors: a chain of findings 1-2, 2-3, 3-4 collapsed to one finding or to two depending on the order they were handed in, and the two readings tied on score. It is a clustering now -- a canonical sort, then a union of each run of overlapping ranges -- so the surviving set is a property of the findings and not of the permutation they arrived in, and a cluster's member is chosen by score and then by the finding itself rather than by arrival order. Two things the merge got wrong besides order. The PRD keys duplicates on (file, overlapping lines, category), not on severity, so Finding carries a Category and the merge reads it, while the severity now only decides which duplicate speaks for the cluster. And a cluster is blocking when any member is, so an advisory duplicate can no longer swallow the merge gate's verdict and turn REQUEST_CHANGES into COMMENT. diff.go read only the shape git writes. A plain unified diff -- sections opened by a --- / +++ header pair with no "diff --git" line -- belonged to no file and contributed no added lines, a silent narrowing of the diff-rules gate's input; a file section opens from either now. git's C-quoted paths are decoded from the diff --git line, the --- / +++ headers and the rename pair, octal escapes to bytes, because a quoted path is not a path the snapshot has. FileStatus is derived from every statement the section makes -- new file mode, deleted file mode, old mode / new mode, rename from / rename to, and the /dev/null side -- so a binary or empty file, whose patch has no headers and no hunks, is reported as what it was rather than as a modification, and a change of object type is the typechange the change capture already persists. |
||
|
|
2657b18be7 |
fix(prreview): order the confidence floor before dedup and merge overlapping findings
Score recorded a finding's duplicate identity before dropping it under its severity's confidence floor, so a below-floor finding shadowed a later above-floor duplicate of the same defect. The floor now runs first, and the merge keeps the higher-scoring of two duplicates, so the result depends on which findings were given and not on the order they were given in. The duplicate rule was byte-identical line ranges. The PRD's rule is overlapping lines: two same-file, same-severity findings whose ranges share a line are now one finding. FileStatus said "removed" for a deleted file, a second vocabulary for the status the repository persists as "deleted". The value says "deleted" now. |
||
|
|
8c7ee60270 | style(prreview): adopt go fix rewrites in diff stats and snapshot | ||
|
|
54ade9713a |
feat(prreview): deterministic core of the PR review pipeline
Every phase of docs/prds/pr-review-agent.md that can be computed is computed here, in a package that imports the standard library only: diff parsing with renames, deletions, multi-hunk files and no-newline markers; directory clustering; per-language blast radius; evidence packages; scoring, deduplication, line mapping to diff coordinates and the review event. The review event is REQUEST_CHANGES when a finding is blocking and COMMENT otherwise; there is no approving value, because archie does not own the merge decision. internal/domain/workflow/prreview is now the one diff parser in this repository: the diff-rules step's addedDiffLines delegates to it and the private hunk-header and path helpers it used to carry are deleted, so a repository rule and a review comment cannot disagree about which line a change introduced. diff_rules_test.go is unchanged. Blast radius resolves Go imports through the module path in go.mod, Python module names, and JavaScript/TypeScript relative specifiers, all against files inside the snapshot; an import that resolves to nothing there contributes no edge. Evidence extraction reads through an fs.FS rooted at the snapshot, so both are tested against fstest.MapFS fixtures. NOTICE records the derivation from PR-AF (Apache-2.0). |
||
|
|
8fea8e8686 | feat(controlplane): field-level sys_audit table, audit view on settings pages, whole-task time limit | ||
|
|
d8bec1ae06 |
fix(eda): clear completed tasks; document the tool allowlist's reach and unchecked profile names
ClearTerminalTasks now deletes completed tasks, with a test that holds its SQL list to taskstate.Terminal. The AllowTools comment says agentloop's built-in file tools are outside the allowlist and why. The PRD model diagram lists only what a profile holds (image, tools), and the profile field and AgentProfile say a workflow's profile name is resolved at dispatch, not when the workflow is saved. |
||
|
|
d320a1a01a |
feat(eda): workflow inputs, optional repository and agent profiles
Workflow definitions declare inputs, repository (none, optional or required; default required) and profile. A binding assigns each input from a mapped parameter or a constant and may take its repository from a parameter, which must name a configured repo; both are checked when the binding is saved and again at dispatch. Inputs travel as structured task data (tasks.inputs, the task brief, and a JSON block in the agent's mission), never as body text. A task with no repository runs in a per-task scratch workspace with no clone and no publication grant. The agent.run step runs one mission without a repository and finishes the task in the new completed status. Agent profiles live under [containers.profiles.<name>]: an image and an allowlist over the tools archie adds (MCP, scripts, plugins). [containers].image is the default profile; an unconfigured profile parks the task. The workflow is now pinned before the container starts so the profile can choose its image. Also stop two archied tests writing embedded NATS state into the package directory, refuse an empty state_dir for embedded NATS, and drop the NATS store files an earlier lane commit tracked. |
||
|
|
e57221f34b | docs(store): drop residual SQLite references; fix lane lint findings | ||
|
|
ae552db7e0 |
refactor(store)!: remove the SQLite task store, the PocketBase event store and the SQLite session store
The State Store, event capture and Gateway conversations already serve from PostgreSQL. This deletes internal/store and internal/infrastructure/edastore, the SQLite gateway session store and openProductionTaskStore, and the -db recovery path on a legacy task file; backup, restore, validate and rollback work on the database database_url names. - The binding-secret cipher moves to internal/infrastructure/bindingcipher and ToolCall to internal/infrastructure/postgres. - NewSessionStoreMemory is now a pure in-memory store that passes the shared SessionStore conformance suite. - Tests run against PostgreSQL through internal/infrastructure/postgres/pgstore; legacyimport/legacyfixture writes the legacy files the import and the boot gate read. - The cron dialect is owned in internal/domain/scheduling, so github.com/pocketbase/pocketbase and pocketbase/dbx leave go.mod. modernc.org/sqlite stays for the one-time import (legacyread). - The UI and Messaging architecture gates ban the Postgres and legacy readers in place of internal/store. |
||
|
|
4237b560b0 | fix(eda): type-aware actions classifier, one stable-identifier grammar, loader tests that fail for the named reason | ||
|
|
3a4af23caa | feat(workflow): routing and playbook findings carry the key's file:line | ||
|
|
d6f61c2c6f |
feat(workflow): typed park classification and split remediation budgets
The F2+F3 schema wave from the auto-fix/resume investigation, sequenced together as one migration. Every failure funneled to one parked status with free-text ParkReason, and Task.RetryCount doubled as the operator-retry budget and the review-remediation round budget -- so N operator retries ate the remediation budget, a repo-level round cap could re-park a task an operator had just legally retried, and no surface could answer what a park needed from an operator. Park class (F2): a producer-recorded vocabulary in taskstate -- needs_human (the default, so an unclassified park always reads as operator-actionable), transient (environmental; a requeue can succeed), terminal (retrying is pointless). Recorded at the park site, never inferred from reason text; NormalizeParkClass makes unknown values persist as needs_human. Transition-to-parked defaults the class, so every existing unclassified park site reads correctly with no call-site churn; the classified ParkTask write follows for parks that know better. Requeue, RetryTask and BeginRemediation clear the class back to the default with the reason. Split budgets (F3): Task.RemediationRounds is the remediation's own budget; RetryCount stays the operator's. The round-cap stage counts and caps rounds; operator retry keeps counting RetryCount and can drive a task to dead without touching rounds. remediation_rounds is a presence-gated migrator column written through Update. Known state: proto fields, the ParkTask RPC, the staterpc mapping and the daemon-side park-site classification follow in the wire half of this wave (the proto parity test is intentionally red until then). |
||
|
|
a65eae2458 |
docs(agents): a bead never carries production instance detail
Beads sync to a Dolt remote, so anything written into one is published. Two beads filed earlier today named an operator host, its internal address and its filesystem paths -- the tracker was treated as a private store, which it is not. The rule is stated where the tracker is described, next to the existing one about .beads/ never reaching a commit, because it is the same class: the tracker is not a private store. Host-specific facts belong in the operator's memos instance, which a bead may point at. |
||
|
|
0e6c6fc6d1 |
feat(artifacts): publish the completed PR review to the collaborative editor
Implements docs/prds/artifact-sender.md (Approved). archie-core now sends generated artifacts to the offloaded.dev collaborative editor, whose POST /api/artifacts route, bearer service token, PocketBase-backed versions and idempotency semantics are the receiving contract. - [artifacts] config section: base_url + token SecretRef with a token_env fallback naming WORKSPACE_INGEST_TOKEN. An empty base_url disables the sender entirely; a base_url with an unresolvable token disables it with a warning, because a missing credential disables a capability rather than stopping the daemon. - internal/infrastructure/artifactsync: one-method Publish seam in the Courier posture, full source per publish (versions of record are snapshots), 503 retried three times with backoff, 401/400 surfaced immediately with the field reason, deterministic request ids (artifact:pr-review:<owner>/<repo>#<n>). - ReviewReport gains a pure markdown renderer in internal/domain/workflow: summary, one subsection per finding with the failure scenario and disposition when present, verified properties as a checked-clean list. - The daemon's PR reviewer publishes after a completed review when the sender is configured, records the editor deep link on the result, and degrades a failed publish to a log line -- publishing never fails the producing work. |
||
|
|
ed1557c12e |
feat(edastore)!: move event capture and bindings onto PocketBase collections
The event-capture tables (captures, mappings, bindings, binding_dispatches,
playbook_dispatches) now live in PocketBase-owned collections and their ids
are opaque record ids rather than autoincrement integers. The task lifecycle
stays on SQLite: tasks/transitions/events carry FIFO claim ordering, id-cursor
pagination and the task-grant map, none of which gain anything from being
hand-editable. binding_dispatches.task_id is the single seam and stays an
integer addressing that store.
BREAKING: CapturedEvent.Id, Mapping.Id, Binding.Id and Binding.MappingId are
strings on the wire, as are the ids in the capture/mapping/binding requests.
RecordDispatchRequest.task_id is deliberately unchanged.
What the collections buy, beyond storage: a payload nobody has modelled yet is
inspectable, a mapping is editable at runtime, and a binding's relation to its
mapping is enforced. The old schema declared no FOREIGN KEY on that link, so a
dangling mapping_id was previously possible and is now refused.
Behaviour preserved deliberately, each recovered from the SQLite version
rather than reimplemented from memory:
- draft -> pending_approval -> armed, with approval only from
pending_approval and an edit always returning a binding for re-approval
- one binding per source, guarded on insert, update and approve
- an empty secret on update keeps the stored one, so an edit form that does
not echo it back cannot silently disarm a binding
- ErrMappingNotFound / ErrBindingNotFound on a missing delete target
- sentinels are re-exported from storecontract, never redefined: staterpc
matches on exact canonical message to rehydrate them, so a second
definition would break errors.Is across the wire invisibly
Two implementation notes worth keeping:
- at-most-once dispatch is now a unique index rather than INSERT OR IGNORE.
Only the unique-violation maps to ErrAlreadyDispatched; any other save
error is returned, because treating them all as "already recorded" would
turn the ledger into a silent at-least-once dispatcher.
- captures store received_at themselves at nanosecond precision in a
fixed-width layout. PocketBase autodates are millisecond and record ids
are random, so same-millisecond captures would otherwise order
arbitrarily; the old store got insertion order free from autoincrement.
- ListUndispatchedCaptures is raw SQL: the anti-join is a subquery and
PocketBase's filter DSL is not SQL. A read fires no hooks either way.
Adds tool_calls, which had no persistence at all: tool calls only ever reached
the on-disk task log, readable as text but never queryable or watchable.
Nothing writes it yet.
The binding secret cipher moves with the bindings it protects.
|
||
|
|
e1c4914873 |
fix(workflow): make gate.diff-rules fail closed on a change it never read
The step's contract said it diffs "the worktree". It does not: Trees.Diff reports the merge base against HEAD, so only committed work is visible. A stored definition that placed gate.diff-rules before the step that commits therefore ran every rule against an empty diff, found nothing and returned nil, letting the run proceed -- the "load and check nothing" failure the same file's settings validation exists to prevent, and indistinguishable in the run's events from a change that passed. The rules now read the committed change, and a run that read no committed change while the worktree still holds uncommitted work fails on the spot, naming the step it must follow. The count of added lines read is logged on every run, so "checked nothing" is visible rather than silent. Telling those two apart needs a fact Trees does not carry, so it arrives as the same shape of optional capability changeStatsReader is: an unexported interface in the domain, implemented where git is actually read (worktree.Manager.HasUncommittedChanges, which excludes ignored files the way CommitAll's own status check does) and forwarded by hybridTrees, the Trees every production run uses. A Trees implementation that cannot answer is refused rather than assumed clean: for a gate, silence about the change is a failure, not a pass. The four remaining review findings are recorded, not fixed, in archie-core-ze7y (the escalated .archie/stages/*.go decision, P1, which now blocks archie-core-8szi), archie-core-4kbg (discoverability), archie-core-s1jz (hunk-header and threshold hardening) and archie-core-vof9 (retry keeps the pinned definition, so a rule cannot be unblocked by editing it). |
||
|
|
640e1db35e |
feat(workflow): register gate.diff-rules as the .archie/gate.go replacement
Part of archie-core-8szi. Restores the deleted .archie/gate.go Check() behaviour as a registered, declarative workflow step type: RE2 rules matched against the committed diff, per-rule level (error parks with findings in Detail, warn logs), file:line preserved, registered through the workflowsteps provider set. The .archie/stages equivalent (an argv-running step) is deliberately not landed and is held for the maintainer's trust-boundary decision. |
||
|
|
e94db30c60 |
feat(workflow): register gate.diff-rules as the .archie/gate.go replacement
steps.go's StageYaegiGate tells the operator to migrate the deleted
.archie/gate.go hook to a registered YAML workflow step, and
BuiltinStepRegistry() exposed only the six shipped workflows' own stages,
so there was nothing to migrate to. What that hook did, from
|
||
|
|
67662b12cb |
fix(workflow): pin the roots, drop the dead vocabulary, guard the nil manager
Third review pass on the step-vocabulary shape, one fix per finding. P1, roots unpinned. The agreement test built its own manager and injected it, so it pinned the resolution sites and not the roots that decide the provider set; a root regressed to workflow.NewManager() (no shipped stages) left go test green. archied now resolves through one unit, stepVocabulary (step_vocabulary.go), and agentworker's productionWorkerDependencies is exercised directly: internal/app/agentworker/step_vocabulary_test.go and internal/app/archied/step_vocabulary_test.go assert each root's manager resolves the shared provider set's shipped stages and accepts a provider registered through it. RunStateStore and openStateStoreAdapter own a SQLite file and a gRPC dial, so their calls are pinned by source position, the way composition_order_test.go pins the memory-engine ordering. P2-B, dead vocabulary. archie-messaging registered a step vocabulary it never resolved (its only control-plane call is RuntimeChatConfig) and could fail startup on it before the State Store target guard. The workflow-definitions surface is now its own type, controlplane.WorkflowDefinitionsClient, so the vocabulary is a constructor dependency of the one surface that resolves step types and of nothing else. The messaging root no longer imports workflowsteps. P2-C, nil manager. A nil *workflow.Manager dereferenced on every resolution path. stepRegistry and CompilePinnedWorkflow now refuse with an error naming the wiring mistake; TestNilStepVocabularyFailsClosedAtEveryResolutionSite pins the refusal. Claim-vs-code corrections: agreement is stated as within one build (vocabulary.go, stepRegistry, openStateStoreControlPlane, openStateStoreAdapter); the Yaegi claim now says no bridge to StepFactory has been built and cites internal/secret/secretextract; the provider set names its three roots; Manager.Register's ordering is documented as a constraint with its consequence, and the shape rule no longer claims to reserve shipped stage names; the shipped-stage test compares against the builtin factory's own stage. |
||
|
|
005179ebf3 |
feat(workflow): own the step vocabulary in a family manager registered at each composition root
archie-core-fwmp. Every call site hardcoded workflow.BuiltinStepRegistry(), so the step vocabulary a workflow definition may name was closed to the six shipped workflows and archie-agent could compile only what the control plane happened to validate against the same literal. internal/domain/workflow.Manager is the family owner (ARCHITECTURE.md#plugin- engine-rule-strict invariant 2): a constructed, injected value with no package-level registry and no init()-time registration. Register validates at the producer and atomically -- nil or unnamed provider, malformed provider or step-type identifier, a step type with no factory, a duplicate claim, a provider declaring one type twice, and a contribution shadowing a shipped stage are each refused, and a refused contribution applies nothing. Registry() hands back a copy, so the closed set is a property of the manager rather than a convention. internal/infrastructure/workflowsteps is the one package both composition roots import: it holds the compiled-in provider set and builds the manager. archied registers it in RunStateStore (the validating side) and in openStateStoreAdapter (the daemon's client), archie-agent in productionWorkerDependencies (the executing side), and archie-messaging at its own root, each before the first resolution. The five hardcoded sites now resolve the injected manager instead: the State Store's workflow-definitions validate closure and encodeWorkflowDefinitions, the control-plane client's read and write paths, and CompilePinnedWorkflow's shipped -definition and pinned compiles (one resolution per package). step_vocabulary_agreement_test.go registers a provider through the production Manager and drives all three sides with it; breaking any one of the six resolution points back to the builtin registry fails that side's assertion. |
||
|
|
02720c8e81 |
feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings. |
||
|
|
71d026feb2 |
fix(yaegiutil): refuse incomplete Yaegi interface wrappers at load
The generated symbol tables carried 25 hand-added nil guards across three
packages, re-applied by hand after every regeneration because `yaegi extract`
does not emit them. Regeneration silently dropped them, and three package docs
instructed the next agent to put them back.
The guards also answered the wrong way. A nil WResolve returned ("", nil), so a
malformed secret engine served an empty secret and reported success; a nil
WStop reported a clean shutdown for a module that never ran one.
Reject the wrapper where it enters the daemon instead. Yaegi type-checks
"var X Iface = impl{}" and refuses an incomplete impl on its own, but the
wrapper type is exported into the symbol table, so interpreted code can build
one directly and struct-literal semantics leave the omitted method nil.
Resolve now names the missing method and skips the plugin.
Generated tables are used verbatim again. Also names the wanted type on a
failed assertion, which formatted as "want <nil>" for every interface target.
|
||
|
|
40a35c9c52 |
feat(messaging): Messaging Service operator surface, chat report rendering, and the diff-cap config fix (#899)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. * fix(gateway): render chat reports as lines, not one run-on paragraph /status and /tasks are line-oriented reports, but their newlines were plain "\n" -- CommonMark's soft wrap. The Telegram rich-block renderer space-joins soft-wrapped lines, by design: a Telegram paragraph renders an embedded newline as nothing at all, so a space is the only separator that survives. The reports therefore arrived as one line each: "Runtime Provider: DeepSeek Model: deepseek/deepseek-flash", and every task's title, state and park reason jammed together. The renderer now implements CommonMark's hard line break (two trailing spaces, or a trailing backslash): the line closes its own block and the next one hugs it, so a stanza keeps its lines without the spacer paragraph that separates unrelated blocks. Ordinary prose is untouched -- a model's wrapped paragraph still joins with a space. The producers mark their report lines with it. Two report fixes alongside: - A park reason is capped to its first line at 160 runes. It carries whatever the failing stage reported, which for a lint gate is the whole tool log; unbounded, one parked task pushed every other task out of the reply. The full reason is still on the task. - /status loses its "Runtime" sub-header. A section header over two fields made a four-fact report read like a document. * fix(config): let diff_cap_lines = 0 actually switch the cap off Config.DiffCapLines was a plain int, so the defaults pass could not tell an absent key from an explicit 0 and rewrote both to 400. The dashboard schema said "0 means unlimited" and StageDiffCap treated <= 0 as unlimited, but 0 never reached the step: the documented way to switch the cap off was unreachable through config. Same root cause, worse instance: configForIdentity assigned root.DiffCapLines = identity.DiffCapLines unconditionally, so an identity that simply omitted the key overwrote the shared cap with the zero value and silently disabled the safety rail for that identity. DiffCapLines is now *int on both Config and IdentityConfig -- nil is absent, 0 is no cap -- read through Config.DiffCap(). Defaults fill only nil, and an identity overrides only when it set the key. TaskConfig keeps a resolved int, so the daemon/agent wire format is unchanged and a version-skewed agent cannot misread a null. The park reason changes too. It told the operator to "approve manually", but a parked task's actions are retry, abandon and reject (internal/taskstate): there is no approve path out of diff-cap, so it sent them looking for a button that does not exist. It now names the two things that work. * feat(config): make the daemon's readiness dependency timeout configurable The daemon's gateway probe bounded its call with a hardcoded 5s constant, while every other NewContractProbe call site (archie-ui, archie-messaging) passes the service's configured DependencyTimeout. It was the only magic number among them. [health].dependency_timeout carries it, defaulting to the same 5s the extracted services' -dependency-timeout flag defaults to, so every process bounds a probe into a dependency the same way out of the box. It is not added to the dashboard config schema or the reloadable set: [health] appears in neither today, health.listen included, and a probe assembled at boot would not observe a reload anyway. |
||
|
|
4750ac097b |
feat(workflow): post line-anchored review comments with suggested fixes (#891)
* feat(workflow): post line-anchored review comments with suggested fixes Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached the operator only as a flat list in the PR body, so the author had to map every finding back to its line by hand and apply mechanical fixes by hand. Now the line-anchored findings are also posted as inline review comments, carrying a one-click suggestion when the reviewer could state the fix. Domain (internal/domain/workflow): - ReviewFinding gains Suggestion; Validate rejects one on anything but a confirmed finding, so the agent's record_finding call is refused with something it can act on. Validate splits into validateAnchor / validateClassification / validateDisposition, which also brings it back under the cyclop limit the gate enforces. - StagePostReviewComments runs after StageOpenPR in the implement workflow. It posts only line-anchored findings (Line > 0); a whole-file finding has no line to attach to and stays in the body list, which remains the complete record. It is best-effort: the PR is open and the body already lists every finding, so a failed comment is logged, never a park -- the same reasoning as OpenPR's existing best-effort LinkBranch call. - The suggestion fence is gated on Verdict == confirmed where the fence is written, because it is a one-click apply: a wrong suggestion breaks the code and the author has to notice. Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations, type-asserted like PullRequestReader so a forge that cannot is skipped rather than faked (NoopForge is pinned as not satisfying it). GitHub loops one CreateComment per comment and joins the failures, so one refused anchor cannot drop the rest; Gitea carries them on a single COMMENT-state review. Two deliberate departures from the PRD's sketch, both recorded in it: - The interface is batch (CreateReviewComments), not one call per comment: Gitea's only inline shape is one submitted review, and the set then crosses NATS once instead of once per finding. - The head SHA is resolved inside each forge implementation rather than by the caller. The stage runs in archie-agent, which holds no forge credentials and has no PullRequestReader; the daemon-side forgerpc handler is the only place that does. Transport (internal/forgerpc): workflow.Forger gains the method, so the agent reaches the daemon over the new create_review_comments subject; the server type-asserts the writer and answers an incapable forge with an error the stage logs. This is the one proxied method whose absence on an image skew does not park a task. The reviewer prompt and record_finding schema ask for a suggestion on a confirmed, mechanically fixable defect only. Regenerating the wfextract symbol table -- the documented way a new exported workflow symbol reaches interpreted stage plugins -- also picked up symbols that were missing from the committed table (the Status* and Source* constants, ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to every wrapper afterwards, as that file's header requires. Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new stage logic each fail a test that names the behaviour -- dropping the confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure escape -- so the tests discriminate rather than passing vacuously. * fix(build): drop the Dockerfile pin assertion The guard fetched golangci-lint's go.mod at image build time to fail the build when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped on self-inflicted pin drift, but it added a network fetch and a new failure mode to the release build, which is not where that belongs. The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0 equals GOFUMPT_VERSION) and the comment above them still states the invariant, so the reasoning survives without the build-time machinery. The pin change itself reaches the agent image through the normal release path: CI rebuilds and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only release deliberately does not. * feat(workflow): add the remediate workflow for PR review remediation Implements step 5 of docs/prds/pr-review-remediation.md: a remediate workflow that resumes the task's existing worktree onto its PR branch (worktree.Manager.Resume, not Prepare's refresh), runs a builder agent against the review's actionable comments, commits and pushes to the same branch, and replies via the forge's ReplyToReview. Task.RetryCount doubles as the remediation round counter, capped by the repo's max_retries; the round-cap stage parks the task and posts one comment when it's hit. Task gains a ReviewPayload field (JSON-encoded review unit) with full store/proto/staterpc plumbing. workflow.Forger gains Comment and ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume and its Dir lookup are added as an unexported optional Trees capability rather than widening the exported interface, which is already at golangci-lint's interfacebloat cap and is projected into wfextract's Yaegi symbol table for repository-authored stage plugins. The daemon-side reaction consumer that dispatches into this workflow (subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing per-task serialization) is tracked separately in archie-core-8li9.4. * feat(messaging): extract standalone messaging service binary and process composition * feat(messaging): adapt channel frontends to consume Gateway ChatContract * feat(messaging): remove in-process channels and Router from daemon bootstrap Telegram, email and webhook now run only in the Messaging Service, which reaches this process through the Gateway's ChatContract. The daemon builds no channel and no gateway.Router, so the wiring that existed only to serve them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway, setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the release-announcement path helper. The seams those paths owned move to where they can still be honoured: - Channel ValidateConfig runs in archiemessaging.compose, which now returns an error, so a configured-but-invalid front-end fails the service rather than being dropped silently. - The inbound rate limiter moves to the Gateway process, which owns the only Router and therefore the only place a per-sender budget applies to every channel's turns. - The daemon's gateway readiness probe becomes a ContractProbe against the Gateway. It cannot observe a channel lifecycle it no longer runs, and a channel-count probe would have reported every daemon degraded. - telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a chat turn runner actually reads. Telegram operator features that were wired only in the daemon (/update, release announcements, version reporting, SIGHUP reload) are not yet wired in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting: archie-core-8cda.6.8. The Gateway process builds no worktree manager, so review_pr is unadvertised on every channel: archie-core-8cda.6.7. * feat(messaging): re-wire the Telegram operator surface in the Messaging Service setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's own process. Each is resolved by where the fact it needs is owned, not by where it used to be built; the decision table is in docs/architecture/migration-decisions.md. Wired here: /update (built from this service's own [chat.telegram] check and install commands), the update-report relay (same sha256(bot_user)[:8] path the daemon wrote, so a pending report is found rather than written afresh), show_tool_calls, and /restart's config reload, which re-resolves the token and allowlist from this service's own file and refuses a reload that resolves to an empty token. /version is sourced from the Gateway: ChatSnapshot gains a Version field carrying the Gateway's rendered build block, read per call and bounded by the dependency timeout. cmd/archie-messaging deliberately takes no version ldflags, so it cannot report a partial upgrade as a matched one. RunningVersions and ReleaseAnnouncements stay nil. Both need a component's real running version, and the only versions this process can obtain are a different binary's stamps -- reporting them would manufacture exactly the false success the update check exists to catch, and the announcer without parseable versions is a no-op that reads as configured. archie-core-8cda.6.9 carries the contract that unblocks them. Dangerous stays nil: no composition has ever supplied a command authority. Enrich is dropped from the update service: componentInstallTypeEnricher read [nats], which this service must not decode, so the check command's own reported install type stands. * fix(workflow): guard inline review comments against head drift Two findings from the review of q9au. A comment's line numbers describe exactly one revision of the branch, but the forge resolved the pull request's head at posting time -- after the review had already read the worktree. A push in that window (a collaborator, a retry) meant the findings were anchored to whatever now occupied those lines, mislabelling instead of failing. The revision the review measured now travels with the comment set: OpenPR records it from the same worktree read it already performs (TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through Forger to forgerpc, and the forge refuses the whole set once the head it reads has moved off it -- which the best-effort stage logs, the PR body remaining the record. An unmeasured revision posts unverified rather than dropping every finding, so a worktree that cannot report one degrades instead of regressing. Suggestion was documented single-line only, because GitHub applies a suggestion fence up to its first line and a multi-line replacement would silently corrupt the file. Only the verdict was validated, so a multi-line suggestion reached the renderer and posted as that truncated fence. Validate now rejects an embedded newline, which makes record_finding refuse it with feedback the model can act on instead of the reviewer discovering the corruption later. |
||
|
|
c94986cf38 |
Merge pull request #878 from samcharles93/feat/attempt-attribution
Feat/attempt attribution |
||
|
|
fe7ee44dcc |
fix(workflow): require a workflow from triage when a code change is needed
The selection criteria alone left workflow optional and defaulted an omitted or unrecognised value to implement, so a decide call could still skip the decision and send an unsettled capability straight to the builder. Omission is now a retryable rejection: CaptureTool gains RequiredWhenTrue, a conditional requirement a flat RequiredFields entry cannot express, because the close-without-change branch has no workflow to name and must not be made to invent one. A rejected call is not recorded, so it does not consume MaxCalls and the model retries with the field. A value outside the enum now fails the stage rather than degrading to implement: reaching OnResult with one means the model ignored its own schema. Splits validateCaptureArgs into per-constraint checks (cyclop) and carries the regenerated contracts.json. |
||
|
|
af56021267 |
feat(workflow): give triage criteria for choosing between workflows
The classify stage picked between implement, tdd and feasibility with no stated criteria: the mission spent its guidance on needs_code_change and the schema said only 'Which workflow fits best', with implement as the free default for an omitted or unrecognised answer. Issue 813 was classified implement on that basis. Both surfaces now state what each workflow is for and say not to pick implement merely because nothing else obviously fits. The mission moves to a named triageMission so a test can assert the criteria reach the model. Closes archie-core-s5ys |
||
|
|
681c5fb0ad |
fix(workintake): match namespaced forge labels when routing by kind
labelKinds is keyed on bare strings, and this repo namespaces its labels (type::feature, priority::medium), so KindsForLabels matched nothing and every issue fell through kind routing to Route's triage fallback. Kind routing has therefore never fired here: issue 813, a type::feature that defaultKindWorkflows binds to feasibility, reached implement instead. Labels now resolve to the value after the last '::'. The namespace is not checked: bug/feature/bootstrap is specific enough that a label ending in one means that kind whatever the tracker files it under. Closes archie-core-tjoc |
||
|
|
2c09f42ff4 |
feat(tasks): attribute events, changes and config to the attempt that produced them
The events table had no attempt column, so two attempts of the same task were indistinguishable: a retried task's stage events interleaved into one timeline and nothing could say which run produced a given result. - events gains an `attempt` column through the existing presence-gated migrateTasks loop rather than a version bump, so user_version stays 3 and an existing archie.db is migrated in place. A legacy-database test builds the pre-change schema and proves both that existing rows survive unattributed (attempt = 0) and that a new value round-trips. - Event.attempt = 11 and ReadTaskLogRequest.stage = 9 are field additions to existing messages: no new RPC, no new table, and no change to any canonical error message that crosses the state-store wire. - Every task event the workflow engine emits now carries the attempt. Producers that have no attempt yet (task_queued, binding_dispatch_failure) stay unattributed rather than guessing one. - Changed files are captured as a durable changes_captured event at commit and push time, reusing the existing three-dot diff primitive: paths from FilePatches(), counts from Stats(), base_sha recorded as the merge base actually diffed rather than the base tip, a 200-file cap with totals kept complete. Consumption goes through an unexported optional interface so workflow.Trees -- the yaegi capability surface for interpreted stage plugins -- is not widened. A capture is also taken once the pull request exists, so the capture can link it. - The per-attempt configuration is captured as a durable config_captured event carrying the non-secret config.TaskConfig, instead of a new table plus two new state-store RPCs: events are already this system's per-attempt provenance stream, so a table would have given one feature two provenance mechanisms. Redaction is proven against canary secrets. Measured payload: 539 bytes typical, 2333 bytes at 20 models. - Captures carry a schema marker and are refused unless their key set matches the declared payload shape, so drift surfaces as "recorded but could not be read" rather than as a capture of zeroes. - Three read endpoints serve the attempt rail, the changed-file captures and a raw debug view, mapping to UI-owned response types rather than dumping store types. - The task-log read gains a stage filter, bound to the stage logger for that stage's own lines; agent and tool output records no stage. A task-scoped grant may already insert events on its own task, so this provenance is exactly as trustworthy as the rest of that task's event stream. That limit is documented rather than papered over. |
||
|
|
95aae832b3 |
fix(workflow): record a parked run's reason in its own log
The agent-side half of the same gap. A stage failure already logged "stage failed -- parking" before parking, but a run whose OUTCOME was parked (a review that could not run, a workflow that ended with no outcome) reached the timeline as a KindParked event and the store as park_reason and never the log an operator downloads. park is the one place a park's reason is final, so it is now the one place that logs it; the stage-failure branch no longer logs its own near-copy, and the stage names itself inside the reason. The entry carries the stage as a field so nothing is lost by dropping the duplicate line. observability.md's "Implemented design" section documented the container's system-log path as though it were the only source of task-log content; it now records the daemon's and the workflow's own park writers, including why the entry follows the transition rather than preceding it. |
||
|
|
0b3dc6c01f |
refactor(forge): delete the unwired RepliesAfter surface
DELETE: IssueForge.RepliesAfter and its Reply type had no production caller -- the waiting_human status exists and is reachable, but automatic detection of a human reply never landed, so the intended poller was never built. Neither implementation paginated either (both read one page of 50), so the method would have been wrong if wired as-is. The manual path is untouched: waiting_human remains reachable and an operator requeues through the existing task-action flow. Removing the interface method also removes seven test fakes that existed only to satisfy it. No behavioural test accompanies this: a pure deletion has no assertion to make fail, and the compiler enforces completeness across every implementation. |
||
|
|
f4e32ee6d4 |
docs(skill): drop comments that named the deleted skill.Discover
Lane F deleted skill.Discover/skill.DiscoverPlugins/skill.Skill (no
production caller) in
|
||
|
|
0548a944b1 |
refactor(skillbuild): delete dead AugmentRegistry path
DELETE: no document in docs/architecture/ or docs/prds/ names AugmentRegistry as a consumer. The live per-task registry construction is skillbuild.BuildRegistry(workDir) at internal/app/agentworker/ task_execution.go; AugmentRegistry was an unwired alternate merge-over- base path (with collision/override and nil-base semantics) that only tests exercised. mergeSkillWorkflows remains reachable through BuildCatalog/BuildRegistry. |
||
|
|
e93ad6353b |
fix(gate): validate finding level and share the blocking threshold
Resolves gate-subsystem-2 and gate-subsystem-1. WIRE: gate.Finding.Level is now a typed gate.Level restricted to LevelError/LevelWarn, and Finding.Validate rejects any other value so a mis-typed or empty level fails the gate closed instead of silently downgrading an intended blocker to a pass -- mirroring the fail-closed standard ReviewFinding.Validate already sets in internal/domain/workflow/review_findings.go. WIRE: StageYaegiGate now delegates the blocking decision to gate.Finding.Blocking instead of re-implementing the raw "error" literal, so the script-facing gate.Blocking helper (exposed by gateextract to interpreted .archie/gate.go scripts) and the rule the daemon actually enforces share one source of truth and cannot drift. |
||
|
|
bdf73ed371 |
feat(workflow): review calibration -- checked properties, style nits out of contract
Closes archie-core-h019.5. The shipped contract already made only a confirmed
error-level finding block, and kept zero-findings distinct from not-run; what
was missing was the other half of calibration, and that is what a reviewer that
cries wolf needs.
- ReviewReport gains Checked []ReviewCheck {Property, Evidence}: the properties
the reviewer verified clean. Evidence is required, for the same reason a
finding requires a failure scenario -- a check without evidence is an
assertion, not a verification.
- The reviewer records checks through a typed record_checked tool, mirroring
record_finding, so it cannot end its turn having silently skipped the
checklist.
- Style/formatting/naming nits are stated out of contract, in the ReviewFinding
type doc and the reviewer prompt: they are the padding that trains an
operator to skim.
- The PR-body findings section renders the cleared properties, so a
zero-finding review arrives backed by what was checked rather than reading
the same as a review that never looked.
Design: docs/prds/review-calibration.md.
|
||
|
|
a00c578cb7 |
refactor(ui): sever the archie-ui binary from every daemon runtime package
Completes the objective deletion gate for the UI Service (archie-core-8cda.5.6): go list -deps ./cmd/archie-ui now links zero banned packages -- no modernc.org/sqlite, no internal/store, gateway, channels, memory, secret, agentexec, tools, skill, yaegiutil, curator, or the workflow engine. The closure shrinks from 68 to 26 archie-core packages. Each cut is a producer-side move; no consumer-side defensive shims. - Store contracts (TaskStore family, value types, sentinels) moved from internal/store to internal/domain/storecontract -- the approved contract location per state-store-contract rev. 2d, and NOT internal/contracts: that tree is buf generate output and tools/proto.sh check deletes hand-written files there. internal/store keeps aliases; sentinel message strings are byte-identical and remain the wire contract. - Chat contracts (ChatContract, sessions, turns, streaming, commands) moved from internal/gateway to internal/domain/messaging; gateway keeps aliases. ToolCallEvent rendering helpers become gateway functions (methods cannot live on alias types). - Task vocabulary (Task, statuses, mid-run Store, Definition) split into internal/domain/workflow/task; the pipeline engine stays in package workflow with aliases, so daemon-side callers are unchanged. - overlay.DeniedKeys moved to internal/infrastructure/configuration: webui referenced the constant and that dragged the overlay SQLite store in. - webui.Server's concrete runtime handles become webui-owned view interfaces with daemon-side bootstrap adapters: channel lifecycle (internal/channels/status), MemoryStatus, CuratorStatus, and a SkillCatalog seam replacing the direct skill.DefaultRoots/CatalogRoots calls. Each degrades to an empty page when unwired. - config.SecretRef moved into internal/config (config vocabulary); internal/secret keeps an alias and Registry.Resolve absorbs the zero-value short-circuit. Docs: state-store-contract rev. 2d relocation record; ui-service-boundary deletion gate marked satisfied; ARCHITECTURE.md package map rows. |
||
|
|
8a5d8814d2 |
fix(workflow): order findings before footer; test the report stash
Self-review of #784: (1) the tc.ReviewReport = report stash was untested, so a regression dropping it would silently omit the findings section; (2) the section rendered after the workflow footer, reading as content-after-signature. Move the findings before the footer and pin the StageReview->implementPRBody integration with a test. |
||
|
|
36c7b9d3c6 |
feat(workflow): surface adversarial review findings on the PR body
StageReview now stashes its ReviewReport on TaskContext, and implementPRBody
appends a findings section when the review ran -- explicit in the zero-findings
case ('ran and found no defects') and listing non-blocking warn/plausible
findings. A disabled or never-run review renders no section, so silence is not
mistaken for a clean review. The parked-task park reason already carries
blocking findings (renderReviewDetail), satisfying the dashboard/api-tasks half
of the acceptance criteria.
Closes archie-core-h019.6.
|
||
|
|
05529d48d5 |
refactor(state-store): cut daemon/Gateway over to the remote State Store (archie-core-8cda.4.6) (#774)
* refactor(state-store): delete NATS storerpc; agent store is gRPC-only (archie-core-8cda.4.6) The agent is fully on the gRPC State Store contract, so the legacy NATS storerpc path is dead (docs/prds/state-store-contract.md §12 step 4): - delete internal/storerpc (Server, Client, subjects) and its tests - drop the storerpc registration from registerTaskRPCServers and the now-unused store param - make the agent transport's State Store URL required and Store() return only the gRPC staterpc.Client (no NATS fallback) - rework agentworker/agent transport tests to back the store with a real gRPC State Store server instead of the deleted NATS storerpc server The agent binary now fails fast when STATE_STORE_URL is absent. Agent store calls (workflow.Store) go over gRPC to the archie-state-store service. * refactor(state-store): delete daemon/gateway in-process store ownership (archie-core-8cda.4.6) The daemon and gateway no longer open archie.db in-process: the single SQLite file is owned by the standalone archie-state-store process, and both consumers dial its gRPC State StateStore contract (docs/prds/state-store-contract.md §12 step 7, no dual-store ownership). - openStores no longer opens the production task store or seeds b.st; it only wires secrets/forge and the gateway conversation store - openStateStoreAdapter now requires [services.state].target (the old local default is deleted) and resolves b.stateStore as the remote *staterpc.Client - delete the in-process startStateStoreServer (the multiplexed gRPC server and its per-task bearer-token registry) from the daemon composition - RunGateway now resolves the same remote State Store adapter; its session SQLite stays Gateway-owned and untouched - daemon.ConnectedStateStore carries the configured target plus the resolved bearer token, which containerEnv injects as STATE_STORE_URL / STATE_STORE_TOKEN so archie-agent authenticates to the same remote service - readiness store probe reads b.stateStore PRD-consistent choice (noted): with the in-process server gone, per-task token generation is removed; the daemon/gateway/agent all present the single [services.state].target_token (or STATE_STORE_TOKEN secret) that the standalone store validates. * docs(webui): require [services.state].target in config and deployment templates (archie-core-8cda.4.6) After the in-process store path is deleted, archied and archie-gateway dial the standalone archie-state-store gRPC service via [services.state].target and never open archie.db themselves (docs/prds/state-store-contract.md §12 step 7). - config.example.toml documents [services.state].target as required, with the loopback vs Docker-bridge gateway + target_token rule - deployment templates set [services.state] per topology: bridge gateway + token for container-mode agents, loopback for host-only - deployments/README.md and systemd-user-service.md describe start commands for both topologies and drop the stale "not yet consumed by the daemon" note * style: gofumpt alignment for State Store daemon literal; appease noctx/staticcheck (archie-core-8cda.4.6) * docs(state-store): refresh stale in-process references post-cutover (archie-core-8cda.4.6) |
||
|
|
5c0efaceaf |
refactor(workflow): relocate Task/Status/Source and define workflow.Store (#754)
* refactor(workflow,store): relocate Task/Status/Source and define workflow.Store Move store.Task, store.Status*/store.Source*, and the 3-method workflow store interface out of internal/store into internal/domain/workflow as workflow.Task/workflow.Status/workflow.Source plus a consumer-owned workflow.Store, superseding store.WorkflowStore. internal/domain/workflow now imports zero internal/store symbols; internal/store persists the domain type instead (infrastructure depends on domain), and its Store satisfies workflow.Store. Updates every production and test caller of the relocated symbols across daemon, webui, gateway, agentworker, agenttransport/nats, storerpc, taskrun, and worktreerpc, and removes TestRecordDispatchViaExplicitTx per docs/prds/state-store-contract.md (rev. 2c) sections 4 and 12 step 2. Two workflow-package integration tests that exercise the real *store.Store move to an external workflow_test package (store_integration_test.go) to avoid a workflow(test)->store->workflow(prod) import cycle now that store depends on workflow. * no-mistakes(document): docs(state-store): mark §4.8 relocation done in state-store-contract |
||
|
|
21a3e5f039 |
fix(eda): make playbook key collision reporting deterministic
loadPlaybookFile ranged over the raw YAML map directly, so which key
"won" when a file declared two colliding bindings depended on Go's
randomized map iteration order -- contradicting the function's own
doc comment promise of a reproducible, deterministic collision error.
Surfaced as a flaky failure in TestLintReportsLoadErrorAsFinding
(internal/app/archieplaybooks), which has two independent collisions
in its fixture and asserted on whichever one used to win by chance.
Sort the file's keys before checking them, matching the existing
sorted-filenames convention for cross-file order. Updated the test's
assertion to the now-deterministic outcome ("bug", alphabetically
first) with a comment explaining why.
|
||
|
|
1422e2fb1c |
refactor(eda): extract helpers to satisfy cyclop/gocognit gates
loadWorkflows (bootstrap.go) split into loadWorkflowRouting, loadModules, loadEDAPlaybooks -- cyclop 17>15. LoadPlaybookDirs (routing.go) split into sortedPlaybookFilenames, loadPlaybookFile, bindPlaybookKey -- gocognit 52>30. Pure extraction: identical log messages, error strings, and control flow. golangci-lint run ./... now reports 0 issues. Closes archie-core-t2db.16. |
||
|
|
3d37a437ff |
fix(extract): regenerate stale Yaegi symbol tables; fix wfextract directive
Two pre-existing issues discovered while scoping the Module-position slice
(archie-core-e7bo), unrelated to the playbook engine work:
1. wfextract's //go:generate directive still targeted
internal/workflow, a path gone since the domain migration -- the
committed generated file was hand-patched for imports only, never
regenerated. 'go generate ./...' failed repo-wide, silently.
2. Regeneration surfaced real drift on three surfaces:
- wfextract: the committed table predated the migration and was
missing everything added since -- routing YAML loaders (t2db.9/.10/
.11), the review types, and the Forger/Reviewer/Trees interfaces
that TaskContext exposes to every interpreted stage plugin. A stage
plugin referencing tc.Trees or the review types could not resolve
them.
- pluginextract: internal/plugin/host.go (
|
||
|
|
dc951d5601 |
feat(workflow): load kind/label bindings from multiple playbook directories
Third slice of docs/prds/eda-playbook-engine.md (t2db.11), completing open question 2: instead of a single playbook dir, the config gains a LIST of directories (playbook_dirs) of *.yaml/*.yml binding files, loaded at startup as an additional input to workflow_routing_file and workflow_labels_file, which remain supported unchanged. - LoadPlaybookDirs(dirs []string) reads every yaml file across the configured directories and merges kind + arbitrary-label bindings. - This is what finally exercises the design doc's drop-and-report collision rule: a single file cannot collide with itself, so the cross-source path (two files in one dir, two dirs, or a dir plus a single-file field) had never run in production. A binding key declared by more than one source is a reported load failure, not a silent pick-one by source order or version. - Router-level collision handling: MergeKindWorkflows/MergeLabelWorkflows fail on a key bound by both the single-file fields and the playbook dirs, applied at boot. - Config: PlaybookDirs []string, empty by default (no behavior change for existing configs). Repo-scoping (typing dirs to Config.Repos owner/name) is explicitly deferred to a separate later decision per ticket; org/tenant keying is out of scope. - PRD: records the list shape per Sam's correction (single dir would contradict multiple independently-maintained playbook sources). |
||
|
|
06f4bbe3b3 |
feat(workflow): route arbitrary forge labels to workflows via playbook YAML
Second slice of docs/prds/eda-playbook-engine.md, complementing the kind->workflow layer (WorkflowRoutingFile): the label vocabulary itself becomes playbook data. A label outside the closed bug/feature/bootstrap kind set (e.g. security) now dispatches to a registered workflow from an optional WorkflowLabelsFile, instead of falling through to triage. - LabelWorkflows + LoadLabelWorkflowsYAML/SetLabelWorkflows in internal/domain/workflow/routing.go, mirroring the kind layer's once-at-startup lifecycle. The closed Kind/NATS-subject set is untouched; the map only extends binding authority for labels the kind layer does not own. - Collision rule per design doc: a label owned by the kind set, an empty label, an empty workflow name, or a duplicate binding is a reported load failure (dropped, logged, error returned to the caller) -- the schema defines what is accepted; nothing is silently arbitrated by schema/version. - Route() precedence: explicit t.Workflow -> arbitrary-label binding -> kind binding -> triage -> implement -> default. - Config: WorkflowLabelsFile (workflow_labels_file), wired at boot alongside WorkflowRoutingFile; documented in config.example.toml. - PRD: records this slice's decisions (single-file shape, collision rule, precedence) so later slices stay anchored. |
||
|
|
97a5c0d2ca |
feat(workflow): make kind-to-workflow routing YAML-overridable
First slice of docs/prds/eda-playbook-engine.md: which registered workflow an intake Kind (bug/feature/bootstrap) prefers is now data, loaded from an optional WorkflowRoutingFile, instead of a Go literal. labelKinds and the NATS-subject-per-kind set are unchanged -- expanding the label vocabulary itself is a separate, larger decision (subject allocation) deferred per the design doc's open questions. An unrecognised kind in the file is a reported load failure (schema defines what's accepted, per the design doc's collision-handling rule), not a silently-dropped binding. No file configured falls back to today's hardcoded defaults unchanged. |
||
|
|
5bec08b6ce |
feat(workflow): dynamic triage instead of defaulting every task to implement
Route() had no content-aware fallback: any task with no explicit workflow and no label match ran the full "implement" pipeline regardless of content. Confirmed in production (task 6): a chat-spawned task whose entire content was "this is just a test, close it when you receive it" burned 669,421 tokens finding that out the expensive way -- baseline, plan, and build all ran before the plan stage's own conclusion (nothing needed to change) arrived too late to save anything. Adds a "triage" workflow: one cheap, read-only classification turn (mirrors feasibility.go's decide-tool pattern) that either closes a task needing no code change immediately, or sets Task.Workflow and requeues under whichever workflow fits. Route()'s fallback now prefers a registered "triage" over "implement", unchanged when triage isn't registered. Labeled tasks are untouched -- a label is already a free, reliable signal, so triage never fires there. See docs/prds/dynamic-workflow-triage.md for the full design. |
||
|
|
322e081365 |
fix(workflow): net cache hits from token totals, trim gate-retry output
Confirmed in production (task 6, 2026-09-02): dashboard/PR summaries showed raw prompt-token sums with no cache accounting -- 360,018 of a reported 400,021 "prompt tokens" were cache hits billed at a steep discount, not full price. Real fresh spend was ~40,003 tokens, roughly 10x less than the headline number implied. Nothing was double-counted; the totals were internally consistent, just presented misleadingly. Adds TaskContext.RunUsage (in-memory, presentation-only) and formatTokenUsage, rendering "N tokens (F fresh + C cached)" in PR bodies and the dashboard timeline instead of a raw sum, falling back to the plain total when no breakdown is available. Also trims StageBaselineGate's retry-mission prompt to failing-only go test output via extractFailingGateOutput -- the full passing- package listing was a direct, mechanical contributor to the growing per-iteration prompt sizes on every gate-repair retry, not just a display problem. Degrades to unchanged output for non-Go gates or unrecognized shapes. |