0535b9ddd4424825133e5c1925d7a2da772c8d35
111
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0535b9ddd4
|
fix(channels): delete unreachable Telegram webhook delivery mode
telegram.New only ever constructed with empty webhookURL/webhookSecret (telegram_setup.go) and config.TelegramConfig has no field to set them, so the SetWebhook/StartWebhook branch, WebhookHandler, and webhook teardown in Stop were dead code exercised only by tests. Long-polling is the only reachable mode; delete the webhook path and its ConfigSchema properties so the schema no longer advertises unsupported config. |
||
|
|
ff01d7d335
|
test(archied): assert provider-disable warning by attribute, not message text
TestResolveProviderSecretsDegradesInsteadOfFailing matched a substring of the warning's prose. Assert the structured provider attribute instead so a rewording can't break the suite while a missing warning still fails it. |
||
|
|
2d3435e693
|
feat(archied): warn at boot when the config file has unrecognised keys
Surfaces configuration.Document.UnknownKeys as a warning naming the offending keys. Stays a warning, not a boot failure, per docs/architecture/configuration.md's startup policy: only an invalid config is fatal, and a stray key is far more likely an operator typo in an otherwise-working file. |
||
|
|
8de0df9ec3
|
test(archied): assert flush behaviour instead of grepping main.go
TestSubscribeAgentEventsFlushesBeforeReturning only checked that main.go's source text contained the string "flush task event subscription", so it passed whether or not subscribeAgentEvents actually flushed and failed if the message were merely reworded. Replace it with a real embedded-NATS test: subscribe, then publish on a separate connection with no delay, and assert the event arrives -- repeated to make the SUB/PUB ordering race observable. Mutation-verified: removing the flush call makes this fail reliably (multiple iterations lose the race) while the text-grep version would have kept passing. |
||
|
|
0e64573b04
|
refactor(install): install.sh delegates config generation, and tests stop reading hand-written configs
Two things fall out of one principle: a test that asserts against a hand-written file is testing an artifact a human or an agent may legitimately rewrite at any moment, so only generated output is a valid target. install.sh generated config.toml two ways -- a full heredoc for the self-host path and an awk splice of the [forge] block into config.example.toml -- with a forge_block shell helper feeding both. That is the arrangement docs/architecture/configuration.md decided against: it "must stop generating config.toml; archied setup owns it", because the installer hand-rolling TOML already drifted once (choosing Gitea produced a config naming a token the installer never wrote). Both generators and forge_block are gone; install.sh collects its answers as before and passes them to archied setup as parameters, with secrets passed as REFERENCES to the env keys it just wrote rather than as values, which would put them on a command line. The installer also now asks for a cloud model, which archied setup requires and the old path never emitted. deployment_contract_test.go tested the removed generators by parsing install.sh's shell text, reconstructing the heredoc and asserting on its content. It broke the instant install.sh stopped generating config -- "install.sh has no heredoc declaring the daemon config's [nats] table" -- which is the failure mode in miniature: the test was coupled to an artifact, not to behaviour. Deleted. What it actually protected is kept, asserted on the GENERATED config instead: TestRunSetup_GeneratedConfigSatisfiesDaemonRequirements runs archied setup and loads what it wrote, requiring services.state.target and bot_user. A test against generated output fails when generation breaks and passes when a human merely tidies the template. Found by an adversarial package sweep (temp tracker: config-1, repo-root-deployment-1, repo-root-deployment-2). |
||
|
|
a856e5ac80
|
fix(archied): disable a provider whose credential is missing instead of refusing to boot
configuration.md's startup policy -- "a missing credential disables a capability.
Only an invalid config stops the daemon" -- names this exact case: "Apply the same
reasoning to any future capability credential, LLM keys especially: start, report
the capability as unavailable, let the operator see it." The code did the
opposite. resolveProviderMap returned an error when a provider's api_key could not
be resolved, and again when it resolved empty, so configuredSecretRegistry failed
and the daemon would not start. A provider nobody referenced still blocked boot,
because the walk covers every entry in cfg.Providers rather than the ones [models]
uses.
The forge path was fixed to degrade for precisely this reason (resolveForge,
guarded by TestResolveForgeDegradesInsteadOfFailing); this is its provider
counterpart. A credential that cannot be resolved now disables that provider with
a warning naming it and why, and the daemon starts.
Disabling clears the reference rather than leaving it. webui's ProviderView
derives Configured from api_key or APIKeyEnv, so an unresolvable reference left in
place would advertise a provider nothing can use -- the "looks configured and is
not" shape this codebase keeps having to remove. Consumers already treat an empty
APIKeyEnv as no credential (agentexec/runtime skips such a provider, the daemon
exports nothing to the agent container), so clearing it is the whole disable.
The other half of the policy is kept: a reference naming only one of engine and
key is a config error, not a missing credential, and stays fatal.
applyForgeDefaults only ever builds a ref with both halves, so a half-named one can
only come from a hand-edited config.
This also defuses the trap
|
||
|
|
027dc9925b
|
feat(configuration): let setup reference a secret without carrying its value
A parameterised install could not configure a cloud provider without a terminal:
the only way a secret value entered was the prompt, so an unattended run was
limited to the keyless self-hosted provider. The missing piece is the reference
form.
A reference is not a secret. An engine name and a key name are not sensitive --
which is exactly why a reference may be a parameter while a value may not -- so
setup gains -forge-secret-ref, -provider-secret-ref and -telegram-secret-ref,
each taking engine:key, parsed by one new setup.ParseSecretRef. When a reference
is given the step writes it to TOML and asks nothing, and setup neither reads nor
stores the value, because the value is not its to hold. That is the difference
from the prompt path, where the operator supplies a value and setup writes it
into the env engine and references it there.
Engine names are identifiers, not paths: the shipped engines are registered as
age, sops and vault, so a reference like vault/openbao:KEY is refused rather than
written into a config that could never resolve it.
Two refusals guard the silent no-op. A reference naming a key for the keyless
self-hosted provider, or for a forge that is disabled, would sit in the config
looking configured while nothing read it -- the failure shape this flow exists to
remove -- so both are refused rather than written.
telegram keeps writing token_env for the prompt path, because that form names an
env var and the prompt path is the env engine; a supplied reference may name any
engine, which token_env cannot express, so the reference path writes the
preferred token = {engine, key} form. Noted as the one asymmetry.
Also folded stepCloudProvider's key handling into cloudKeyEdit and cloudModel.
That was a lint fix for nested blocks, but the split is the honest shape: the two
branches obtain a key edit by different means and then resolve a model the same
way.
Every new test was mutation-verified by reintroducing the absence: ignoring the
forge reference, making ParseSecretRef validate nothing, and dropping the keyless
-provider guard each fail the corresponding test.
|
||
|
|
24ba2ce609
|
fix(configuration): stop letting a secret value be set from the command line
archied setup took -forge-token, -provider-api-key and -telegram-token, each carrying a secret VALUE. That is wrong twice over: the value lands in shell history and in every process listing, and it is a second way to set a secret that no secret engine knows about. The codebase already holds the opposite invariant, and had before this landed: - configuration.md:423-425 states it directly -- "setup writes the reference to TOML and the value to the secret engine". - No CLI flag anywhere in the repository accepted a secret value; these three were the only ones. - install.sh already does it correctly: read_secret prompts without echoing so the value never reaches scrollback, and set_env_key writes it into the systemd EnvironmentFile, which is the env engine's backing store. So the SecretSink half was right -- writing the value to the env file IS writing it to the secret engine, for the env engine -- and the prompt path was right. Only the three value-carrying flags were wrong. Removed: Params.ForgeToken, Params.ProviderAPIKey, Params.TelegramToken and the flags that fed them, along with the parameter plumbing in step_forge, step_provider and step_chat. Those steps now always read the secret from the prompt surface. Params gains a comment recording why it deliberately has no secret-valued field, so the absence is a decision rather than an oversight. TelegramUserIDs stays: an allowlist of user IDs is access policy, not a credential. Two tests pinned the wrong behaviour and are replaced rather than deleted: - TestRunParams_ProviderAPIKeyNeverPrompts asserted a secret could arrive as a parameter. It becomes TestRunParams_SecretsComeOnlyFromThePrompter, which supplies every non-secret answer through Params and scripts only the secret reads, so it fails if a secret ever comes from anywhere else. - TestRunSetup_DefaultsWithForgeTokenWritesEnv exercised the removed flag. It becomes TestRunSetupRejectsSecretValueFlags, which asserts all three flags are rejected with exit 2 and that neither a config nor an env file is written -- verified by re-adding -forge-token and watching it fail. The unused rejectingPrompter went with them; its remaining replacement uses a scripted prompter instead. |
||
|
|
ee608d81fb
|
feat(configuration): add archied setup, the caller the first-run flow was built for
docs/architecture/configuration.md decides that "install.sh must stop generating
config.toml; archied setup owns it", and gives the reason: the installer
hand-rolling TOML already drifted from the schema once, and "the durable fix is
that the code writing the config is the code that reads it". setup.Run,
tomlwrite, configtemplate.Example and terminalprompt were all built for that and
had no production caller between them. This adds the caller.
setup.Run's own doc comment states the obligations, and they are the shape of
installValidatedConfig: render the edits, prove the result loads through a real
configuration.Loader, and only then install the file and commit the secrets. A
validation failure returns before either write, so a bad config leaves neither a
config nor a secret on disk. The rendered bytes are proven from a temp file, so
a load failure cannot have already installed anything. The config is written
0600 via same-directory temp and rename.
Parameterisation is typed, not matched against prompt text. A flag-to-prompt
mapping would have to match strings, which is the brittleness removed in
|
||
|
|
9a4f11cec9
|
test(archied): pin the wiring these fixes depend on and drop text coupling
Two fresh-context reviews of the preceding five fixes found that the tests were mostly sound but that three things were not: one harness was coupled to shell source text, one assertion was coupled to a tool count, and -- worse -- the two changes carrying the most weight were pinned by nothing at all. Composition order. review_pr worked only because Run builds the worktree manager before the gateways; no test observed it. Reverting the order left every test green while the daemon silently stopped offering review_pr, because the producer guard then returns nil instead of advertising a broken tool. Pin the order by source position, matching the existing TestSetupBackendsRegistersContainerCleanupAfterNATS, since no runtime seam can see it. methodBody now resolves package-level funcs as well as methods. Composition wiring. The daemon fix's whole point is that resolved routing bindings reach the worker, yet nothing verified that buildDaemon puts them on the daemon: with b.kindWorkflows replaced by nil, only the new test fails and both the daemon and worker packages stay green. That is the "tested in isolation, never verified wired" shape this work exists to remove, so pin the hop. The wire contract itself. taskrun.Request's json tags are the interface between two binaries, and a same-type round trip cannot see a tag rename. Assert the emitted keys literally; renaming one now fails with the key list. Brittleness. selfHostConfig no longer string-matches install.sh's heredoc opener or assumes the delimiter is EOF, and no longer hand-substitutes a copy of forge_block's output -- it discovers heredocs by shape and selects the one declaring [nats], a table the assertions never touch. Verified against four behaviour-preserving refactors that previously failed: renaming the delimiter, reordering the redirect, factoring the path into a variable, and <<-. The two [services.gateway] source greps are gone: defaults.go already supplies that target, so there was no behaviour to pin. review_pr is asserted present by name rather than by entry count, so a sibling review tool cannot turn it red. Also carry the published request's decode error instead of discarding it, so a payload-shape break reports as itself rather than as an empty routing binding. Every new test was verified non-vacuous by reintroducing the defect. |
||
|
|
1e5c742cca
|
fix(daemon): carry kind/label routing bindings to the process that routes
An operator's kind/label -> workflow overrides were decoded, validated and installed into the DAEMON's package-level state via workflow.SetKindWorkflows/SetLabelWorkflows -- but workflow.Route's only production caller is app/agentworker/task_execution.go, in the separate archie-agent process. The bindings never crossed the boundary, so every configured override was silently ignored and routing always fell back to the built-in defaults (bug -> tdd, feature -> feasibility, bootstrap -> bootstrap). Carry the resolved bindings on taskrun.Request, mirroring how MCPServers already crosses this boundary, and apply them in the worker before Route is called. Resolved values are carried rather than file paths, so the worker does not need the routing files to be readable in its sandbox. nil still means "use the built-in defaults", so this is backward compatible for any request built by an older daemon. routeTask is a named seam for that install-then-route step. It mutates package-level routing state, which is sound here because each archie-agent process is task-scoped and ephemeral; if the worker ever served more than one task that assumption would need revisiting. Tests are mutation-verified: removing either the two Set calls in routeTask or the two request fields in runViaAgent reproduces the exact assertion failures the lane observed red-first, so neither test is vacuous. Found by an adversarial package sweep (temp tracker: workflow-engine-1, .local/issue-tracker/). |
||
|
|
17689e4911
|
fix(archied): stop advertising review_pr when no reviewer can run
review_pr was registered on every channel and failed on every call with "worktree manager is not configured". Two independent causes, one contract: The daemon ran setupGateways before buildTreesAndIdentities, so setupGateways reached prReviewer() while b.trees was still nil and captured it; the memoised reviewer then held that nil for the process lifetime. Build the worktree manager before the gateways, which is the ordering the reviewer depends on. Ordering alone cannot fix the standalone Gateway, which calls prReviewer() and never builds trees at all. Have prReviewer() return nil when b.trees is nil, so a reviewer that can never run is not produced. That is what gateway.ReviewTools' existing nil-reviewer guard always intended -- "a tool that cannot run must not be advertised" -- but the guard never fired because the daemon never passed nil. TestPrReviewerIsMemoized asserted a trees-less boot yields a non-nil cached reviewer, encoding the broken precondition as expected behaviour, which is why a green suite hid this since review_pr shipped. It now gives the boot a real worktree manager so its actual subject -- one shared in-flight set across channels -- stays pinned, and two tests are added: one for the nil-trees invariant, and one that composes the real wiring (prReviewer -> ReviewTools) and asserts review_pr is registered only when the reviewer can run. Found by an adversarial package sweep (temp tracker: app-archied-5, .local/issue-tracker/). |
||
|
|
5c9f5fea20
|
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. |
||
|
|
8eacaf0c1a |
Merge pull request #828 from samcharles93/feat/cron-scheduling-config
feat(config): [scheduling] block, its translator, and the events-bus sink adapter |
||
|
|
3b60ec23ba |
Merge pull request #827 from samcharles93/fix/webui-config-projection-chat-setup
fix(webui): count every chat front-end in the published projection |
||
|
|
dd3ae02472 | fix(scheduling): respect configuration ownership | ||
|
|
55a4ac201b |
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:
|
||
|
|
0b7e3a86b3 |
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 c65f9fb'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. |
||
|
|
408b8c6bff |
test(archied): stop racing state-store startup against a wall clock
TestRunStateStoreAcceptsEnvironmentToken wrapped the whole of RunStateStore --
SQLite schema init and the serve loop -- in a 200ms context deadline, so
whether it passed depended on how fast the disk was. Measured before the fix:
6 failures in 12 consecutive runs. A gate that fails half the time teaches
people to ignore it, and the failure it reported ('store: init schema:
context deadline exceeded') named a time budget, not a defect.
Cancellation is the assertion, so the test now cancels and then asserts:
the call must not return before cancellation (that would mean startup refused
the config, the thing this test exists to catch) and must return within a
generous grace once cancelled. The graces bound 'did startup reject us', not
'machine speed'. Measured after: 12 passes in 12 runs.
Also applies the canonical gofumpt and 'go fix' output to
internal/infrastructure/staterpc/dial.go, cmd/archie-ui/main_test.go and
internal/releaseupdate/check_script_test.go. task check runs gofumpt -w over
the tree, so leaving these unformatted made the gate rewrite unrelated files
mid-run and report dirty state for changes it had made itself.
|
||
|
|
19062a702d |
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.
|
||
|
|
37fce6e0b8 |
feat(workflow): review calibration -- checked properties, style nits out of contract
Closes archie-core-h019.5. The shipped contract already made only a confirmed
error-level finding block, and kept zero-findings distinct from not-run; what
was missing was the other half of calibration, and that is what a reviewer that
cries wolf needs.
- ReviewReport gains Checked []ReviewCheck {Property, Evidence}: the properties
the reviewer verified clean. Evidence is required, for the same reason a
finding requires a failure scenario -- a check without evidence is an
assertion, not a verification.
- The reviewer records checks through a typed record_checked tool, mirroring
record_finding, so it cannot end its turn having silently skipped the
checklist.
- Style/formatting/naming nits are stated out of contract, in the ReviewFinding
type doc and the reviewer prompt: they are the padding that trains an
operator to skim.
- The PR-body findings section renders the cleared properties, so a
zero-finding review arrives backed by what was checked rather than reading
the same as a review that never looked.
Design: docs/prds/review-calibration.md.
|
||
|
|
da28ddb5e6 |
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. |
||
|
|
3699f51f9b |
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. |
||
|
|
7c1d323b30 |
fix(archied): share one PR reviewer across channels; harden forge and worktree
Addresses PR #783 review findings: - Memoize the operator-triggered PR reviewer on boot so the Web UI and Telegram share one in-flight set; a concurrent review of the same PR from two channels now deduplicates instead of running twice. - Guard Gitea GetPullRequest against a nil head/base (deleted branch returns null from Gitea), returning an error instead of panicking. - Create the worktree root in CheckoutPR before MkdirTemp so a first review on a fresh work_dir does not fail with os.ErrNotExist. |
||
|
|
64ce3925a1 |
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. |
||
|
|
27bc40332f |
refactor(archied): cut the dashboard over to the archie-ui process
PRD gate 7 (docs/prds/ui-service-boundary.md): the daemon's in-process webui.Run listener is deleted in the same change that wires the UI process, so no fallback or second HTTP authority remains. The daemon's webui.Server stays only as the configuration snapshot's renderer (archie-core-ymut): it keeps the config Holder, provenance, reload status and the override list, and drops the store surfaces, event broadcast, chat/task wiring that only fed the listener. The bus drain becomes persistence-only -- the store is the single fan-out point the UI process reads through its event pump. The dashboard's configuration write path (PATCH /api/config, per-row reset, per-repo field update) is deleted rather than left as dead policy: the writes are descoped for the UI process (archie-core-ymut) and no route reaches them. Editing is config.toml plus reload; the overlay store stays for reload wiring. |
||
|
|
b179ab92d0 |
feat(archieui): mount the capture intake receiver over the State Store
At the cutover (archie-core-8cda.5.4) the UI process is the only listener
serving POST /webhooks/capture/{source}: the receiver is a persistence shim
over the State Store contract, and the daemon's binding-dispatch loop keeps
consuming captures from the same store, so the HTTP front door moves without
moving the owner of work intake. Zero [capture] options fall back to
configuration.DefaultCapture; the arrival announcement persists through
InsertEvent so the event pump delivers it, where the daemon's bus drain
persisted it before.
|
||
|
|
89c74d7097 |
refactor(archied): move webhook capture intake to the process that owns work intake
The dashboard's POST /webhooks/capture/{source} handler becomes
internal/infrastructure/captureintake.Receiver, mounted by the daemon on
the same bypass mux through webui.Server.CaptureIntake; the dashboard
keeps only the GET /api/captures read and the mapping preview's scan
window. The UI process now mounts no intake route at all instead of one
that answers 503 (archie-core-8cda.5.4).
|
||
|
|
29b074ef77 |
refactor(archied): move the update relay to the process that owns updates
The dashboard's Run read the watchdog's phase-2 report off local disk and put it on the activity stream. That is a host-local file read in the process that is moving off the host: the watchdog restarts archied and leaves its verdict beside archied, so archied is what can read it. The daemon now polls and relays it, publishing the same event through the same bus, so it persists with every other event and reaches whichever dashboard is watching. The event builder moves to releaseupdate, which owns Report and its verification; the dashboard keeps only what it needs to tell an installer where to write. The startup poll stays: the watchdog writes its result only once the process answers /healthz, so a single read at boot can always miss the report describing that very boot. persistAndBroadcastEvents takes the daemon context and detaches it for the insert, which is what it always did with context.Background() -- the last events of a run are the ones an operator reads afterwards. |
||
|
|
54862f9fe6 |
feat(webui): report which dashboard sections a process can serve
The same dashboard is served by the daemon, which holds every runtime handle, and by the UI process, which holds two remote contracts. A section with nothing behind it still answers -- an empty list, a "disabled" marker, a 501 -- and the browser cannot tell that from a deployment where nothing has happened yet. GET /api/capabilities says which sections this process can back, and the nav drops the rest rather than offering a page that is permanently empty. It fails open in both directions: an unreported section stays visible, and a failed read hides nothing, because an entry that silently vanished is worse than a page that explains itself. Mappings and bindings move the other way. Both are ratified State Store contracts carried by the client the UI process already holds, so leaving them nil degraded two pages that have an owner; compose wires them. A table test now enumerates every route whose capability is daemon-local and pins what it answers without one (requirement 4 of archie-core-8cda.5.4): task logs, the log feed and its stream, version and the update flow, channels and reload, curators, memory, skills, workflows and work requests. Adding a route with no owner now fails that test rather than the operator's browser. |
||
|
|
6f34e34adb |
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. |
||
|
|
d32196f664 |
feat(staterpc): carry the dashboard's configuration snapshot
archie-core-ymut decided the configuration page reads a projection the daemon publishes rather than reaching into a shared config.Holder. This is the carrier: a single-row store surface plus PutConfigSnapshot/GetConfigSnapshot, taking the contract to 42 RPCs. The document is opaque here. Its shape belongs to the daemon that builds it and the page that renders it, so the store neither parses nor validates it, and schema names the projection so a reader can refuse one it does not understand. It is secret-free where it is built: the projection carries an API key's environment variable name and whether it resolved, never a value. Both RPCs are administrative. authorizesTaskScopedCall is deny-by-default, so a container's task-scoped grant can neither rewrite what an operator reads nor read a projection of the deployment it runs inside; a test pins both. Nothing publishes or reads it yet -- the daemon's publisher and the UI's read path land with the rest of the cutover. |
||
|
|
1ffdedc62e |
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. |
||
|
|
d0b5be1491 |
feat(webui): route dashboard task actions through the Gateway contract
The dashboard composed its own taskactions.Service over whatever handles happened to be set on webui.Server. In the extracted UI process those are all nil, and each nil silently removes a guarantee: no Cfg means max_retries stops being enforced, no Issues means a rejected task's forge issue stays open and the poller re-enqueues it, no Events means operator actions never reach the timeline, no TaskStopper means Stop cannot interrupt running work. The handler now asks whoever owns task execution, through ApplyOperatorTaskAction, and Issues/TaskStopper leave the dashboard entirely. That path crosses two hops that both flatten errors, so the sentinels the handler maps to 404/409/503 travel explicitly: a kind beside the message on the NATS envelope, a gRPC code on the Gateway contract, each restored on arrival. Without them a task that simply moved on reports as a broken daemon. The action tests keep running the real service, now behind a local contract the way the daemon serves it in production, so retry limits, forge closure, events, archiving and log removal stay covered where they were. |
||
|
|
47d78afae7 |
feat(gateway): give the dashboard operator its own task-action contract
archie-core-8cda.5.4 requires /api/tasks/{id}/action to go through
ChatContract rather than a task-action service the UI process composes
itself. The contract could not carry the request: ApplyTaskAction's identity
is a scope, and the daemon's action service distinguishes a named identity
from a nil one, which is the authenticated operator acting across
identities. Sending "" would not have expressed it either -- that is a real
identity in a single-identity deployment (chatTaskProfiles).
ApplyOperatorTaskAction is that case, additively: a separate RPC, so buf
sees no cardinality change on a shipped field, and no request that can carry
both an identity and operator authority. ChatTaskActor's identity becomes a
pointer end to end, from the Gateway's local adapter through the NATS hop to
taskactions.Service.Apply, which has always taken one.
The conformance test now covers both scopes through the local adapter and
the gRPC hop; the chat tool test pins that a chat action is never unscoped.
No caller passes nil yet -- the dashboard handler switches over with the
rest of the cutover.
|
||
|
|
41c99eda99 |
fix(update): probe the dashboard's real address after a self-update
The watchdog polled http://127.0.0.1:8420/healthz. Nothing binds 8420: the daemon serves /healthz on [web].listen (127.0.0.1:8484 by default), so every dashboard- or Telegram-initiated update waited out the 60s health timeout and rolled back a release that had come up fine. The daemon is the only process that knows which address it binds, so it now derives the probe URL from its own config and hands it to the installer; CommandInstaller exports ARCHIE_HEALTH_URL and the install script forwards it into the watchdog unit, whose remaining default matches the dashboard's. The suite never dialled the URL: every watchdog test faked curl as an immediate failure, so only the unhealthy branch existed. One test now runs the real curl against a real listener, and another pins the script default. |
||
|
|
66e77e7380 | style: apply gofumpt formatting | ||
|
|
d1e5731d04 |
fix(archieui): run the service-token env fallback without a config file
Cloud review of
|
||
|
|
536fa20254 |
feat(webui): deliver live dashboard events by polling the State Store cursor
archie-core-za9f. The UI process owns no event bus, so after the .5.4 cutover the activity feed would show history at page load and then go silent: live delivery is a Server.Broadcast call made only from the daemon's bus subscription. Decided against the push-subscription RPC the bead assumed, on three findings: * store.Open sets SetMaxOpenConns(1), so writes serialise and the event id is assigned in commit order. The gap-skipping failure that normally rules out polling an autoincrement cursor cannot happen here, and SSE catch-up already depends on the same property. * sseStream.drain treats a broadcast as a wakeup, not a payload: it fills the persisted gap via catchUp and delivers the event only if catch-up missed it, deduplicating on the since watermark. A poller substitutes for the bus with no change to sse.go and no new SSE semantics. * The events table is the only complete fan-out point. ArchiveTask writes an audit event inside its transaction and daemon.go inserts binding-dispatch failures directly, neither touching the bus. A push hub needs a hook at every write site and misses any added later. So: no proto change, no new auth surface, no backpressure policy. The pump primes past existing history (a client's own catch-up serves that), then ticks EventsSince into Broadcast. One pump serves every browser. A failed fetch leaves the watermark intact, so a State Store restart costs latency, not events. Wired into archieui.Run in the background so priming a large events table cannot delay the listener, with -event-poll-interval (default 1s). Decision recorded in migration-decisions.md; ui-service-boundary.md's /events route-owner row moves to RESOLVED, and /api/logs splits out of it as still unresolved and host-local. |
||
|
|
ac7b4492a2 |
fix(archieui): resolve service tokens from env and correct the stale State Store config comment
D1: the UI read [services.*].target_token verbatim, but the config loader does not expand environment variables. A deployment that presents the gateway and state tokens by env (as config.example.toml documents for remote consumers) would leave archie-ui with an empty token, and staterpc.Dial then refuses a non-loopback start. Mirror the daemon's stateStoreResolvedToken / gatewayResolvedToken: explicit key, then GATEWAY_TOKEN / STATE_STORE_TOKEN. D5: internal/config/services.go claimed the State Store service 'is not yet extracted into its own process' and that target_token 'remains dead configuration', both false since the daemon made an empty services.state.target a hard startup error. State current truth. D3: document that Web.Listen = 'off' is read with opposite meanings by the dsaemon (disables the dashboard) and the UI process (falls through to the default listener), pinning it as the one overloaded key an operator preparing the split would set. |
||
|
|
7c8f625f0e |
feat(gateway): flip channel boundary onto messaging.Message
Replaced gateway.Message as the currency at the channel-facing boundary with the canonical internal/domain/messaging.Message. Channel adapters now build the record directly (RoleUser, ConversationID, Sender) and the Router hands it back unchanged, so nothing converts between two shapes in process. gateway.Message is deleted; the dashboard route that had no home in the record lives in a new Inbound envelope (Message + transport-only Page), which reaches the system prompt and is never persisted. Role is now set at construction instead of derived at the store boundary, and the assistant reply is a direct messaging.Message (RoleAssistant, Sender=botUser). The gRPC proto is unchanged: pb.Message still carries no role, and both sides keep deriving it from the owning session's bot identity via gateway.RoleForSender (ToStoredMessage/FromStoredMessage are deleted). Adds tests that the old shape could not express: Page reaches the system prompt but not the persisted record, and a channel-built Inbound round-trips with the Role the channel set. Refs: archie-core-9g5e |
||
|
|
0ec4ececd5 |
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 |
||
|
|
3d611f18ab |
feat(archieui): standalone UI process over remote Gateway and State Store
Add cmd/archie-ui and internal/app/archieui: a second composition root that
serves the dashboard and the compiled SPA against the two contracts the daemon
already dials, so the UI stops needing the daemon's in-process objects.
The composition root lives outside internal/app/archied deliberately. That
package pulls 88 internal packages (daemon, forge, containers, NATS, secrets,
workflow); reusing its boot the way RunGateway and RunStateStore do would make
the PRD's deletion gate unreachable. archieui links 41, and cmd/archie-ui 42.
Configuration ownership follows docs/prds/ui-service-boundary.md: the process
reads the shared file, but only [services.gateway].{target,target_token},
[services.state].{target,target_token} and [web].{listen,
trust_forwarded_headers}, with flags taking precedence. Options has no field
for anything else in that file to land in, and no config.Holder.
compose() sets only the contract-backed and process-local fields. Every daemon
runtime handle stays nil on purpose and its route degrades through the
existing 501/503/empty paths. Captures, CaptureLimiter and BindingDispatcher
are withheld for the duration of the seam: the daemon's dashboard still serves
POST /webhooks/capture/{source}, and two intakes are not permitted.
Readiness is the UI's own registry over its two dependencies via a new bounded
readiness.ContractProbe. The existing GatewayProbe was unusable here: with no
channel manager to inject it reports "no gateway channels configured", i.e.
permanently degraded.
The State Store's fail-closed non-loopback rule and the two dial paths move to
staterpc.Dial/TargetIsLoopback and gatewayrpc.Dial, so the server side and
every client share one implementation instead of three copies.
The Gateway remains loopback-only with no auth interceptor, so this process is
scoped to being colocated with it; filed as archie-core-juqx.
Refs: archie-core-8cda.5.2
|
||
|
|
571323138d |
feat(messaging): migrate gateway session persistence onto domain types
SessionStore message history now stores/loads domain/messaging.Message: sender attribution, derived role, and conversation address are canonical record fields. SQLite gains a role column with open-time backfill for pre-migration databases. gateway.Message remains the channel-facing transport; conversion lives in one boundary module. ChatContract, gatewayrpc proto, and dashboard JSON are unchanged; the RPC client splits into ChatContract (Client) and SessionStore (StoreClient) views. Sessions stay SessionContext: UUID keys and platform/bot/title/branch metadata have no lossless home in Conversation; keyed migration tracked separately once Agent/user/binding ownership settles. Refs: archie-core-d9dv |
||
|
|
411f6fdf8c |
test(state-store): restart/recovery + single-owner-SQLite checks, document task-grant scoping (archie-core-8cda.4.7)
Works through .4.7's remaining acceptance items: - TestStateStoreDataSurvivesRestart: a task written by one archie-state-store process is still there for a fresh process opened against the same archie.db path. - TestOpenStoresNeverOwnsTaskDB: the daemon/gateway composition path never populates b.st -- that field is reserved for the standalone binary, so archie.db always has exactly one owner. - Audited internal/webui and friends for direct internal/store use: only the narrow contract interfaces (TaskStore, CaptureStore, ...) are imported, never a concrete *store.Store -- already satisfied, no code change needed. - Updated docs/prds/state-store-contract.md's token lifecycle and payload-limits sections to describe what's actually implemented now (RegisterTaskGrant/RevokeTaskGrant, per-RPC scoping, the streaming capture RPCs) instead of the pre-.4.3 in-process-listener language. - Ran the affected packages under -race; clean. Left open, for Sam to decide rather than assume: archie-state-store has no Dockerfile/CI build and isn't in RELEASING.md's two-component split (tools/release.sh only tracks cmd/archied and cmd/archie-agent). Given it's currently a native-binary/systemd deployment (deployments/*.toml), this may be intentional -- flagging rather than inventing release infra for a third binary unasked. |
||
|
|
8fef2e7eed |
fix(state-store): task-scope container credentials, stream large capture lists, validate Update, wire dev's state-store (archie-core-8cda.4.7)
Closes six review findings against .4.6 (PR #775): - daemon.StateStoreGrantIssuer + staterpc.TaskGrants: containers get a per-task credential authorized only for their own Update/Transition/ InsertEvent, never the daemon's administrative token. Issued before Acquire, revoked on Release; fails closed if no issuer is wired. - StreamCaptures/StreamUndispatchedCaptures: new streaming RPCs so a batch of large capture bodies can't exceed gRPC's 4MiB unary cap. The original unary RPCs are kept, unmodified (deprecated) rather than reshaped, so buf breaking stays green for an in-flight rolling deploy. - Update rejects a nil Task with InvalidArgument instead of panicking in the store layer. - RequireHostGateway only forces on for embedded NATS, so an externally reachable NATS/State Store no longer requires a local Docker bridge. - Client-side token resolution now matches the server's (target_token, then STATE_STORE_TOKEN secret/env). - task dev now runs archie-state-store (dev:state-store) alongside archied/archie-gateway/vite; deployments/dev.toml points them at it. |
||
|
|
33751abe4e |
test(staterpc): verify State Store end-to-end and preserve context error identity (#775)
* test(state-store): real-process smoke + deadline/sentinel error contract Add end-to-end verification for archie-core-8cda.4.7, the .4.7 State Store verification stage against docs/prds/state-store-contract.md (rev. 2c): - Real-process smoke coverage: build ./cmd/archie-state-store, run it against a minimal config on loopback, poll the readiness surface, and drive the State Store gRPC contract through staterpc.NewClient exactly as a consumer does. Covers the combined task/event/capture view, error-sentinel fidelity across the wire, the found=false-not-error convention, single-owner SQLite (the binary owns the one archie.db file; the consumer never opens a store file), per-call deadline behaviour, restart/recovery (SIGTERM + reopen on the same db), and the remote capture/mapping/binding surfaces. - Fix a real deadline-identity gap in unmapError: a cancelled or deadline-exceeded context surfaced by gRPC-Go as a *status.Error was re-wrapped into a sanitised internal-style error, breaking errors.Is(err, context.Canceled/DeadlineExceeded). The agent's deadlineStore bounds each Store call with context.WithTimeout and the workflow consumer (workflow.go) uses errors.Is(err, context.DeadlineExceeded) to mark a stage interrupted rather than failed, so the re-wrap would wrongly park an interrupted task. Unmap Canceled/DeadlineExceeded codes back to the standard context sentinels. - Pin the error-mapping contract in staterpc: context-identity preservation, sentinel round-trip fidelity for every store sentinel, and the sanitisation rule (an Internal error must not leak raw detail or map to a sentinel). * test(state-store): assert single-owner SQLite composition (daemon/gateway require target) The single-owner invariant (docs/prds/state-store-contract.md §12 step 7/8) is that only archie-state-store opens archie.db; the daemon and gateway resolve their task-store surface from openStateStoreAdapter, which requires [services.state].target and opens no local store. This test pins that composition root so a future change cannot silently reintroduce a local *store.Store in the daemon or gateway path (dual-store ownership). * test(state-store): skip real-process smoke tests under -short The smoke tests build and exec the real archie-state-store binary, which is slow enough that a -short run (e.g. a focused edit loop) should skip them. task check (go test ./... -count=1) does not use -short, so they still run in the full gate. * test(state-store): fix subprocess log race under -race The smoke test captured the subprocess's stdout/stderr in a strings.Builder that the os/exec writer goroutine and the test reader goroutine touched concurrently, racing under -race. Replace it with a mutex-guarded buffer, the standard pattern for reading a running subprocess's output. * test(state-store): satisfy lint (noctx, errorlint) on new tests - exec.Command -> exec.CommandContext, http.Get -> NewRequestWithContext + Client.Do, so the subprocess and readiness polling honour the test context (noctx). - errorlint: compare the raw non-status error via errors.Is rather than != on a wrapped error. * docs(deployments): document State Store readiness verification and single-owner invariant The deployment runbook described how to launch archie-state-store but not how to verify it is healthy before starting archied. Document the -ready-addr readiness surface (/healthz, /health/detailed state_db component) and the single-owner invariant: one task SQLite file owned by archie-state-store, with archied/archie-gateway never opening archie.db directly (state-store-contract §12 step 7/8). * fix(state-store): preserve context deadline/cancel identity in mapError The symmetric server-side gap to the unmapError fix: if a store query fails because the caller's context expires mid-call (§6 StoreTimeout), the handler's mapError folded context.Canceled/DeadlineExceeded into codes.Internal. The client would receive a sanitised internal error with no deadline identity, so the agent's workflow consumer (errors.Is(err, context.DeadlineExceeded)) could not distinguish an interrupted stage from a failed one. Map a context cancel/deadline error to its matching gRPC code so unmapError rehydrates it back to the standard context sentinel, completing the §6/§7 round-trip. Pin both directions with TestMapErrorPreservesContextIdentity. |
||
|
|
3a0dfa924d |
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) |
||
|
|
48033ccbf8 |
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. |
||
|
|
c644a70d5b |
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. |