d4e254b3494de7ce47477b9421e8c8d3e035e104
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e5105280ad |
chore(config): remove token_env aliases for forge, artifacts and telegram
Each credential is now only a {engine, key} secret reference. A stale
token_env in a file is reported at startup as an unrecognised key.
nats.token_env stays (no secret-ref form), and providers.api_key_env stays:
it is the carrier the resolver writes each resolved key's env name into.
|
||
|
|
afca67da9b |
feat(messaging): route a channel reload, and refuse one that cannot reload
archie-core-np7l's service half -- the reload action and its truthful refusal. The request surface that carries the instruction from the dashboard is its own change, because it is its own object with its own lifetime (the reasoning is recorded in docs/architecture/migration-decisions.md). Service.ReloadChannel routes to the channel's own seam rather than reimplementing it: the telegram front-end re-reads its token and allowlist, which is what its own /restart path calls. A channel that cannot reload is refused with a reason instead of accepted and ignored, because the dashboard offers the action on the strength of the capability the descriptor declares, and an accepted-then-nothing reload is a lie the operator cannot see through. The capability and the action now come from one source. Before this a descriptor declared ReloadSupported by NAME, so a channel could announce reload support and have nothing behind it; reloadable() decides both, and the descriptor test builds a real gateway with a seam rather than a fake named "telegram". Verified: task check exit 0. Coverage: the refusal names the reason for a channel that declares no support and for an unknown channel; the service reaches telegram's own reload seam and the re-read config lands; and the declaration and the action cannot drift, which is asserted by reloading every composed channel and requiring the refusal specifically to be "does not support reload" -- a declared reload may still fail on the configuration it re-reads, and that is a different fact. |
||
|
|
bbec2617e1 |
feat(state): carry channel lifecycle from the Messaging Service to the dashboard
archie-core-8cda.6.8's carrier. The service now records channel lifecycle and has nowhere to put it: /api/channels answered with nothing because webui.Server.Channels had no production source, and reload answered 501 for the same reason. This adds the surface the register decided on, following the split archie-core-ymut established for config snapshots -- a pair of administrative RPCs whose writer is one process and whose reader is the UI -- and wires both ends. Wire and store: PutChannelStatus / ListChannelStatus, with ChannelStatus carrying id, name, state, detail, configured, reload_supported and observed_at. The store holds one row per channel and replaces the reported set, so a channel the reporter no longer mentions is deleted rather than left standing as a stale "running"; an empty report clears the table, because hosting no channels is a fact worth reporting. A row without an id is refused: it could never be replaced or removed by a later report. Writer: the service publishes on every lifecycle transition through a coalescing signal -- a burst of transitions is one write, since a reader only wants the latest state of every channel -- plus a start-up report and a final report after shutdown, so a stopped service leaves the store honest. A failed write is logged and retried on the next signal; the dashboard losing channel state is worth a warning and never worth failing a channel start over. Reader: webui.Server.Channels becomes a source rather than a concrete manager, and webui.RemoteChannelStatus reads the store the way RemoteConfigView reads the config snapshot. A store it cannot reach reports nothing rather than a stale "running", and a state the reader does not recognise is carried through rather than dropped. The contract's own index gains the group in the same change that adds the RPCs -- a surface the grouped table does not list is one nobody finds -- and the count moves to 51. The register records why the surface is the State Store rather than a resource kind, and why reload gets its own surface rather than a field here: reading status must not be able to retrigger an action, a transient request is not distinguishable from state once anything polls it, and it would invert the writer/reader relationship the precedent establishes. Verified: task check exit 0. New coverage: the store's replace-the-set semantics and its refusal of an id-less row, the reader's mapping including an unknown state, and the publisher's start-up, transition and final reports. |
||
|
|
2e4db2bdc3 |
feat(messaging): record channel lifecycle, and decide its surface
archie-core-8cda.6.8's producer half. The service handed every channel an empty
channels.Lifecycle{}, so starting, running, failed and stopped were recorded
nowhere and internal/channels/status.Manager -- which has had MarkStarting,
MarkRunning, MarkDegraded, MarkFailed, MarkStopped and Snapshot all along -- had no
production writer at all. The channels have always reported: all three call
ReportStarting and ReportRunning on whichever lifecycle they are given.
Each composed channel now gets its own report into a manager keyed by channel, so
one channel's failure marks only itself; a channel that cannot start is marked
failed with its reason rather than only logged, and a channel that returns is
marked stopped. Service.ChannelStatus is the producer a dashboard surface reads.
Left open deliberately: the cross-process carrier, and reload's direction.
docs/architecture/migration-decisions.md records the shape by the precedent the
contract already establishes -- archie-core-ymut's config snapshot is "the one
surface whose writer is the daemon and whose reader is the UI process", a pair of
administrative RPCs deny-by-default under authorizesTaskScopedCall -- and names
what that settles: channel state is runtime state rather than a settings document,
so it does not belong among the ControlPlaneService's validated resource kinds; the
UI already dials the State Store and pumps its cursor, so no new transport is
needed; and the contract PRD's grouped table gains a group in the same change that
adds the RPCs. Reload runs the other way and is left as a named open question
rather than decided by analogy with a status report, because a request queue and a
status report do not have the same lifetime. It also records that 8cda.6.9's
component self-report is the same shape, so the two do not become two homes for
"what a component reports about itself".
Red-proofed: restoring the empty lifecycle fails TestServiceRecordsChannelLifecycle
with "channel webhook never reached running; last report State:configured", so the
test pins the fix rather than the manager's existence.
Verified: task check exit 0.
|
||
|
|
16ed387b97 |
test(messaging): add the end-to-end channel smoke verification
archie-core-8cda.6.5's remaining half. The gate landed in 4424071b; what was
missing is the verification that the extracted service actually carries a message.
It drives the deployed path -- compose, the real webhook adapter, a real listener,
a real signed HTTP request -- and asserts on what crossed the chat contract as well
as on the reply the caller receives back, which DeliverTo=origin routes through
that contract. The envelope assertions are the three transport facts this channel
must carry, each of which has a reason recorded elsewhere: platform "webhook" is
how the Gateway learns which channel it serves (archie-core-c1qx); SenderID stays
empty because a route path is a source and never a person (archie-core-oyna); and
the route survives as the budget key, so the inbound limit still applies.
Webhook is the only channel a test can own. Telegram needs a bot token and the
Telegram API, email needs SMTP, so neither can be exercised here. The PRD's fourth
criterion asks for a live Telegram round trip "or equivalent channel smoke test",
and this is that equivalent: every step between the POST and the contract is the
deployed code path. The gRPC hop beyond the contract is covered by
internal/infrastructure/gatewayrpc's conformance tests, which run the same client
and server in both local and remote mode.
Red-proofed rather than assumed: signing the request with the wrong secret fails it
with "status = 401, want 200", so the signed path is genuinely exercised rather
than bypassed.
Also carries
|
||
|
|
4424071baf |
refactor(messaging): sever the Messaging Service from the store and workflow runtime
The PRD's deletion gate for the Messaging Service could not pass: go list -deps ./cmd/archie-messaging linked modernc.org/sqlite, internal/store, internal/domain/workflow and internal/agentexec -- all through one import, archiemessaging/run.go -> internal/app/controlplane, from which the service used three symbols. The decision was to sever rather than amend the gate, because a boundary you whitelist around is no longer a boundary (archie-core-1ng1, recorded in docs/architecture/migration-decisions.md). Measured before touching anything: internal/app/controlplane was the ONLY direct import of the service that dragged those runtimes -- every other one was clean -- so severing this one dependency is sufficient for the gate. Moved into the new internal/infrastructure/controlplanerpc: the generic resource client (NewRPCClient, Query), the RuntimeChatConfig projection, the reader interface (now the exported ResourceReader), the wire sentinels, the status mapping (now ClientError), and the channel-settings document with its decode -- ChannelSettings, TelegramSettings, WebhookChannelSettings, EmailSettings, RateLimitSettings, ChannelDuration, DecodeRenamingLegacyKeys. internal/app/controlplane keeps the store-backed server, the Definition registry, every kind's seed/validator/Normalize, the schema derivation, and its resource-specific reads and watches. Its Client embeds the new one, so the read path has one implementation while the workflow, persona and cronstore reads stay with the processes that already link those engines. The documents are type-aliased back into this package so the store-backed side reads them by the names it has always used: one definition, not a copy on each side of the boundary. The gate is now enforced by cmd/archie-messaging/architecture_test.go, measuring the linked binary against the PRD's banned list, with one exception checked in both directions: internal/domain/workflow/task, the Task status and view vocabulary whose own dependency set holds none of the banned runtimes. The UI gate carries the same entry for the same reason, and the fleet skill names it as the precedent. Verified: task check exit 0. The gate was red-proofed twice -- banning internal/channels fails it, and removing the workflow/task exception fails it -- so neither the loop nor the exception is decorative. |
||
|
|
48367151f3 |
feat(controlplane): report which settings version each process is running
Every process that layers database-owned settings now publishes the version it applied, and re-stamps it every 30 seconds so the report time doubles as a liveness signal. A record older than 90 seconds belongs to a process that has stopped, which is the only way this surface can tell a live process from one that applied a version and then died. RuntimeConfig returned the merged config and discarded the versions it read, so no caller could report what it had applied. It now returns them, and archied and archie-gateway report each kind through boot.runtimeConfig at boot and on SIGHUP. A validation failure reports every kind with the error, because the layering is all-or-nothing, and leaves the recorded version alone so a rejected edit does not erase the fact that an older one is live. The daemon also reports workflow execution settings as the watch applies them, and archie-messaging reports channel settings at startup. Reporting is best-effort by construction: the configuration a report describes has already been applied, so a failed write is logged and never returned. That keeps it off the reload's error path, where it would have raised a banner saying a reload failed when its config took effect. applystatus.New refuses a process name Processes() does not list. The reader renders known names, so an invented one would be invisible rather than wrong, which is the same thing the page means by a process that never started. Relates to archie-core-pskb. |
||
|
|
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. |
||
|
|
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. |