08ebc19c8c7bb33765c4e5ffbccc8ac49130c60e
23
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2311529def |
refactor(config): delete the runtime config overlay
The control plane replaces this, rather than extending it (docs/prds/runtime-control-plane.md, "First implementation"). Until now both paths existed: overlay kept dashboard edits in its own SQLite file beside archie.db and layered them over the file config at boot and on every reload, which is the duplicate configuration authority the PRD set out to remove. Gone with it: the --no-config-overlay flag and ARCHIE_SKIP_CONFIG_OVERLAY recovery hatch, which existed because a bad overlay row could brick the boot; ReloadStatus.OverlayUnavailable; and the reload controller's overlay source. The -config-overlay file overlay is a different thing and stays. The dashboard's three write seams went too. UpdateConfig, ResetConfig and UpdateRepoField were assigned only in internal/webui's own tests, so in production they answered 503 and ConfigView.Editable was permanently false (archie-core-j28m). Removing Editable would otherwise have flipped the SPA's controls on, since configEditable read a missing field as true, so the config pages become what they already were in practice: a read of what each process is running with. Configuration is written through the control plane. apply.go survives this deliberately; archie-core-xrux carries the question of whether its map merge is still guarding the file overlay path. |
||
|
|
29bd321894 |
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. |
||
|
|
8301a949ee |
Merge pull request #827 from samcharles93/fix/webui-config-projection-chat-setup
fix(webui): count every chat front-end in the published projection |
||
|
|
73aa86181e |
fix(webui): count every chat front-end in the published projection
GitHub #821 reported two dashboard behaviours degrading in the extracted UI
process because webui.Server.Cfg is nil there. Half of it was already closed:
|
||
|
|
87d8d39321 |
fix(webui): publish per-identity forges so multi-identity task rows keep their links
Task rows in a deployment configuring [[identities]] rendered no forge links. ConfigView carried the default identity's forge alone, so resolveForge (api_tasks.go) withheld the links entirely rather than pointing every row at the wrong forge -- production behaviour since the UI process cutover (archie-core-8cda.5.4), where the dashboard runs in a process with no config.Holder. archie-core-ml30 then removed webui.forgeConfigForTask and its test, which resolved a task's forge from config.Config and had no reachable caller once the holder was gone. Fix at the producer, not the renderer. ConfigView gains `identities`: each configured identity's forge type and host, plus the repositories it owns. That is the whole answer to "which forge owns this task", and it is a projection the daemon already rebuilds and republishes on boot and on every reload, so nothing new is needed on the publish side. Only coordinates and repository names cross -- an identity's token is a secret reference and stays out, which the new test asserts alongside the existing leak guard. resolveForge ports the matching rules recovered from 5b91a3a's forgeConfigForTask onto that projection: an exact identity name first, then repository ownership, and an ambiguous repository -- two identities claiming the same owner/name -- falling back to the default forge rather than inventing a link. Two deliberate departures from the recovered shape: it indexes the identity list once per request instead of rescanning config per task, since the projection supplies repo slices it can key on directly; and a document that reports multi-identity but carries no per-identity forges still withholds, because that is what an older daemon published and guessing there is the original bug. The recovered code's first-wins scan for a duplicated identity name is preserved. Tests: the projection's per-identity forges and their secret-freedom; the three matching rules and both fallbacks through resolveForge; every row of a multi-identity GET /api/tasks carrying the right forge's link; and the real archie-ui binary driven over HTTP against a multi-identity projection, which fails on the pre-fix resolver with three unlinked rows. |
||
|
|
03afd2e8ad |
refactor(webui): take configuration off the dashboard server
webui.Server declared Cfg *config.Holder with eight read sites, none of
which ran in the UI process: composition leaves it nil there. The field
survived because the daemon kept a webui.Server it never served, using it
to render the published ConfigView snapshot and to hold the readiness
probes (archie-core-ml30).
Split at the producer. LocalConfigView becomes webui.BuildConfigView, a
pure function over a ConfigViewInput the configuration owner assembles;
the DTO and its schema stay where the UI renders them. The daemon builds
that input from its own state (boot.configViewInput) and publishes the
result. Readiness reads the daemon's Holder, channel manager and chat
contract, and the registry it produces is a daemon field, not a field on
a server with no listener. Boot now owns one Holder instead of seeding a
second and replacing it in buildDaemon; operator retry caps read it too,
so they follow a reload rather than a boot-time snapshot.
Server loses Cfg, ConfigProvenance, LastReload, ConfigOverrides and
SetProvenance. The nil-guarded branches they fed went with them, each
checked first against what the UI process actually serves:
- chat.show_tool_calls and the /api/setup checklist were degraded, not
dead. ConfigView gains a chat section carrying show_tool_calls, the
operator name and whether a channel is configured, and both surfaces
read the projection. The end-to-end suite asserts the checklist renders
from the published snapshot.
- /api/logs takes its path as a process-local option. The history is on
the daemon's disk, so a dashboard elsewhere cannot read it by learning
the path; that route still needs a contract.
- handleChannels drops its config-derived fallback, superseded by the
status manager, which already carries the descriptions and detail.
- trustForwardedHeaders keeps only the process's own setting, which the
UI process already sets.
- resolveForge keeps the published-projection path it already had.
ConfigView.Editable moves to handleConfig, decided by whether this
process holds UpdateConfig. It describes the writer, not the document, so
the write contract (archie-core-j28m) makes the page editable by wiring
one field. The write handlers and their seams stay for it.
overlay.Store gains Keys: Snapshot nests dotted keys for decoding, so the
overridden-key list was publishing section names ("budgets") where the
dashboard marks and resets rows by stored key ("budgets.max_steps").
Multi-identity forge links move to archie-core-pv6t: forgeConfigForTask
resolved a task's forge from config.Config, had no reachable caller once
the holder was gone, and belongs in the projection rather than the
rendering package.
|
||
|
|
50845430e3 |
test(ui): smoke the archie-ui process against live dependencies
The in-process suite proved the composition; nothing proved the process. This builds the real binary, points it at a State Store and a Gateway on loopback gRPC through an operator-shaped config.toml, and drives it over HTTP: the token exchange and its 401s, the embedded SPA, a chat stream relayed frame by frame, an operator task action crossing to the Gateway and refused without the CSRF header, unauthenticated capture intake, the ratified degradations, readiness dropping when a dependency dies while liveness holds, and a clean SIGTERM. It found one regression, fixed here at the producer. Task rows lost their forge links in the extracted process: taskURLs read config.Holder, which is nil once the dashboard stops sharing the daemon's process, so every click-through to the issue and the PR silently disappeared. The forge is now resolved once per request from whichever source that process owns, the daemon's configuration or the daemon's published projection. A multi-identity deployment keeps no links rather than gaining wrong ones: the projection carries the default identity alone, so it now says so and the renderer withholds. |
||
|
|
a00c578cb7 |
refactor(ui): sever the archie-ui binary from every daemon runtime package
Completes the objective deletion gate for the UI Service (archie-core-8cda.5.6): go list -deps ./cmd/archie-ui now links zero banned packages -- no modernc.org/sqlite, no internal/store, gateway, channels, memory, secret, agentexec, tools, skill, yaegiutil, curator, or the workflow engine. The closure shrinks from 68 to 26 archie-core packages. Each cut is a producer-side move; no consumer-side defensive shims. - Store contracts (TaskStore family, value types, sentinels) moved from internal/store to internal/domain/storecontract -- the approved contract location per state-store-contract rev. 2d, and NOT internal/contracts: that tree is buf generate output and tools/proto.sh check deletes hand-written files there. internal/store keeps aliases; sentinel message strings are byte-identical and remain the wire contract. - Chat contracts (ChatContract, sessions, turns, streaming, commands) moved from internal/gateway to internal/domain/messaging; gateway keeps aliases. ToolCallEvent rendering helpers become gateway functions (methods cannot live on alias types). - Task vocabulary (Task, statuses, mid-run Store, Definition) split into internal/domain/workflow/task; the pipeline engine stays in package workflow with aliases, so daemon-side callers are unchanged. - overlay.DeniedKeys moved to internal/infrastructure/configuration: webui referenced the constant and that dragged the overlay SQLite store in. - webui.Server's concrete runtime handles become webui-owned view interfaces with daemon-side bootstrap adapters: channel lifecycle (internal/channels/status), MemoryStatus, CuratorStatus, and a SkillCatalog seam replacing the direct skill.DefaultRoots/CatalogRoots calls. Each degrades to an empty page when unwired. - config.SecretRef moved into internal/config (config vocabulary); internal/secret keeps an alias and Registry.Resolve absorbs the zero-value short-circuit. Docs: state-store-contract rev. 2d relocation record; ui-service-boundary deletion gate marked satisfied; ARCHITECTURE.md package map rows. |
||
|
|
983ddd7c4b |
refactor(store): move the producer-owned contracts to internal/contracts/store/v1
The deletion gate for the UI Service (archie-core-8cda.5.6) is objective: go list -deps from cmd/archie-ui must show no SQL/store implementation. internal/store's hand-written contract surfaces (TaskStore and its component interfaces, CaptureStore, MappingStore, BindingStore, BindingDispatcher, BindingTaskCreator, ConfigSnapshotStore) move to internal/contracts/store/v1 (package storev1), alongside the value types they carry (CapturedEvent, ConfigSnapshot, WorkflowStat, StageStat, DayTokens) and the sentinel errors -- whose canonical message strings are the wire contract and are byte-identical after the move. internal/store keeps type aliases, so daemon-side callers (archied, the daemon, staterpc's server side, taskactions) are unaffected. The UI-facing packages switch to storev1 directly: webui, archieui, captureintake, gatewayrpc, and staterpc's client/values -- which drops internal/store and modernc.org/sqlite from the archie-ui binary's import closure. overlay.DeniedKeys moves to internal/infrastructure/configuration for the same reason: webui referenced the constant and that dragged the overlay package's SQLite store in. The chat-contract and remaining runtime-handle decoupling continues under the same bead. |
||
|
|
5288a8d980 |
feat(webui): render configuration from a published snapshot
The configuration page had exactly one source: this process's own config.Holder. The UI process has no holder and is not permitted one, so the page was empty there and the shared-holder assumption was the thing blocking the cutover. GET /api/config now reads a ConfigViewSource. The daemon builds the projection from the configuration it owns, as before, and publishes that same document to the State Store on boot and on every republish -- reload, a dashboard edit, a repository field change -- since those are exactly the moments it changes. The UI process renders what it reads there and nothing else; an unknown schema is refused rather than half-rendered, and nothing published yet is the documented empty response, not an error. Editable is a property of the process, not of the configuration, so each source sets it: the daemon holds the update path, the reader does not. The settings page honours it, rendering values where it would otherwise offer controls whose PATCH would answer 503 -- the deliberate feature reduction archie-core-ymut recorded, made visible instead of discovered by clicking. A failed publish is logged and degrades to a stale page. It must never fail the reload or the edit that produced the configuration, both of which have already taken effect. |
||
|
|
c75ed44721 | feat(telegram): support secret refs for bot tokens (#705) | ||
|
|
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 |
||
|
|
bb3b11f7e8 |
feat(webui): attach the config field schema to GET /api/config
ConfigView.Schema carries the archie-core-b6ew.1 descriptor catalog with each request's own values, locked reasons, and overridden markers attached (buildConfigSchema), additive alongside the existing flat fields so nothing that reads ConfigView today breaks. Tests confirm schema values match their flat-field source of truth, locked reasons propagate to the schema entry, structured fields stay non-editable, and secrets never reach the schema block. Closes archie-core-b6ew.2 |
||
|
|
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. |
||
|
|
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 |
||
|
|
171e1b2686 |
feat(config): surface overlay state, shadowed keys, and per-row reset
Three gaps closed, all in the 'your change didn't take effect and nothing told you' family: 1. MaxRetries joins the reloadable allowlist, and the criterion is fixed on reloadableFields: a field is reloadable when EVERY consumer re-reads it. MaxRetries is the worked example -- its only consumer is the webui maxRetriesFor handler, which re-reads per request (api_tasks.go:380,383); nothing in the daemon reads it, so warning 'requires restart' was spurious. Chat.Telegram.TokenEnv is documented as the counter-example (webui reads it per request but a startup-built telegram bot consumes it, so it is not reloadable). Pinned by TestChangedNonReloadableFields alongside the comment. 2. Boot-time overlay degradation is now surfaced. config.ReloadStatus gains OverlayUnavailable; main.go records the reason when the overlay store cannot be opened or its values fail validation, and /api/config carries it (merged into LastReload). Cleared by a successful dashboard write or reset. The settings page renders a warning banner, so a daemon running on file config alone says so where the operator is looking, not only in logs. 3. Overlay-shadowed file edits are visible and recoverable. ConfigView.Overridden lists the dotted keys the runtime overlay currently sets, so the UI marks those rows (their file value is shadowed until reset). POST /api/config/reset exposes the store's Delete as a per-row reset: it deletes the row and republishes file + remaining overlay, which is also the answer to 'my file edit isn't taking effect'. The dashboard can now remove every override it can create. Verified: task check clean; -race clean on cmd/archied, webui, infrastructure/configuration; new handler tests cover the reset 200/400/503 paths and the overridden list. |
||
|
|
da2d93a830 |
feat(config): runtime config overlay store and PATCH /api/config
The second half of #348's storage layer: dashboard-edited overrides live in their own SQLite file, separate from the task and conversation stores so each file owns its user_version and migrator with no contention (configDBPath -> cfg.DBPath + "-config.sqlite", matching the taskDBPath / conversationDBPath convention). Store (internal/infrastructure/configuration/overlay): - config_overlay(key TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at, updated_by), own migration, WAL. - Set refuses DeniedKeys (db_path, work_dir) at write time as well as at the API layer; the map is exported so the dashboard can show the reason instead of silently omitting the edit affordance. - Snapshot JSON-decodes each value and nests dotted keys ("budgets.max_steps" -> map[b][m]) ready to decode into Config. Loader (ApplyOverlay / ApplyOverlayValues): - Decodes a nested overlay map with the same field-level precedence as a file overlay, records the runtime-overlay origin, then applies defaults and validates. Used at boot, on SIGHUP reload (ReloadController gained an optional WithOverlay source) and by the PATCH path. Boot and reload: - A broken overlay (unopenable store, unreadable snapshot, values that fail validation) degrades to file config alone -- it must never brick the daemon. --no-config-overlay / ARCHIE_SKIP_CONFIG_OVERLAY=1 skips the store entirely; the flag is now a real gate, not a log-only stub. PATCH /api/config (webui): - handleConfigUpdate decodes {"updates": {dotted.key: value}}, calls the composition-wired UpdateConfig seam, and classifies errors via webui sentinels: ErrConfigUpdateInvalid -> 400 (denylisted key, failed validation, unparseable value), ErrConfigUpdateUnavailable -> 503 (overlay skipped by recovery flag), anything else -> 500. - The seam (main.go) applies updates to a COPY of the published config, validates the materialised result, persists to the overlay, then publishes through the same path as reload -- it never calls Set directly from the handler, since web.Cfg is the daemon's own Holder. - ConfigView gains Locked (dotted key -> reason) so the UI disables denylisted rows explicitly. Verified: task check clean; new tests cover the store round-trip, denied keys, loader overlay layering/validation/provenance, reload with and without overlay, and the PATCH handler's 200/400/503 paths. |
||
|
|
f544dd0978 |
feat(config): SIGHUP-triggered reload with requires-restart warnings
The daemon can now re-read its configuration on SIGHUP (or on a future in-process trigger) and republish it through the Holder, closing the first half of issue #348: 'config can change at runtime, safely, and can't brick the daemon.' Reload path: - cmd/archied/reload.go: ReloadController re-runs loader.Resolve on the same paths main.go passed at startup (Resolve is pure -- no reload state added to the loader). apply is called only with a Document that passed validation; a failed reload records the error and its timestamp and leaves the running config untouched. That Set-not-called-on-error property is the safety core and is pinned by TestReloadValidationFailureDoesNotApply. - SIGHUP listener in main.go runs reloadLoop(ctx, ch, controller, log); the loop is extracted as a testable seam (syscall.SIGHUP is Unix-only, fine given the Linux target). PollInterval is genuinely reloadable now, not just re-read: the three ticker sites (Run, per-identity goroutine, shared maintenance loop) re-read the interval each tick and Reset the ticker on change. A reloaded poll_interval takes effect on the next cycle. Diff-and-warn so an operator never has to read the source to know whether an edit took effect: changedNonReloadableFields compares the old and new snapshots against an allowlist of re-read fields (PollInterval, Repos, DiffCapLines, Budgets, Dispatch, and the Containers sub-fields VolumeTTL + MaxConcurrency). Anything else that changed logs Warn 'requires a restart'; a fully-applied reload logs Info. The allowlist is deliberate: a field added to Config later defaults to requires-restart, the safe direction. NATS split-brain closed: containerEnv now hands containers the endpoint the daemon's own client connected with at startup (Daemon.ConnectedNATS, captured at construction) instead of the live config, so a reloaded nats.url cannot point new containers at a server the daemon is not publishing on. A nats change is therefore classified requires-restart, and CLAUDE.md's 'hands its own nats.url verbatim' note is updated to the meaning it now has (same today, deliberately different after a reload). Validation guard: poll_interval <= 0 is rejected in validate.go beside the VolumeTTL guard. applyDefaults fills zero with 60s, so this fires on an explicit negative -- which would panic time.NewTicker/Reset at boot and, after the per-iteration reset, on a SIGHUP mid-run. Observability: config.ReloadStatus (last_error, last_error_at, last_reload_at) is recorded by the controller and surfaced in /api/config via Server.LastReload, so a stale running config is visible in the dashboard, not just the logs. Rendering waits for the UI step. Recovery hatch: --no-config-overlay flag plus ARCHIE_SKIP_CONFIG_OVERLAY=1 (configuration.SkipOverlay), logged at startup. No overlay source exists yet; the flag is the documented escape hatch the DB overlay (step 3 of #348) will consult. webui.Server.ConfigProvenance becomes atomic.Pointer so a reload can swap it via SetProvenance independently of Cfg; the accepted skew (new config alongside old provenance) is documented on the field. Verified: task check clean; -race on daemon, webui, cmd/archied, config, infrastructure/configuration. |
||
|
|
b6f0aea930 |
refactor(daemon,webui): make Daemon.Cfg and webui.Server.Cfg reload-safe
Daemon.Cfg, webui.Server.Cfg, and telegramSetup.Cfg were all held by value (or as a raw shared pointer in webui's case), so a future reload path could not swap the running configuration -- the consumers held frozen snapshots made at construction. This is the prerequisite for issue #348. Add config.Holder, a small RWMutex-backed snapshot holder: - Get returns a value copy under RLock; the copy shares its reference-type fields with the published snapshot, so a doc comment pins the immutability invariant (a published Config is immutable; reload constructs a fresh one). - Set replaces the snapshot under WLock. - Get is nil-safe; Set is not. Convert every consumer to read through the accessor. The convention 'cfg := h.Get() once per logical operation' is documented on the type so the next reader knows that inline d.Cfg.Get().Foo is a code smell (a Set could land between two consecutive Gets). Special cases: - webui.Server.Cfg: was *config.Config, a raw shared pointer read from handler goroutines. Convert to *config.Holder. The pre-existing 'cfg := s.Cfg' aliasing bug at api_config.go:295 (which was *trying* to copy but only copied the pointer) now becomes 'cfg := s.Cfg.Get()', which is the value copy the read-only view always wanted. - daemon_test.go: one test mutated d.Cfg.DiffCapLines in place, which the Holder forbids. Replace with the documented read-modify-write pattern (prev := d.Cfg.Get(); prev.X = Y; d.Cfg.Set(prev)). - telegramSetup.Cfg: matches the daemon's API for consistency even though setup runs before the daemon is alive. TaskContext.Cfg in internal/domain/workflow/workflow.go is deliberately NOT converted -- a task that starts under one config should finish under it, and a config changing between TDD and gate stages is a bug, not a feature. Snapshotted at dispatch, as before. Verified: go test ./... (61 packages), go vet, -race on internal/daemon and internal/config. |
||
|
|
472d8d717c |
feat(config,channels): format-neutral config resolution and truthful channel state
Loader.Resolve() selects TOML/YAML files or a config directory as the production entry point, replacing the TOML-only Overlay() as the default path. Add internal/channels.Manager, reporting each adapter's actual runtime lifecycle (configured/starting/running/degraded/failed) instead of inferring health from configuration presence alone. Wire channel reload through a per-adapter seam. Fixes #55 |
||
|
|
4d44ef76f5 |
feat(webui): rebuild the dashboard
The old UI was a single 200-line Go file serving one hand-written HTML page of task rows. It showed that archied was running and almost nothing about what it was doing -- skills, workflows, memory, channels, logs and configuration were all invisible unless you read the source or the config file. The dashboard now covers each of those as its own section, built as a Vite app under ui/ at the repo root: it is a separate artefact from the Go daemon, not an internal package of it. dist/ is committed so building archied never needs a Node toolchain, and the !no_ui build tag keeps an embed-free build available. Both sides are split by concern rather than by layer -- one Go file per API area, one folder per UI section with its own CSS -- so a change to logs cannot disturb tasks. Pages report consequences, not just state: an empty memory page says Archie starts every conversation with no recollection of earlier ones, and the setup checklist names what is missing in plain language instead of showing a grid of zeroes. Nothing greets by a hardcoded name; the operator comes from [chat], which is deployment data. Auth is exposure control, not capability control -- the agent already holds this user's authority through its own tools. So a loopback bind needs no token, and only a reachable bind mints one and logs a URL, which means an instance cannot be exposed merely by omitting config. Container startup now degrades instead of aborting, for the reason resolveForge already does: a missing agent image should not deny the operator chat and the dashboard, and under Restart=on-failure it turns a recoverable problem into a crash loop with the real error scrolling past. `task dev` runs the daemon under air and the Vite server together in one terminal. |