b9c1663d64b55e01fe84df54323ec8b2c906e6dd
87
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
21f333a13e |
fix(controlplane): stored container policies replace file profiles; add profile image and workflow examples
A stored container-runtime-policies document that carries Profiles now replaces the file's profiles instead of merging into them, so a profile deleted in the dashboard stays deleted; one stored before profiles existed still inherits the file's. Profiles drop their json tags so the stored document keys them like its other fields. Adds examples/profiles/Dockerfile.agent-net (agent image plus network lookup tools) with a build-only agent-net compose service, examples/workflows/firewall-investigate.yaml with a test that parses every example against the registered step vocabulary, and names the postgres service in the compose header. |
||
|
|
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. |
||
|
|
9864766804 |
docs: describe the PostgreSQL-only stores, state_dir and the import-only db_path
Architecture, deployment, installer, skill and PRD text now name the Postgres State Store, the offline recovery commands on database_url, state_dir for host state, and db_path as the legacy-file locator for archie-state-store import. Finalised PRDs, CHANGELOG, docs/news and docs/archive are unchanged records. |
||
|
|
368e33a9a5 |
feat(archied): serve the State Store, event store and Gateway conversations from Postgres
The State Store's task and event-capture stores and the conversation store read by archied and served by archie-gateway now open on database_url. Every serving process refuses to start when legacy SQLite data exists and no import completion is recorded, naming archie-state-store import; a fresh install records completion itself. The Gateway holds its Postgres serve claim for its lifetime and releases it before the pool closes. |
||
|
|
feeaa16c7b |
feat(postgres): wire the State Store to Postgres — DB URL, fail-closed pool, composition seam
Wave 1 of the Postgres migration (archie-core-7r0x.9). This is the shared shape every port lane builds on; nothing here switches a live path to Postgres yet. - config: add `database_url` beside `db_path` (config.go), mark it bootstrap-only in denied_keys, expose it in the webui StorageView/config schema, and add it to config.example.toml plus all deployments/*.toml. - docker-compose: add a postgres:18 service; `task dev` (dev:postgres) brings it up and waits for it before the State Store boots. - archied: `openStateStore` now opens and migrates the process-scoped Postgres pool via `openStateStorePool`. The State Store fails closed (D1.2) when database_url is absent or invalid rather than fall back to SQLite; serving against Postgres later requires an import-completion record (D1.3), which is a later lane's gate, not this one. - composition seam: task-store construction (state_store_task.go) and EDA-store construction (state_store_eda.go) are extracted from openStateStore, with the pool open in state_store_pool.go. This is a behaviour-preserving refactor only — no store, interface, error, ordering or logging change — so L1 and L2 build against separate files instead of sharing state_store.go. Tests: fail-closed pool behaviour is pinned (absent/invalid URL); the State Store boot/restart tests now run against a throwaway Postgres 18 container (pgtest TestMain). Scoped test command and module-wide build pass; see lane report. |
||
|
|
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. |
||
|
|
6703cc77cf |
refactor(indexing): delete the workspace codesearch indexer
The index built google/codesearch over the chat workspace on every daemon start, for the process lifetime, through a child-process helper and a SQLite metadata DB -- and grep consulted it only for searches confined to the workspace root, which the analysed sessions showed was a small fraction of searches. The compute was continuous; the benefit was not. Removes internal/indexing, the workspace-codesearch helper subcommand, the [indexing] config section, and the GrepIndex accelerator seam from the grep tool, which returns to its direct walk. google/codesearch leaves go.mod with it. |
||
|
|
6f2a78f88d | docs(eda): record the shipped action-playbook rules and stale claims | ||
|
|
3b5994acef |
docs: drop one host's service names from port guidance
Five files named a specific host's service and the port it holds as the reason a deployment might move the state store's listen address, including config.example.toml, which ships to every operator. The guidance keeps its point -- move the listen/target pair together when a port is already taken on the host -- without naming a service the reader may not run, or have heard of. Also corrects the Taskfile's dev-stack summary, which still described the state store as binding 127.0.0.1:9090. deployments/dev.toml pairs it with 9091, and has since the pair became configurable, so the comment described a stack that does not start. |
||
|
|
43505c5d66 |
fix(configuration): reject forge intake settings nothing reads
IdentityConfig.Forge is the same type as the root [forge] block, so [identities.forge].intake, .webhook_secret and .webhook_addr all decode -- but every intake read is of the root block (validate.go, bootstrap.setupForgeWebhook) and per-identity intake never reached validateForgeIntake. The setting parsed, was ignored, and was not even validated. Separately, root intake = "webhook"/"both" with [[identities]] started the daemon, logged "forge webhook disabled" and polled instead. Extend validateForgeIntake to fail closed on both shapes: a per-identity webhook/both intake (or webhook_secret/webhook_addr) is rejected naming the identity, the setting and the reason, and root webhook/both intake alongside [[identities]] is rejected naming both settings and the supported alternative. Poll and empty stay valid per identity; the two shipped forge profiles still validate. |
||
|
|
bd41643d36 |
docs(config): point rate_limit at the Channel settings resource
The rate-limit budget's runtime owner is the channel-settings control-plane resource, which the Web UI edits and which boot.loadRuntimeConfig layers over the file before boot.startRateLimiter reads it. [chat.rate_limit] is that resource's seed, not its authority. 18cca53b's comments and commit message described the file key as the thing that documents a webhook's per-route budget, which is the pre-migration framing. Cite the resource and the layering instead, and say plainly that editing the file does not change a stored value. |
||
|
|
18cca53bab |
fix(webhook): keep a route path out of the sender identity
A webhook set SenderID to its configured route path. The turn path reads that field through a per-channel resolver which refuses webhook, but the session curator derives its participant from the raw field with no channel filter, so a webhook session with exactly one distinct sender and one extracted fact wrote agent-user memory addressed to User: "/hooks/...". Nothing reads it, and every pass added more, because the facts are identical strings with no dedup. docs/prds/memory-engine-unification.md criterion 7 requires that a route path never become a user identity. Clear it at the producer rather than teaching every consumer which channels are lying: a route path is a source, not a person, so it no longer enters SenderID. It still keys the inbound rate limit, where it is the documented per-source budget for webhooks (config.RateLimitConfig), so it travels in the new transport-only Inbound.BudgetKey -- carried on the wire beside Page, never persisted, and never read as an identity. pb.Message gains budget_key (field 9) for the same reason page (field 7) exists: transport context that rides with an inbound message and is deliberately absent from storedProto's rendering of a canonical record. The curator needs no change. An empty SenderID already fails closed as an unidentified user message, which is the path a dashboard session takes, and sessionParticipant's existing skip covers it; the test name now says so. |
||
|
|
b54f01065c |
feat(tools): add per-server parallel_tool_calls to the MCP client
MCPServer gains ParallelToolCalls (default false). The client's per-server callMu is now nil for a server that opted in, so CallTool stops serializing that server's calls and the caller's own concurrency decides; every other server keeps exactly one tools/call in flight. The flag is threaded from config through the provider constructor - the only place MCPServer configs become Client instances - into NewClient, in both the daemon and the agent worker. |
||
|
|
298c3133f3 |
feat(eda): wire the playbook coordinator into production workflow selection
A loaded playbook now decides a real task's workflow. The wiring point is the daemon's definition pin (Daemon.resolveWorkflowID, consumed by pinWorkflowFromCollection), not pollNATS/publishTask as the design doc assumed: routing moved out of the agent process when workflow definitions became database rows pinned before dispatch, so the pin is the one place a task's workflow is chosen. Precedence: an explicit Task.Workflow (the waiting_human -> approved requeue) still wins, then a matching playbook, then workflow.ResolveWorkflowID's existing label/kind bindings. A playbook naming an undefined workflow is a reported failure that parks the task rather than a silent fall-through to the binding's choice -- the operator bound that trigger deliberately. Store.Dispatch returns the selected workflow name plus the matching playbook's id and version, instead of a compiled workflow.Workflow: the production caller decides against the active definition collection, and the id/version are the first two components of the resolved gap-2 idempotency key. The playbook package no longer imports internal/domain/workflow. The shipped example's `when` read event.priority, a field no intake supplies, so it could never have fired once wired. Both examples now read the event surface playbookInput really builds, and label-trigger.yaml documents the axis an instance defines for itself: trigger.kind is the closed workintake vocabulary because a kind addresses a NATS subject, while trigger.labels is free-form and binds an operator's own taxonomy to a workflow. Module/Channel/Forge positions stay rejected at load; they need the playbook_dispatches ledger first (archie-core-t2db.24). Closes archie-core-t2db.23 |
||
|
|
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. |
||
|
|
4c4848878f |
chore(memory): delete internal/memory (unification slice 5) (#889)
Deletes internal/memory (Manager, builtin.Provider, memory_edit tool) now
that slices 2-4 built the CRUD engine family and its per-turn read/write
seams. Also deletes internal/infrastructure/memory/builtin/provider.go (the
memory_edit adapter over the old package -- its markdown store already
relocated in slice 2), internal/tools/provider/memory (the old tool
registration, redundant with slice 4's memory_create/update/delete/list),
config.Memory.{Provider,ProviderConfig} and the validateMemory rejection
that existed only to complain about Provider, and webui.MemoryStatus/
MemoryProviderHandle plus its dashboard page -- never wired in production
(s.Memory was always nil), confirmed by /api/capabilities always reporting
"memory": false.
Rewrites ARCHITECTURE.md's "Memory engine family" section to describe the
current engine (internal/domain/memory contract, internal/infrastructure/
memory builtin engine + its builtin/ markdown store, the per-turn read seam
in gateway/turn_memory.go, the per-turn write tools in
gateway/turn_memory_tool.go) instead of the deleted Manager. Fixes two
docs/architecture/configuration.md rows that described the deleted
manager's literals and SaveConfig mechanism.
|
||
|
|
095284678a |
feat(config): let the State Store and Gateway listen addresses be configured
Both gRPC listeners took their bind address from a -listen flag default alone, with no config key. The port a service binds and the port its clients dial were therefore two separate facts -- the flag default, and [services.<name>].target -- with nothing keeping them in step. On a host that already owned the default the effect read as a code fault rather than a port collision: the store died with "bind: address already in use" while every client reported "state store: connection error ... error reading server preface: EOF". Cockpit binds 9090 by default, so this is not hypothetical. Verifying the dashboard on such a host needed a hand-written overlay plus a matching -listen, two things to keep in step by hand. - [services.state].listen and [services.gateway].listen now name the bind address. Precedence is -listen, then config, then a default applied by the loader. An empty result is a startup ERROR, never a fallback: net.Listen reads "" as "any free port", so defaulting there would bind the service somewhere no client looks and still report success. - Both flag defaults become "" so configuration can win, mirroring how archie-ui already prefers [web].listen over its flag. - Gateway listen defaults to the same constant as the gateway target, so a default deployment's client and server cannot drift onto different ports. [services.state].target still has no default: an empty target stays a startup error in the daemon and gateway, which no longer serve a local store. - ServiceConnection gains the field. Its doc now says clients read only Target and TargetToken, and Listen belongs to the process that owns the service -- the previous wording claimed the struct starts no listeners while carrying one. - deployments/dev.toml states each port once, beside the target it must match, so `task dev` is retargetable on a host that owns 9090 by editing one overlay. Tests. Unit: config defaults, explicit values, and precedence. Process: the existing real-process smoke test now takes its listen from configuration instead of -listen, so the end-to-end wiring is proven by the test that already starts the binary, with no extra process. Both were verified load-bearing by mutation -- inverting the precedence fails the unit test, and making the app layer ignore config fails the process test with "state: no listen address". Verified: task check exit 0. Also documented in config.example.toml, the configuration architecture table, and the `task dev` summary. |
||
|
|
aa62d1aca5 |
refactor(config): delete the two decoded-but-unread policy fields
MemoryConfig.SessionTTL and ToolPolicy.ParallelExecution were decoded by config loading and read nowhere, so setting either silently did nothing. Removing them routes both keys into the unknown-key detector, which names them in a boot warning instead. A live-looking knob wired to nothing is the worse state, and the sibling memory.provider already earned a loud load-time rejection for exactly this. Also drops the config.example.toml line that shipped session_ttl into every first-run config.toml via configtemplate.go, and the commented-out dir_test.go assertions that would have re-created both fields under that file's "make these pass without modifying them" header. |
||
|
|
6951125415 |
feat(channels): wire chat.webhook route config through to the gateway
internal/channels/webhook's RouteConfig implements and tests HMAC
signature validation, payload template extraction, and reply delivery,
but setupWebhookGateway built []webhook.RouteConfig{{Path: "/webhook"}}
literally -- no config field could reach Secret/Template/DeliverTo, so
the gateway accepted any unsigned POST despite its package doc claiming
signature validation.
Adds config.ChatConfig.Webhook (WebhookRoute: path, secret as the
existing SecretRef pattern, template, deliver_to) and webhookRoutes(),
the pure translation into []webhook.RouteConfig that
setupWebhookGateway now calls. A secret ref that fails to resolve logs
and falls back to no validation rather than refusing to start, since
signature validation stays opt-in (an empty secret is documented,
valid config) unlike the mandatory forge webhook secret.
|
||
|
|
f54f130065 |
fix(install): emit an active State Store target so a fresh install can boot
install.sh produces config.toml two ways, and neither emitted an active [services.state].target. The self-host branch writes a hand-rolled heredoc with no [services] section at all, and the non-self-host branch rewrites only the [forge] block of config.example.toml -- where [services.state] sat commented out. openStateStoreAdapter requires a target, so a freshly installed archied aborted at startup with no way to boot from the config the installer had just written. Activate [services.state] with a loopback target in both sources, which is the producer fix: the config the installer emits is the invalid state, so it is corrected where it is generated rather than defended against at the daemon. [services.gateway] is activated alongside it for the same reason it is safe to -- internal/infrastructure/configuration/defaults.go already defaults that target to 127.0.0.1:8585, so declaring it changes no resolved value and only makes the emitted config explicit. Add TestInstallerGeneratedConfigHasServiceTargets, which parses what each branch actually produces: config.example.toml through the real config loader, and the install.sh heredoc reconstructed with its shell expansions resolved. Both assertions are red-first -- with the sources reverted the test fails on both branches with the boot-fatal message. Found by an adversarial package sweep (temp tracker: repo-root-deployment-1, .local/issue-tracker/). |
||
|
|
db18d2675a |
feat(ratelimit): wire per-identity inbound rate limiting into the gateway
internal/ratelimit was fully built (sliding-window limiter, ticker-driven eviction) but had no consumer, leaving multi-identity deployments with no inbound request budget on any channel (archie-core-6wxb / GH #797). Adds Message.SenderID (Telegram numeric user ID, SMTP from address, or webhook route path -- the closest thing webhook has to a caller identity), threads it into Router.Route/RouteStream via a shared checkRateLimit, and wires an opt-in [chat.rate_limit] config section through bootstrap with the documented EvictStale ticker. |
||
|
|
57d8d48279 |
feat(config): add [scheduling] config block
The cron ticker engine had no path from operator input to runtime. Add the four settings its EngineConfig is built from, as a declared type rather than loose root fields: interval, max_parallel, job_timeout, events_sink Every field is optional and defaults independently, so an absent section is valid and resolves to the engine's own documented constants. Zero means "unset, give me the default", which is why a negative value is a startup error rather than a clamp -- it is the only way an operator can name an unusable value deliberately, and running something other than what was written is how a misconfiguration stays invisible. events_sink is a simple on/off, "bus" or "none": the engine's Sink contract is the bus's emitter shape and there is exactly one bus in the process, so a named-sink registry would be scaffolding with one entry. Absent resolves to "none", the same shape applyMemoryDefaults and applyNATSDefaults use, so a resolved config has one spelling for "not publishing" rather than two that happen to mean the same thing. config.example.toml documents the block in the house style, commented out like [[repos]] and [capture]: a live example would be a default the operator never chose. |
||
|
|
ad1e6ea0d3 |
feat(gateway): operator-triggered PR review with selectable reviewer model
Add a channel-neutral review_pr command that runs the adversarial reviewer against an existing pull request and returns structured findings. The Web UI chat and Telegram invoke the same command; the reviewer model is models.reviewer (falling back to models.builder), configurable independently of planner/builder. - forge: PullRequest + PullRequestReader.GetPullRequest (github, gitea) - worktree: Manager.CheckoutPR materialises a PR head for Diff/Snapshot - agentworker: NewOperatorReviewer + ReviewerModel (single model-resolution rule) - gateway: review_pr tool, ChatPRReviewer, wired into TurnRunner for every channel - archied: prReviewer adapter with identity-scoped repo allow-list and per-PR single-flight, so duplicate/concurrent reviews are deterministic Closes archie-core-h019.8. |
||
|
|
2025e5f1ac |
docs: record the UI cutover and the archie-ui deployment story
- ui-service-boundary.md: the /api/captures|/mappings|/bindings row is resolved by the cutover; archie-ui composes the store contracts and mounts the captureintake receiver. - event-capture-storage.md HTTP surface: the receiver mounts on the one process serving the dashboard; work intake stays with the daemon. - config.example.toml: [web].listen is the archie-ui process's bind address; [capture] is projected by archie-ui. - deployments: document running archie-ui alongside the other services and add its systemd unit; capabilities comments updated for the single-serving composition. |
||
|
|
6048c8ba91 |
feat(archied): serve the daemon's own health endpoint
The update watchdog verifies archied's restart, so archied has to be what answers. It was probing the dashboard's /healthz, which belongs to the dashboard: switch [web] off and nothing answers, and in the extracted UI topology that endpoint reports a different process entirely, which would confirm a release while the daemon it was meant to verify is down. [health].listen (127.0.0.1:8485, defaulted, always on) serves /healthz, /health and /health/detailed for the life of the process. Liveness answers 503 until the daemon reaches its run loop: the listener binds before the subsystems do, so an unconditional 200 would tell the watchdog a half-booted release came up. Failing to bind is fatal, because a daemon nothing can probe gets every update rolled back. The State Store's readiness surface now shares the listener plumbing, keeping its log and error text verbatim. Closes archie-core-exbz, which asked which of two bad options to take when the dashboard is off. Neither: the daemon owns its own liveness. Also deletes TestInstallUpdateDetachesInstallerFromCallbackContext. It has failed intermittently under load more than once, racing its fake bot server's multipart parse against the cancellation it induces. |
||
|
|
4c9c7cac55 |
feat(gateway): authenticate the gRPC contract and allow off-loopback listeners
The Gateway had no transport boundary: RunGateway refused any non-loopback listen address and serveGateway registered no interceptor, so archie-ui was colocation-only while the State Store already had a token-authenticated equivalent. gatewayrpc gains a gateway-token metadata credential with constant-time comparison and both unary and stream interceptors on each side. Stream coverage is required here and not in staterpc: the Gateway's Stream RPC is server-streaming. Dial fails closed on a non-loopback target with no token, mirroring staterpc.Dial. gatewayServerOpts applies the same rule server-side: loopback stays insecure, non-loopback requires a token, malformed errors. The daemon resolves [services.gateway].target_token then GATEWAY_TOKEN; archie-ui passes the token its config projection already carried, so a distributed dashboard is now possible. Closes: archie-core-juqx |
||
|
|
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) |
||
|
|
9ef16151f4 |
refactor(state-store): migrate workflow/intake/task lifecycle consumers to State Store (archie-core-8cda.4.5) (#773)
Route the daemon's task-lifecycle / work-intake / workflow consumers (the TaskStore composite) through b.stateStore instead of reaching into b.st directly, the same additive composition pattern .4.4 used for the capture/mapping/binding contracts (docs/prds/state-store-contract.md §10/§12 step 6). b.stateStore is the in-process *store.Store by default and a remote *staterpc.Client dialed to the standalone archie-state-store gRPC service when [services.state].target is set, so this is behaviour-neutral until an operator flips the seam. Consumers migrated: daemon.Daemon.Store, webui.Server.Store, the message gateway routers, the chat task lister/log-reader adapters, the operator task action service, event persistence (persistAndBroadcastEvents), the manual requeue path, and the chat task creator/controller. openStores now seeds b.stateStore = b.st so it is never nil in either the daemon (Run) or the gateway (RunGateway) composition; the gateway never calls openStateStoreAdapter, so it stays on the local adapter and never dials a remote store (preserving the .4.4 fail-closed intent). The in-process State Store gRPC server keeps fronting b.st (the agent's gRPC and NATS storerpc handoff paths both stay on the daemon's local store) and the in-process serving path is untouched (deletion is .4.6). Adds focused composition-regression tests asserting the daemon, webui and task-actions consumers resolve their store from b.stateStore, plus the existing bufconn conformance suite (grpc adapter) already proves contract fidelity for the TaskStore surface. |
||
|
|
5fe5ff6626 |
refactor(state-store): migrate capture/mapping/binding consumers to State Store (archie-core-8cda.4.4) (#772)
* feat(state-store): add daemon composition path for remote store adapter ($services.state) Add the additive composition path the daemon's own capture consumers use (archie-core-8cda.4.4, docs/prds/state-store-contract.md §10/§12 step 6). bootstrap.go opens production store then resolves b.stateStore: the local *store.Store by default, or a remote *staterpc.Client dialed to the standalone archie-state-store gRPC service when [services.state].target is set. Wire the dashboard CaptureStore surface from b.stateStore. The in-process StateStore gRPC server keeps serving the daemon's SAME local store (stateStoreDeps from b.st), not the consumer-facing b.d.* adapters: task lifecycle (b.st) stays in-process until .4.5/.4.6 and there is no dual-store ownership. Fail-closed on a non-loopback target without a bearer token mirrors the standalone server's confinement (§9). * feat(state-store): route daemon mapping consumers through the state store adapter Migrate the MappingStore consumer to the State Store contract adapter (archie-core-8cda.4.4 step 6, Mapping swap): the dashboard's mapping editor (web.Mappings) and the daemon's dispatch loop (d.Mappings) resolve from b.stateStore instead of reaching into b.st directly. Local by default, remote *staterpc.Client when [services.state].target is set. * feat(state-store): route daemon binding consumers through the state store adapter Migrate the BindingStore/BindingDispatcher/BindingTaskCreator consumers to the State Store contract adapter (archie-core-8cda.4.4 step 6, Binding swap): the dashboard's binding editor (web.Bindings / web.BindingDispatcher) and the daemon's dispatch loop (d.Bindings / d.BindingDispatcher / d.BindingTaskCreator) resolve from b.stateStore instead of b.st. Local by default, remote *staterpc.Client when [services.state].target is set. * refactor(state-store): resolve daemon state store adapter only in daemon composition openStores is shared with the standalone archie-gateway (RunGateway), which does not consume the capture/mapping/binding surfaces. Resolve b.stateStore from the daemon's own Run() composition instead, so a gateway config that happens to carry [services.state].target can never dial (or fail closed against) a state store it does not use. openStateStoreAdapter takes no ctx: grpc.NewClient connects lazily, and the adapter resolution is synchronous. |
||
|
|
a59505816a | feat(state-store): stand up archie-state-store binary and own archie.db (archie-core-8cda.4.3) (#771) | ||
|
|
576e22b554 |
feat(state-store): generalize storerpc as the State Store gRPC contract (archie-core-8cda.4.2) (#770)
* feat(state-store): generalize storerpc as the State Store gRPC contract Implements archie-core-8cda.4.2 against docs/prds/state-store-contract.md rev. 2c: generate protobuf/gRPC client and server adapters for every ratified store contract (proto/state/v1/state.proto, 40 RPCs, one StateStoreService), add internal/infrastructure/staterpc with a bufconn conformance suite exercising both local and remote adapters, serve the service in-process (bridge address + mandatory per-task bearer token when agent containers exist, loopback-only otherwise), and flip archie-agent's workflow.Store to a long-lived gRPC client when the daemon injects STATE_STORE_URL/STATE_STORE_TOKEN (falling back to the legacy NATS storerpc path otherwise -- one agent process is never both). Also drops the *sql.Tx parameter from store.BindingDispatcher.RecordDispatch (a required wire-blocker fix: a transaction cannot cross a gRPC boundary, and production always passed nil). fix(store): drop RecordDispatch's unusable *sql.Tx parameter feat(config): add services.state contract-adapter selector * fix(state-store): apply no-mistakes review decisions - Drop StreamTokenInterceptor (unused; the State Store service has no streaming RPCs and nothing calls it). - Make StateStoreTokens.Validate compare tokens in constant time (crypto/subtle) per the auto-fix hardening.ing finding. - Amend config.example.toml / config.Services.State doc text so it frames [services.state].target as the ratified surface consumed by the upcoming standalone archie-state-store binary (.4.3), not active today. |
||
|
|
6affe0eea3 |
chore(curator): add embedding client and sampler interface prerequisites (#752)
* feat(curator): add embedding client and sampler wave-1 prerequisites Bead archie-core-1786637500752-415-434e5bb9 (GitHub #436) was closed with no linked PR/commits, and the surprisal-sampling bead archie-core-1786637500776-416-600a66e5 (GitHub #437) found none of its stated prerequisites -- an embedding client, a Sampler interface, or the four wave-1 cheap sampling strategies -- actually exist. This builds them: - internal/domain/embedding + internal/infrastructure/embedding: a narrow typed embedding client, config-driven via a providers table + a role in [models], mirroring the existing chat model role convention. Degrades to capability-unavailable (never fails startup or a call) for a missing role, unknown provider, unsupported class, or unresolved credential. Wired as an optional capability in bootstrap.go's setupEmbeddings. - internal/domain/sampling: the Sampler interface plus recency, random, all, and staleness-proxy strategies, per docs/prds/curator-sampler-wave1.md. Deterministic given fixed inputs, matching GitHub #437's stated acceptance criterion for the embedding-backed strategy it will add behind this same interface (not part of this change). Table-driven tests throughout; httptest for the embedding client, no live service. No curator wiring yet -- nothing consumes either capability in this change. * no-mistakes(document): docs(architecture): mark curator sampling prereqs as landed |
||
|
|
c75ed44721 | feat(telegram): support secret refs for bot tokens (#705) | ||
|
|
c6be68816e |
feat(eda): playbook document + event coordinator, single-action workflow-kind dispatch
Seventh slice of docs/prds/eda-playbook-engine.md (t2db.15), consuming
t2db.14's expr package: the rich trigger+actions playbook document and
the coordinator that dispatches it.
- internal/domain/eda/playbook: Load(dir) reads *.yaml/*.yml playbook
documents (trigger + exactly one workflow-kind action + optional CEL
when), validating the HARD BOUNDARY at load: a playbook with 2+ actions
or a non-workflow action position is a reported load failure --
multi-action and Module/Channel/Forge actions stay blocked on the
unresolved execution-time gaps. Any malformed YAML, invalid trigger,
missing workflow name, or when compile failure fails the WHOLE load
(reject-at-load, same shape as routing collisions); a missing dir is an
empty store. Trigger reuses the existing workintake kind/label
vocabulary (no second label-matching mechanism). Dispatch matches
trigger, evaluates when (CEL, event context with actions: {} -- no
prior actions in single-action playbooks), and returns the named
workflow from the registry via the same lookup Route() uses -- no
duplicated dispatch logic. when eval error follows the resolved doc's
J3: false, skip, caller logs.
- Store.Dispatch(reg, DispatchInput) is the coordinator entrypoint; input
carries Labels/Kind/Event. Production task intake wiring
(daemon.go/pollNATS/publishTask) is explicitly NOT in this ticket -- a
follow-up; proven end to end via direct tests plus the shipped example
(examples/eda-playbooks/bug-tdd.yaml) loaded and dispatched through the
real path.
- Config: EDAPlaybookDir (eda_playbook_dir), documented as DISTINCT from
PlaybookDirs (flat binding files) -- a reader cannot confuse the two.
- Bootstrap: playbook.Load wired in loadWorkflows, log-and-abort on
failure matching every prior slice; nonexistent dir is an empty store.
- workflow.Route(), workflowForLabels, and the t2db.9-.12 binding loaders
are UNTOUCHED (verified: their full test suites pass, zero regressions).
Also carries small lint cleanups on t2db.13/.14 code flagged by the gate
run: expr Eval no longer type-asserts to ref.Val (Eval returns ref.Val
directly in v0.32.0; cel-go's own Eval wraps evaluation in recover --
verified in source); module decodeLogArgs extracted to clear the nestif
finding. golangci-lint: 0 issues.
Tests (10): single-action round trip, when-false skip, 2-action load
failure, non-workflow position load failure, when compile failure drops
playbook, empty trigger load failure, trigger mismatch skip, no-when
match, one-invalid-file fails whole load, missing dir empty store, plus
the shipped example load+dispatch. task check clean (113/113 UI, exit 0).
|
||
|
|
7ef7d696f3 |
feat(eda): Module position first slice -- registry + side-effect-free log kind
Fifth slice of docs/prds/eda-playbook-engine.md (t2db.13), implementing docs/prds/module-position.md's recommended first slice: prove schema -> go:generate -> Yaegi load -> ModuleRegistry end to end with a side-effect-free action kind, before any kind with a real external effect (notify, image-gen, forge writes) -- those stay blocked on the parent doc's unresolved execution-time gaps (idempotency, mid-run failure). - internal/domain/eda/module/log: hand-written schema source (Args/Result/ SchemaVersion per module-position.md) + logextract generated symbol table via go:generate yaegi extract (same tooling as wfextract/ gateextract; scoped to ./internal/domain/eda/module/...). - internal/domain/eda/module: ModuleRegistry with Register(kind, dir) / Invoke(ctx, kind, rawArgs). No generic Module interface with an any payload: each kind is its own tiny package with its own generated contract; the registry's internal storage is the only place erasure appears (exactly as inside wfextract). Invoke decodes rawArgs strictly into the kind's Args before calling the interpreted function -- an unknown key or wrong type is a reported failure, not a silent zero-value fill (the 'schema defines the accepted message' rule). Generalizes gateeval's fixed-signature Yaegi pattern via yaegiutil.New/Resolve/Safe -- no new interpreter-construction or panic-recovery mechanism. - Config: ModuleDir mirroring PluginDir's shape and doc comment (operator-trusted directory of Yaegi module implementations, one .go per kind; empty means none loaded). Wired at daemon startup in bootstrap.go alongside PlaybookDirs loading -- log-and-abort on load failure (a broken module is a startup failure, not degrade-and-skip). - examples/modules/log.go: operator-facing example (//go:build ignore, mirroring examples/secret-engines/) proving the shipped contract. Tests: registry (register/invoke, unknown kind, missing file, strict arg-decode shape failures, malformed file, panic recovery), logextract smoke test, and an example-load test that runs the shipped examples/modules/log.go through the real registry (not a test fixture). task check clean (113/113 UI, exit 0). Playbook YAML action dispatch is deliberately out of this slice: a minimal 'run this one module action, no chaining' dispatch still requires naming how args values reach the action (parent doc open question 1 -- data-flow/interpolation syntax) and what the result feeds, both unresolved by design. Dispatch is a follow-up ticket that consumes this registry as-is; recorded in module-position.md. |
||
|
|
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. |
||
|
|
087f161836 |
feat(store): encrypt playbook binding secrets at rest
binding.Binding.Secret was persisted as plaintext in the bindings.secret column, so anyone with the SQLite file saw sender-side HMAC secrets. Seal it with AES-256-GCM transparently inside the store: encrypt-on-write, decrypt-on-read. - cipher: AES-256-GCM, 12-byte random nonce, SHA-256-normalised 32-byte key resolved through the secret registry ([bindings].encryption_key). - envelope 'arcie-binding:v1:<fingerprint>:<b64(nonce||ct||tag)>' so a future cipher/KDF change is a version bump and old rows stay readable. - rotation via previous_encryption_keys; key identity is the material's SHA-256 fingerprint embedded in each row. - legacy plaintext rows written before a key was configured stay readable; encryption is not retroactive. - nil cipher (no key configured) preserves the pre-t2db.7 plaintext path. Deferred: captured_events.body redaction upgrade (separate concern, see docs/prds/binding-secret-encryption.md). Refs archie-core-t2db.7 |
||
|
|
63f75db30b |
feat(webui): surface allow_concurrent/max_retries/review_enabled on the repositories card
RepoView.ReviewEnabled was previously absent from GET /api/config entirely, not just unrendered; add it alongside AllowConcurrent and MaxRetries. The repositories table gains Concurrent/Max retries/ Self-review columns as read-only pills -- this is the concrete discoverability fix for "why isn't a second agent running": that config was already reachable from the API, just never shown. config.example.toml documents review_enabled, which had no example entry before this. Full inline editing of per-repo fields is out of scope here: the dashboard's PATCH /api/config path has no array-index support for updating one element of the Repos slice, which is separate, real scope -- filed as archie-core-b6ew.6. Closes archie-core-b6ew.4 |
||
|
|
f4111e7208 |
docs(config): document chat.telegram.token_env in config.example.toml
TelegramConfig.TokenEnv was a real, used field with no example-file mention -- an operator reading the template wouldn't discover the key exists. |
||
|
|
75158b7fc7 |
feat(image): define provider-neutral image capability contract and config
Adds internal/domain/image (Provider/Registry per the plugin engine family shape, but no Lifecycle -- a provider is call-scoped, not long-running) and config.ImageConfig with the same explicit enabled=true cost gate MinimaxConfig already uses, since a hosted provider spends real API credits and a local one can saturate the host GPU. Design doc at docs/prds/image-capability-contract.md per CLAUDE.md's rule for undesigned capabilities. No provider implementation lands here -- that's the epic's next child bead. Also re-links all 7 epic children that were unlinked from archie-core-1786748942120-1-6636e629 (same orphaning pattern found in the curator/memory epics earlier this session). |
||
|
|
8fff1b5dfd |
fix(config): reject memory.provider instead of silently ignoring it
Closes archie-core-1786637499161-356-e424e40d.1. setupMemory's own doc comment claimed external providers are added via RegisterExternal when cfg.Memory.Provider is set -- no such call existed. Investigated wiring it for real: there is no external MemoryProvider implementation anywhere in the repo to construct and register (only internal/memory/builtin.Provider exists), so there is nothing to route memory.provider's value to yet. Wiring the call would be dead plumbing to nothing, not a fix. The actual defect is that setting memory.provider has always silently done nothing -- an operator who set it reasonably believed they configured something. validateMemory now rejects it outright with a clear reason, turning a silent no-op into a loud one at config load, same failure-loudly posture as every other unimplemented-value check in this file. Drop the rejection once a real external provider (or the new domain/memory engine family's Honcho proof, archie-core-1786637492031) gives the field an effect again. Updated setupMemory's doc comment and config.example.toml to match -- the provider_config example is removed too, since it has nothing left to configure. |
||
|
|
be03844df8 |
feat(config): config surface for memory engine selection
Part of archie-core-1786637490043 (config surface for memory engine selection and settings). config.MemoryConfig gets an Engine field selecting among the domain/memory engine family, plus toml tags on every field -- Provider, ProviderConfig, and SessionTTL had none before, yaml/json only, which didn't match repo convention. Engine and Provider are kept as two separate fields rather than one: they select between two different mechanisms (the new engine family vs. the legacy external-provider path, archie-core-1786637499161-356-e424e40d.1), and conflating them would mean a value meant for one silently getting read by the other once both are wired. applyMemoryDefaults resolves an absent engine to "builtin" so unconfigured and explicitly-builtin are the same state everywhere after defaulting. validateMemory rejects an unrecognised engine name in the same style as forge.type's existing validation -- named constant list, "%w: field %q (want %s)" shape, wired into the same validate() chain. config.example.toml documents the new field. Not yet wired to anything: nothing reads cfg.Memory.Engine at daemon boot yet to actually select and start an engine through domain/memory.Registry. That's bootstrap wiring, tracked as the remaining half of archie-core-1786637499480 (ship the builtin store as the default engine). |
||
|
|
37cfe87508 |
fix(webui): validate mutation Origin against the effective external scheme
Origin validation compared the request's Origin against the daemon's own direct connection: scheme from r.TLS, host from r.Host. Behind a TLS- terminating reverse proxy the browser sends Origin: https://host while the daemon sees a plain HTTP connection, so every dashboard mutation was refused as cross-origin. Taking X-Forwarded-Proto/-Host unconditionally would be worse than the bug: any client can set them, so an exposed daemon would let an attacker forge the scheme half of the CSRF check. They are honoured only when web.trust_forwarded_headers is explicitly enabled, which is off by default and documented as safe only behind a proxy that overwrites or strips untrusted forwarded headers. authorizeTaskMutation becomes a method because the decision now depends on server configuration; its three call sites move with it. |
||
|
|
972fb5b8e1 |
feat(deployment): default to managed NATS workers
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image. |
||
|
|
5d00ec7b0c |
refactor(agentexec): remove legacy execution paths
Autonomous workflows now have exactly one production boundary: a task-scoped archie-agent receives a full-task core-NATS request and runs the worker-local stage loop. The legacy [agent] section remains decode-only for migration; it no longer selects runtime behavior. |
||
|
|
1b7bc004b6 | feat(nats): expose embedded broker to managed workers | ||
|
|
691e10c251 |
fix(telegram): compact tool output and drop turn caps
Render completed ToolCallEvents as Telegram-safe streaming blocks with compact name/status and a short cleaned preview. Summarize file contents and listings instead of dumping source or quoted JSON. Collapse repeated legacy turn-budget failures. Remove max_tokens turn gating and the 200000 turn_budget_chars default so absent or commented config cannot restore an aggregate cap. Keep per-result max_result_chars and spill. Confine find/grep discovery to the active workspace/worktree. Refs #604 |
||
|
|
86faa6965d |
docs+scripts: add archie-update-check, document missing config sections
The check-side of the reference update adapter never existed: scripts/ had archie-update-install and archie-update-watchdog but no archie-update-check, so any deployment that configured chat.telegram.update_check_command pointing at the documented "/usr/local/bin/archie-update-check" path had nothing there to run -- /update would report "not configured" regardless of what was actually set. Add it: read-only, reports the daemon/agent components via git describe against the local checkout and origin/main (no fetch-and-pull the way install does), using the same "daemon"/"agent" component IDs archie-update-watchdog's report and releaseupdate.ComponentDaemon/ ComponentAgent already use, so Service.Enrich and Report.Verify (this session's earlier work) recognise it automatically. Also fix archie-update-install's archie-agent build: it stamped archied's ldflags but built archie-agent with none at all, so even a native (non-container) archie-agent install reported an unstamped "dev" build with installtype.Unknown. config.example.toml gained every section that existed in the Go schema but wasn't documented anywhere, not even commented: skills_dir, plugin_dir, [chat.email], [chat].webhook_addr, [log], [memory] (noted as currently unwired -- RegisterExternal is declared but never called from cmd/archied, so the section has no effect yet), [[identities]] (pointer to docs/architecture/identity.md rather than duplicating it), and [[repos]].max_retries. tools.tool_policy.parallel_execution was deliberately left undocumented: it's declared on ToolPolicy but never read anywhere, genuinely dead rather than just underdocumented. |