From 3b2e7949ed2096a9e2c02b004a9296ce0253c67f Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 30 Jul 2026 02:24:10 +1000 Subject: [PATCH] fix: restore /model parsing and close the 6108fc5 autofix audit The nestif extraction in 712388d pulled --provider handling out of parseModelRest into a helper that took modelParts by pointer and appended every surviving field to it. The caller's own loop appended the same fields again, so every model name was doubled: /model gpt-5.6 asked the router for "gpt-5.6 gpt-5.6" and SetActiveModel rejected it as unknown. The index loop becoming a range loop also stopped the space-separated "--provider openai" value being consumed with its flag, so it landed in the name too. Direct model switching over Telegram was broken for everything but --refresh and provider-only switches. splitProviderFlag is now the sole accumulator and returns the surviving fields, so the shared-slice shape that allowed the double append cannot recur (archie-core-0d6). Found while auditing the remaining hunks of 6108fc5 (archie-core-ifi): the naked return in the same function could not be regression-tested until the function produced correct values. That audit is complete and the other seven hunks are behaviour-neutral. Notably shell.go's errorlint rewrite is not a repeat of the grep failure - it had no companion exit-code condition to drop, and the ctx.Err() timeout check already runs first - and find.go's errors.Is rewrite is safe because errors.Is(err, nil) is false for any non-nil err. Tests cover the return order of parseModelRest (two strings and three bools, so a transposed pair compiles silently), the field count of the model name, and shell's exit-code branch, which had no coverage at all. The find fallback's habit of reporting a cancelled walk as "no matches found" is filed as archie-core-ts9. --- .beads/interactions.jsonl | 3 ++ .beads/issues.jsonl | 14 ++++-- internal/channels/telegram/model.go | 30 +++++++----- internal/channels/telegram/model_test.go | 59 +++++++++++++++++++++++ internal/tools/builtin/shell_exit_test.go | 33 +++++++++++++ 5 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 internal/tools/builtin/shell_exit_test.go diff --git a/.beads/interactions.jsonl b/.beads/interactions.jsonl index 985f45d45..3c4db4cdd 100644 --- a/.beads/interactions.jsonl +++ b/.beads/interactions.jsonl @@ -221,3 +221,6 @@ {"id":"int-121dfb79c17bb556e48b19bbfe6c1b0d","kind":"field_change","created_at":"2026-07-29T00:15:26.026966964Z","actor":"Sam Catlow","issue_id":"archie-core-qa4.4","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}} {"id":"int-56175e7ff25f356ec9f6f1b44d96597d","kind":"field_change","created_at":"2026-07-29T01:11:44.064703641Z","actor":"Sam Catlow","issue_id":"archie-core-uxk","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Closed"}} {"id":"int-07f5fbc5b999b3c33395e21ef0c068dc","kind":"field_change","created_at":"2026-07-29T01:11:44.270013581Z","actor":"Sam Catlow","issue_id":"archie-core-dkf","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Closed"}} +{"id":"int-9eb7bbde4ce8579fa6ff44b2b7c8837b","kind":"field_change","created_at":"2026-07-29T16:14:12.750427109Z","actor":"Sam Catlow","issue_id":"archie-core-rs9","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"text-based line patcher implemented in internal/infrastructure/configuration/tomlwrite; template embedded via configtemplate.go; tests pass, task check clean"}} +{"id":"int-4b7430d2b3e135f65dd02e869735ddcb","kind":"field_change","created_at":"2026-07-29T16:19:14.81881455Z","actor":"Sam Catlow","issue_id":"archie-core-ifi","extra":{"field":"status","new_value":"closed","old_value":"open"}} +{"id":"int-d72f7fa25fe6964e77322aefb6e51b92","kind":"field_change","created_at":"2026-07-29T16:19:22.842905807Z","actor":"Sam Catlow","issue_id":"archie-core-0d6","extra":{"field":"status","new_value":"closed","old_value":"open"}} diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 35c266c1d..9c7685399 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -53,13 +53,15 @@ {"_type":"issue","id":"archie-core-abg.18","title":"[EPIC] Memory: pluggable provider architecture with file-backed persistence","description":"Pluggable memory system to match Hermes parity:\\n\\n1. **MemoryProvider interface**: Abstract interface with methods for initialize(), get_tool_schemas(), prefetch(), sync_turn(), and optional lifecycle hooks (on_session_end, on_session_switch, on_pre_compress, on_memory_write).\\n\\n2. **Built-in file-backed memory**: MEMORY.md and USER.md stored per-session/profile. LLM-callable memory tool with add/replace/remove actions. Frozen snapshot at session start (preserves prefix cache), immediate disk write on updates. Section-sign delimited entries with substring matching.\\n\\n3. **MemoryManager**: Orchestrates built-in + at most one external provider. Background serialized write executor. Prefetch with timeout (8s). Streaming context scrubber that strips injected memory spans from model output.\\n\\nRef: docs/prds/hermes-gap-analysis.md section 4","acceptance_criteria":"An external memory provider (e.g. Honcho, Mem0) can be plugged in via config. The built-in memory tool persists across sessions. Conversation context is recalled on session resume.","status":"closed","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-25T14:02:22Z","created_by":"Sam Catlow","updated_at":"2026-07-28T17:04:41Z","closed_at":"2026-07-28T17:04:41Z","close_reason":"Superseded by merged work: all 32 children complete (32/32, bd flags it 'eligible for close'). MemoryProvider interface, built-in file-backed memory, MemoryManager, scrubber, drain and threat scanning all landed in internal/memory. Nothing left in scope.","dependencies":[{"issue_id":"archie-core-abg.18","depends_on_id":"archie-core-abg","type":"parent-child","created_at":"2026-07-26T00:02:22Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-abg.16","title":"[EPIC] Gateway: rich message model, adapter lifecycle, session management","description":"Foundational gateway infrastructure to match Hermes parity. Three interdependent pieces:\\n\\n1. **Message model**: Replace the 3-field Message struct with a rich MessageEvent (MessageType enum: text/photo/video/audio/voice/document/sticker/command, media_urls, reply_to context, metadata dict, source). This is the wire type every adapter produces.\\n\\n2. **Adapter lifecycle**: Replace the 3-method Gateway interface with a BasePlatformAdapter interface: connect()/disconnect()/send() as required methods, plus optional overrides for typing indicators, edit/delete, image/voice/video/document send, interactive UX (clarify buttons, approval dialogs). Capability flags (supports_code_blocks, splits_long_messages, supports_async_delivery).\\n\\n3. **Session management**: SessionSource struct (platform, chat_id, chat_type, user_id, thread_id, guild_id, profile), AsyncSessionStore for persistent session storage, SessionContext for system prompt injection.\\n\\nAll three blocks together enable adding new platforms as plugins without touching core gateway code.\\n\\nRef: docs/prds/hermes-gap-analysis.md sections 1-2","acceptance_criteria":"New adapters can be added by implementing a Go interface with connect/disconnect/send + optional media methods. Messages carry full metadata through the pipeline. Sessions persist across gateway restarts.","status":"open","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-25T14:02:21Z","created_by":"Sam Catlow","updated_at":"2026-07-25T14:02:21Z","dependencies":[{"issue_id":"archie-core-abg.16","depends_on_id":"archie-core-abg","type":"parent-child","created_at":"2026-07-26T00:02:21Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-jfg","title":"Spawned archie-agent containers not on daemon's docker network — can't reach NATS","description":"Root cause of 'agent still failing on the server': archied's container.Pool.Acquire creates archie-agent containers via the Docker SDK with no NetworkMode set, so Docker attaches them to the default bridge network. archied and nats run on the compose-created 'archie-core_default' network instead, so the spawned container's hostname resolution for 'nats' (from NATS_URL=nats://nats:4222) fails and archie-agent can't connect. Confirmed on carina host logs: archied logs show repeating 'taskrun request failed err=\"nats: no responders available for request\"' for every task, containers created and destroyed within ~1.5s (consistent with archie-agent's NATS client failing fast). Fixed by detecting the daemon's own container's network in NewPool (selfNetwork, via ContainerInspect on os.Hostname()) and setting HostConfig.NetworkMode on spawned containers to match.","status":"closed","priority":0,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-24T03:10:26Z","created_by":"Sam Catlow","updated_at":"2026-07-25T13:04:34Z","closed_at":"2026-07-25T13:04:34Z","close_reason":"Fix already implemented and verified: selfNetwork() in internal/container/pool.go detects the daemon's own container network via ContainerInspect(os.Hostname()) and Acquire() sets HostConfig.NetworkMode to match, so spawned archie-agent containers join the same compose network as nats. Build and internal/container tests pass.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-0d6","title":"[BUG] /model \u003cname\u003e asked the router for a doubled model name","description":"The nestif extraction in 651de0a pulled --provider parsing out of parseModelRest into extractProviderFlag, which took the modelParts slice by pointer and appended every non-provider field to it. The caller's own loop then appended the same fields again, so every field of the model name was duplicated: '/model gpt-5.6' resolved to 'gpt-5.6 gpt-5.6' and SetActiveModel rejected it as an unknown model. '/model gpt-5.6 --provider openai' was worse -- the space-separated provider value was no longer consumed with its flag, giving 'gpt-5.6 gpt-5.6 openai'. Direct model switching over Telegram was broken for anything but a bare --refresh or a provider-only switch. Found while auditing 6d4e0be for archie-core-ifi: the naked return in the same function could not be regression-tested until the function produced correct values.","acceptance_criteria":"parseModelRest returns the model name exactly once for bare names, scope flags, and both --provider spellings, with a regression test asserting field count rather than string equality.","notes":"Fixed by making splitProviderFlag the sole accumulator of surviving fields and returning them, so the shared-slice shape that allowed the double append is structurally impossible. Tests: TestParseModelRestDoesNotDoubleTheModelName, TestParseModelRestReturnsDeclaredValuesInOrder.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T16:18:46Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:19:23Z","closed_at":"2026-07-29T16:19:23Z","dependencies":[{"issue_id":"archie-core-0d6","depends_on_id":"archie-core-ifi","type":"discovered-from","created_at":"2026-07-30T02:18:46Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-ewk.1","title":"Export configuration.Validate for archied setup to call","description":"The ewk epic's acceptance criteria (and archie-core-cbk's, by inheritance) require: \"Every config it writes passes configuration.Validate, verified by a test that runs setup non-interactively and validates the output.\" That identifier does not exist. internal/infrastructure/configuration/validate.go defines only an unexported validate(cfg *config.Config) error, called from one place: loader.go:178 inside Loader.Load's own decode-then-validate sequence. There is no way for code outside the configuration package -- e.g. `archied setup` after it builds a config.Config in memory but before writing it to disk -- to run the same validation.\n\nDiscovered while implementing archie-core-rs9 (TOML write strategy). Not fixed there: rs9's scope was the text-patching mechanism, not wiring setup's actual validation step, and exporting validate() is really part of cbk's job (the thing that needs to call it).","acceptance_criteria":"configuration package exposes a callable that runs the same checks as the current unexported validate() against a config.Config value in memory (either export validate itself, or add a thin Validate(cfg *config.Config) error wrapper -- whichever fits the package's existing exported-surface conventions). Loader.Load continues to use it internally with no behavior change. A test outside the package (e.g. in cbk's setup tests) can call it directly without going through file I/O.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T16:18:36Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:18:36Z","dependencies":[{"issue_id":"archie-core-ewk.1","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:18:36Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-1y6","title":"SOUL cannot override the prompt invariants","description":"Enforce the boundary that makes SOUL safe to hand to users: it supplies identity and style, and cannot reach the instruction hierarchy, core rules, tool inventory or env block.","acceptance_criteria":"A test renders a hostile SOUL that attempts to countermand core_rules and asserts the invariant sections are still present and intact. The boundary is documented where the layering rule already lives so the next person editing the template does not quietly relax it.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:56Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:56Z","dependencies":[{"issue_id":"archie-core-1y6","depends_on_id":"archie-core-4gv","type":"parent-child","created_at":"2026-07-30T02:09:56Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-z8c","title":"SOUL loader with per-turn reload and default fallback","description":"Load the SOUL file from the config dir into the identity slot of the rendered prompt, re-reading it per turn so an edit takes effect on the next message with no restart.","acceptance_criteria":"SOUL content is rendered into the identity slot ahead of the invariant sections. An absent, empty or unreadable SOUL falls back to the shipped default identity rather than rendering nothing. Editing the file changes the next turn's prompt with no restart. A read error is logged once and degrades to the default; it never fails the turn. Size is bounded so an oversized SOUL cannot crowd out the rules.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:56Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:56Z","dependencies":[{"issue_id":"archie-core-z8c","depends_on_id":"archie-core-4gv","type":"parent-child","created_at":"2026-07-30T02:09:55Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-4gv","title":"[EPIC] SOUL file: user-authored agent identity","description":"Move Archie's identity and tone out of compiled Go constants and into a user-editable SOUL file. Root cause of a real defect on 2026-07-29: heyarchie answered 'Hey are you there?' with 'I'm here. What do you need?', which reads as demanding the user justify getting in touch. The fix required editing DefaultPersonas() in internal/gateway/persona.go and rebuilding -- personality is not tunable without a compile. Modelled on Hermes (SOUL.md occupies the identity slot in the stable tier, DEFAULT_AGENT_IDENTITY is the fallback when absent, re-read per message so no restart is needed) and openclaw, which injects SOUL.md alongside AGENTS.md.","design":"THE BOUNDARY IS THE POINT. The existing layering rule (recorded in the chat-system-prompt-design memory) is that PersonaRegistry is the style layer only and rules live in the template, so switching persona cannot strip the agent's rules or tool inventory. SOUL inherits exactly that constraint: it owns identity, name, register and warmth, and must not be able to touch core_rules -- otherwise 'be terse' in a SOUL silently disarms the no-fabrication rules. Steal from Hermes: is_legacy_template_soul upgrades untouched scaffolding in place but never overwrites a SOUL the user actually edited. This is the first of the three identity layers agreed with Sam on 2026-07-30: invariants (template, nobody edits at runtime) / SOUL (user-authored) / representation (curator-derived, proposes only).","acceptance_criteria":"A user can name their agent and define its personality by editing a file, with no rebuild and no restart. An absent or empty SOUL falls back to the shipped default identity. SOUL cannot weaken the invariants: \u003cinstruction_precedence\u003e, \u003ccore_rules\u003e, the \u003ctools\u003e block and \u003cenv\u003e stay in the template and remain unreachable from SOUL, enforced by a test. A SOUL the user has customised is never overwritten by an upgrade.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:37Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:37Z","dependencies":[{"issue_id":"archie-core-4gv","depends_on_id":"archie-core-ewk","type":"related","created_at":"2026-07-30T02:09:58Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-ifi","title":"Audit the remaining golangci-lint autofix changes in 6d4e0be","description":"Commit 6d4e0be applied a golangci-lint --fix batch across 8 files. One of the eight was a behaviour regression: the errorlint fix in internal/tools/builtin/grep.go rewrote 'if exitErr, ok := err.(*exec.ExitError); ok \u0026\u0026 exitErr.ExitCode() == 1' into 'errors.As(err, \u0026exitErr)' and dropped the exit-code check, so any ripgrep failure (bad pattern, unreadable path) was reported to the model as 'no matches found' -- the agent would state a file contains nothing on the strength of a search that never ran. Fixed in 782510d. The other seven changes were eyeballed as benign (naked return expanded, err != ctx.Err() -\u003e errors.Is) but were never verified individually. A one-in-eight regression rate does not justify trusting the remainder on inspection alone.","acceptance_criteria":"Each remaining changed hunk in 6d4e0be is reviewed against its pre-fix behaviour, specifically for predicates that were narrowed or widened. internal/channels/telegram/model.go, internal/infrastructure/configuration/discovery.go, internal/tools/builtin/find.go, internal/tools/builtin/shell.go and the touched test files are covered. Any behaviour change found gets a regression test in the style of TestGrepReportsSearchFailureRatherThanNoMatches.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:21Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:21Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-cbk","title":"Setup steps: operator, provider, models, forge, chat channel","description":"The archie equivalent of tau's provider+model flow. Steps: (1) operator display name -\u003e [chat].operator; (2) LLM provider -\u003e [providers.\u003cname\u003e] class and api_key_env, with the key value stored via the secret engine; (3) models per role -\u003e [models] triage/planner/builder, plus the optional [chat].models catalog; (4) forge -\u003e github/gitea/none with host and a token reference, explicitly optional now that a missing forge credential only disables the forge; (5) chat channel -\u003e Telegram bot token, optional. bot_user must always be written because validation requires it when no [[identities]] exist.","acceptance_criteria":"Each step is skippable where the underlying setting is optional, and skipping leaves a valid config. Forge selection defaults to none rather than assuming a forge. The token key written into config matches the key the value was stored under, for every forge type -- the exact drift that broke the installer. Local model discovery (Ollama) is offered when available and degrades to free text when not.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:50Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:02:50Z","dependencies":[{"issue_id":"archie-core-cbk","depends_on_id":"archie-core-rs9","type":"blocks","created_at":"2026-07-30T02:02:55Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-cbk","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:02:50Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-ifi","title":"Audit the remaining golangci-lint autofix changes in 6d4e0be","description":"Commit 6d4e0be applied a golangci-lint --fix batch across 8 files. One of the eight was a behaviour regression: the errorlint fix in internal/tools/builtin/grep.go rewrote 'if exitErr, ok := err.(*exec.ExitError); ok \u0026\u0026 exitErr.ExitCode() == 1' into 'errors.As(err, \u0026exitErr)' and dropped the exit-code check, so any ripgrep failure (bad pattern, unreadable path) was reported to the model as 'no matches found' -- the agent would state a file contains nothing on the strength of a search that never ran. Fixed in 782510d. The other seven changes were eyeballed as benign (naked return expanded, err != ctx.Err() -\u003e errors.Is) but were never verified individually. A one-in-eight regression rate does not justify trusting the remainder on inspection alone.","acceptance_criteria":"Each remaining changed hunk in 6d4e0be is reviewed against its pre-fix behaviour, specifically for predicates that were narrowed or widened. internal/channels/telegram/model.go, internal/infrastructure/configuration/discovery.go, internal/tools/builtin/find.go, internal/tools/builtin/shell.go and the touched test files are covered. Any behaviour change found gets a regression test in the style of TestGrepReportsSearchFailureRatherThanNoMatches.","notes":"AUDIT COMPLETE. Per-hunk verdicts against pre-fix behaviour:\n\n- telegram/model.go (nakedret expansion): return order matches the declaration, and no defer mutates the results, so the expansion is behaviour-neutral. Two strings and three bools mean a transposed pair would have compiled silently, so it is now pinned by TestParseModelRestReturnsDeclaredValuesInOrder. Writing that test surfaced an unrelated P1 regression from 651de0a -- archie-core-0d6, fixed here.\n- configuration/discovery.go ((path string, yaml bool, ok bool) -\u003e (path string, yaml, ok bool)): type-identical signature reshuffle, no semantic content.\n- tools/builtin/find.go (err != ctx.Err() -\u003e !errors.Is(err, ctx.Err())): behaviour-neutral. Verified on go1.26 that errors.Is(err, nil) is false for non-nil err, so with a live context the new predicate still means err != nil. With a cancelled context the walk returns ctx.Err() unwrapped, so identity and errors.Is agree. The audit did expose that this branch is unreachable in practice and cancellation is reported as 'no matches found' -- pre-existing, filed as archie-core-ts9.\n- tools/builtin/shell.go (err.(*exec.ExitError) -\u003e errors.As): NOT the grep failure. The original had no companion condition to drop -- the exit code is read inside the branch, not used to gate it -- and the ctx.Err() timeout check already runs first. Widening to wrapped ExitErrors is unreachable since cmd.Run returns them unwrapped. The branch had no test at all, so TestShellReportsExitCodeRatherThanAGenericError now covers it.\n- loader_test.go, pluginextract/*.go, secretextract/*.go: blank-line insertions only.\n- read_test.go ((cwd string, params string) -\u003e (cwd, params string)): type-identical.\n- webui_test.go (\"GET\" -\u003e http.MethodGet): same constant value.\n\nOne-in-eight held: the batch itself had exactly the one regression already fixed in 782510d. The lint-driven refactor in 651de0a, however, carried a second regression of the same family, which suggests the review discipline belongs on structural extractions as much as on --fix batches.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:21Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:19:15Z","closed_at":"2026-07-29T16:19:15Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-cbk","title":"Setup steps: operator, provider, models, forge, chat channel","description":"The archie equivalent of tau's provider+model flow. Steps: (1) operator display name -\u003e [chat].operator; (2) LLM provider -\u003e [providers.\u003cname\u003e] class and api_key_env, with the key value stored via the secret engine; (3) models per role -\u003e [models] triage/planner/builder, plus the optional [chat].models catalog; (4) forge -\u003e github/gitea/none with host and a token reference, explicitly optional now that a missing forge credential only disables the forge; (5) chat channel -\u003e Telegram bot token, optional. bot_user must always be written because validation requires it when no [[identities]] exist.","acceptance_criteria":"Each step is skippable where the underlying setting is optional, and skipping leaves a valid config. Forge selection defaults to none rather than assuming a forge. The token key written into config matches the key the value was stored under, for every forge type -- the exact drift that broke the installer. Local model discovery (Ollama) is offered when available and degrades to free text when not.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:50Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:02:50Z","dependencies":[{"issue_id":"archie-core-cbk","depends_on_id":"archie-core-ewk.1","type":"blocks","created_at":"2026-07-30T02:18:40Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-cbk","depends_on_id":"archie-core-rs9","type":"blocks","created_at":"2026-07-30T02:02:55Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-cbk","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:02:50Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":2,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-via","title":"SetupPrompter interface and UI-agnostic setup flow","description":"Port tau's split: setup logic lives in a package that takes a SetupPrompter interface; the command layer supplies the terminal implementation. This is what makes setup testable without a TTY.","acceptance_criteria":"Setup logic has no direct terminal dependency and is driven end to end in tests by a fake prompter. The terminal implementation provides a numbered Select and a non-echoing ReadSecret via golang.org/x/term, both cancellable on Ctrl+C via context. No TUI framework is introduced.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:50Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:02:50Z","dependencies":[{"issue_id":"archie-core-via","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:02:49Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-rs9","title":"Decide and implement the TOML write strategy","description":"Settle how setup persists config before any prompting code is written; everything else depends on it. BurntSushi/toml loses comments on re-marshal, and config.example.toml carries substantial inline documentation users are meant to read and edit by hand. Options: (a) generate a fresh commented config from a template on first run and only line-patch specific keys on re-run; (b) full re-marshal and accept losing comments; (c) adopt a comment-preserving TOML editor.","acceptance_criteria":"The chosen strategy is documented with its trade-off. A first run produces a config a human can read and hand-edit afterwards. A second run changing one value leaves every other line, including comments, byte-identical -- asserted by a test. No strategy is adopted that silently discards user edits.","status":"in_progress","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:49Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:23Z","started_at":"2026-07-29T16:09:23Z","dependencies":[{"issue_id":"archie-core-rs9","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:02:49Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} +{"_type":"issue","id":"archie-core-rs9","title":"Decide and implement the TOML write strategy","description":"Settle how setup persists config before any prompting code is written; everything else depends on it. BurntSushi/toml loses comments on re-marshal, and config.example.toml carries substantial inline documentation users are meant to read and edit by hand. Options: (a) generate a fresh commented config from a template on first run and only line-patch specific keys on re-run; (b) full re-marshal and accept losing comments; (c) adopt a comment-preserving TOML editor.","design":"Decision: text-based line patching, not decode/re-marshal, not a comment-preserving TOML AST library (none exist for Go that are safe to depend on).\n\nNew package internal/infrastructure/configuration/tomlwrite:\n- Apply(src []byte, edits []Edit) ([]byte, error): for each {Table, Key, Value} edit, finds an active \"key = value\" line in that table and replaces just the value (preserving indent + trailing inline comment); else finds a commented \"# key = value\" line in that table, uncomments the table header and the line; else appends the key at the end of the table's content (or appends a brand new [table] section at EOF if the table doesn't exist at all, active or commented). Lines not named by an edit are copied through byte-for-byte.\n- Generate(template, edits) is Apply against configtemplate.Example (config.example.toml embedded at the module root via configtemplate.go, since go:embed can't reach outside its own directory tree -- this keeps config.example.toml the single source of truth instead of a second copy, which is exactly the drift bug this epic exists to fix).\n- Value callers pre-render TOML literals; String() and Ref(engine,key) helpers cover the two shapes setup needs (quoted strings, secret.SecretRef inline tables). Deliberately does not import internal/secret -- it edits text, not Go values.\n\nTrade-off: only understands single-line scalar/inline-table values. Does not handle multi-line arrays or [[array-of-tables]] (e.g. [[repos]]) -- those aren't setup's targets and must not be routed through this patcher.\n\nTests (internal/infrastructure/configuration/tomlwrite/tomlwrite_test.go) cover: active-key replace preserving trailing comment, active inline-table replace, commented-table uncomment-one-key-leave-siblings-commented, append into existing active table, append brand-new table, byte-identical-elsewhere on a single edit, byte-identical-elsewhere across two sequential runs (the rs9 acceptance criterion), and a full run against the real config.example.toml verified to decode via BurntSushi/toml and round-trip bot_user/forge.token correctly.\n\n`go build ./...` and `task check` pass clean; no other files touched.","acceptance_criteria":"The chosen strategy is documented with its trade-off. A first run produces a config a human can read and hand-edit afterwards. A second run changing one value leaves every other line, including comments, byte-identical -- asserted by a test. No strategy is adopted that silently discards user edits.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:49Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:14:13Z","started_at":"2026-07-29T16:09:23Z","closed_at":"2026-07-29T16:14:13Z","close_reason":"text-based line patcher implemented in internal/infrastructure/configuration/tomlwrite; template embedded via configtemplate.go; tests pass, task check clean","dependencies":[{"issue_id":"archie-core-rs9","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:02:49Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-ewk","title":"[EPIC] archied setup: interactive first-run configuration","description":"Move config generation out of install.sh and into the daemon as 'archied setup', so the thing that writes config.toml is the same code that reads it. install.sh currently hand-rolls TOML and has already drifted from the schema once: it hardcoded the GitHub token key and the Gitea host, so a Gitea install produced a config naming a token the installer never wrote. Modelled on tau's 'tau setup' (internal/cli/setup.go, internal/app/setup.go), adapted for archie's TOML config and existing secret-reference indirection.","design":"Port from tau: the CLI/app split behind a SetupPrompter interface so business logic is UI-agnostic and testable without a terminal; plain-stdio Select and hidden ReadSecret (golang.org/x/term) racing ctx.Done for Ctrl+C -- no TUI dependency; atomic temp+rename writes. DIVERGENCE FROM TAU: tau surgically patches YAML nodes to preserve comments. archie uses BurntSushi/toml, which does not preserve comments across a decode/encode round trip, so a full re-marshal would destroy config.example.toml's documentation. Decide this explicitly -- see the child issue. Secrets differ too: archie already has secret.SecretRef{engine,key} indirection, so setup writes the reference into TOML and the value into the env engine's store; that is archie's equivalent of tau's config.yaml/auth.yaml split and should be used rather than reinvented.","acceptance_criteria":"install.sh no longer generates config.toml; it invokes archied setup. Setup is idempotent and re-runnable against an existing config without clobbering unrelated settings. Every config it writes passes configuration.Validate, verified by a test that runs setup non-interactively and validates the output. Secrets never reach config.toml or argv: config holds a secret reference, the value goes to the env file at 0600 via atomic write. Prompts for secrets do not echo. A non-TTY invocation without sufficient input fails with a clear message rather than writing a partial config.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-29T16:02:28Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:02:28Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-035","title":"Trigger accounting: curator output must not feed its own trigger","description":"Establish the invariant that work a curator produces does not count toward the condition that schedules the next curator run. Honcho hit this directly: their dream scheduler explicitly excludes dreamer output from the observation threshold, noting that counting it would inflate the threshold and create a feedback loop.","acceptance_criteria":"Derived curator output is distinguishable from primary input at the point the trigger is evaluated. A curator that writes memories does not thereby schedule itself again. There is a regression test that would fail if derived output were counted, with the feedback-loop rationale recorded in the test so the guard is not removed as redundant.","status":"open","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T15:47:44Z","created_by":"Sam Catlow","updated_at":"2026-07-29T15:47:44Z","dependencies":[{"issue_id":"archie-core-035","depends_on_id":"archie-core-yp9","type":"parent-child","created_at":"2026-07-30T01:47:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-89x","title":"Curator runtime: persistent loop with idle cooldown","description":"Implement the loop that runs a registered curator: continuous operation while work is available, backing off to a configured cooldown when there is nothing to do, waking on new input, and honouring per-curator check-in intervals.","acceptance_criteria":"A curator with pending input runs without waiting for its next interval; an idle curator consumes no meaningful CPU and wakes on new input. Cooldown and check-in interval are configurable per curator. Loop timing is tested with a fake clock, not wall-clock sleeps. Shutdown is clean and bounded: an in-flight curator pass is cancelled via context and the daemon does not block indefinitely on it. A panicking curator is recovered and isolated from other curators and from the agent loop.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T15:47:43Z","created_by":"Sam Catlow","updated_at":"2026-07-29T15:47:43Z","dependencies":[{"issue_id":"archie-core-89x","depends_on_id":"archie-core-yp9","type":"parent-child","created_at":"2026-07-30T01:47:43Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} @@ -80,7 +82,7 @@ {"_type":"issue","id":"archie-core-qa4.3","title":"Phase 3: correctness findings needing judgement (~62 issues)","description":"nilerr (11: 6 in internal/agentexec inprocess.go/worker.go, 2 gateway), bodyclose (1), contextcheck (7), containedctx (2), fatcontext. SINGLE SESSION, sequential, no subagents: each nilerr site needs a read of whether the swallow is deliberate degradation or a real bug, and a context-free worker will silently convert deliberate behaviour into a change. Do nilerr FIRST -- highest bug probability in the whole set. BLOCKED on a policy decision for noctx (41 sites, mostly webui/worktree/store): fixing it means threading context through public APIs, which is an API change, not a lint fix.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T15:23:00Z","created_by":"Sam Catlow","updated_at":"2026-07-29T00:10:46Z","started_at":"2026-07-28T17:27:59Z","closed_at":"2026-07-29T00:10:46Z","close_reason":"Closed","dependencies":[{"issue_id":"archie-core-qa4.3","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:23:00Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-qa4.1","title":"Phase 1: autofix pass (~35 issues)","description":"golangci-lint run --fix plus the formatters. Covers errorlint, fatcontext, gocritic, sloglint, usestdlibvars, usetesting, gci, gofumpt, goimports. Zero judgement. MUST run first: it touches formatting across every file and would conflict with anything in flight. Single command, single commit, verify with task check.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:59Z","created_by":"Sam Catlow","updated_at":"2026-07-28T17:23:59Z","started_at":"2026-07-28T17:18:45Z","closed_at":"2026-07-28T17:23:59Z","close_reason":"Closed","dependencies":[{"issue_id":"archie-core-qa4.1","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:22:58Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-qa4.2","title":"Phase 2: mechanical per-package fixes (~40 issues)","description":"forcetypeassert (24, internal/tools 20 + internal/memory 2, nearly all tests), predeclared (9, webui/ratelimit/memory), leftover unconvert. Purely mechanical, package-local, no design judgement. THE ONLY PHASE WORTH PARALLELISING. Partition by package: tools / webui / memory+ratelimit / secret. Use git worktree isolation -- other sessions edit this repo concurrently and stale diagnostics are a known hazard. Each worker verifies scoped: go test ./internal/X/... plus golangci-lint run ./internal/X/...","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:59Z","created_by":"Sam Catlow","updated_at":"2026-07-28T17:23:35Z","started_at":"2026-07-28T17:18:49Z","closed_at":"2026-07-28T17:23:35Z","close_reason":"Closed","dependencies":[{"issue_id":"archie-core-qa4.2","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-28T01:22:59Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-qa4","title":"[EPIC] Clear the 160 golangci-lint findings","description":"Config landed in 9298afd; the gate is RED until this epic closes. Four phases, ordered by risk and by what invalidates what. Structural refactor MUST be last: it moves line numbers and invalidates everything in flight.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:58Z","created_by":"Sam Catlow","updated_at":"2026-07-27T15:22:58Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qa4","title":"[EPIC] Clear the 160 golangci-lint findings","description":"Config landed in 9298afd; the gate is RED until this epic closes. Four phases, ordered by risk and by what invalidates what. Structural refactor MUST be last: it moves line numbers and invalidates everything in flight.","notes":"Two behaviour regressions have now come out of lint-clearing work: the errorlint --fix in 6d4e0be (grep exit codes, fixed 782510d) and the nestif extraction in 651de0a (doubled model name, archie-core-0d6). Neither was caught by inspection. Treat structural extractions done for gocognit/nestif/cyclop as behaviour-bearing: when a helper is handed a collection by pointer or an index loop becomes a range loop, check the accumulation and the skip semantics before trusting the diff. Note makeShellExecutor is still flagged gocognit 40 -- that is the same pressure that produced 651de0a.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-27T15:22:58Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:19:23Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-4we","title":"Port tau internal/indexing (codesearch) into archie-core","description":"First slice of the tau cherry-pick strategy. Copy-and-mutate (NOT extract to pkg/ - Sam's decision: exporting would force designing metrics/session/logger seams upfront before archie-core knows which it wants differently).\n\ntau/internal/indexing is the cheapest high-value lift: 512 LoC, one file, and its only tau coupling is 3 calls to config.WorkspaceIndexDir()/WorkspaceIndexDBPath(). Nothing else in tau imports it.\n\nMutations: replace the global config path helpers with explicit constructor params (archie-core passes config, no globals); add the workspace-codesearch helper subcommand to archied since the manager deliberately runs google/codesearch in a child process (upstream fatal exits + mmap leaks must not kill the daemon).\n\nEach lifted file carries a provenance header (source path + tau commit) so a future refresh is a diff, not archaeology.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T13:41:58Z","created_by":"Sam Catlow","updated_at":"2026-07-27T13:47:42Z","started_at":"2026-07-27T13:42:57Z","closed_at":"2026-07-27T13:47:42Z","close_reason":"Ported tau internal/indexing/codesearch.go @ 4893818d0c76 into archie-core internal/indexing. Mutations: global config path helpers replaced by explicit indexing.Config + DefaultConfig(workDir) (two archied instances share carina and must not share an index); child-process helper is archied's own 'workspace-codesearch' subcommand in cmd/archied/codesearch.go, dispatched from main() before flag parsing so it touches no config/store/NATS; deferred db.Close explicitly discarded for errcheck. Added dep github.com/google/codesearch v1.3.0-rc.1 (uuid and modernc sqlite already present). Verified E2E against the real repo: 2.2MB indexed in 0.05s, correct hits, [] for no match, corrupt index -\u003e clean error exit 1 rather than process death. task check clean; golangci-lint 0 issues on both packages. Commit c924281. NOT pushed. Follow-up: nothing calls indexing.NewManager yet -- it is ported and proven but not wired into the agent's grep path.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-sc5","title":"Chat: real system prompt template for Archie (identity, tools, env)","description":"The chat agent's system prompt is the four-sentence static string in gateway.DefaultPersonas(). It carries no tool inventory, no environment/date block, and no instruction precedence, so the model invents its own capabilities -- it told Sam it 'only has the memory editing tool' and then offered to walk him through installing software it cannot install.\n\nTake the shape from tau: /work/apps/tau/internal/agent/templates/agent.md.tpl renders an agent body plus \u003ctools\u003e, \u003cguidelines\u003e, \u003cproject_context\u003e and \u003cenv\u003e blocks, and /work/apps/tau/internal/agent/spec/templates/tau.agent.md supplies identity, instruction precedence, core rules, communication rules and confirmation boundaries.\n\nKeep the existing PersonaRegistry as the style layer; the template is the substrate it renders into.","status":"closed","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-27T12:14:08Z","created_by":"Sam Catlow","updated_at":"2026-07-27T12:20:52Z","closed_at":"2026-07-27T12:20:52Z","close_reason":"Implemented gateway.BuildSystemPrompt rendering internal/gateway/templates/archie.md.tpl: instruction precedence, core rules, communication rules, \u003ctools\u003e and \u003cenv\u003e blocks, with PersonaRegistry kept as the style layer on top. Tool inventory is derived from the same core.ToolSet passed to the model (cmd/archied/toolSummaries) so prompt and reality cannot drift; empty toolset renders an explicit 'no tools are available'. Tool metadata is markup-escaped and whitespace-flattened against forged tags and forged list entries. task check clean: vet, full go test ./... , golangci-lint 0 issues on changed packages, gofumpt clean. Commit 7fde716. NOT yet deployed - not pushed.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-qnm","title":"Telegram: remove task approval from the public command surface","description":"Existing /approve [identity=name] \u003ctask-id\u003e was inherited as chat-task lifecycle control, but Sam explicitly states task approvals are not a product requirement. Reserve /approve exclusively for dangerous-command approval. Remove task approval from Telegram command menu/help/router/public UX; retain or remove internal waiting_human task mechanics only after verifying workflow callers. Do not repurpose the command until the dangerous-command approval model (archie-core-alm.6) exists.","acceptance_criteria":"Telegram no longer advertises or accepts task approval via /approve; no documentation/help describes task approvals; task lifecycle code is not broken for existing non-Telegram workflow paths; /approve remains unclaimed or is implemented only for the approved dangerous-command design.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T09:00:56Z","created_by":"Sam Catlow","updated_at":"2026-07-28T17:24:07Z","started_at":"2026-07-28T17:18:47Z","closed_at":"2026-07-28T17:24:07Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -166,6 +168,7 @@ {"_type":"issue","id":"archie-core-s1r","title":"Test forge fakes missing LinkBranch method broke go vet/test for whole module","description":"forge.Forge gained LinkBranch(ctx, owner, repo, issueNumber, branch) error in the branch-linking feature (ff4c51e) but the hand-rolled test doubles (stubForge in cmd/archied/main_test.go, prCapturingForge in cmd/archie-agent/taskrun_test.go, testForge in internal/daemon/daemon_test.go, fakeForge in internal/forgerpc/forgerpc_test.go) never got the method added, so they stopped satisfying forge.Forge. This broke go vet ./... and go test ./... for the entire module, not just those 4 packages, since go vet type-checks all test files as part of module vet. Fixed by adding LinkBranch stubs to all four fakes.","status":"closed","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-24T03:04:53Z","created_by":"Sam Catlow","updated_at":"2026-07-24T03:04:58Z","closed_at":"2026-07-24T03:04:58Z","close_reason":"Added LinkBranch stub methods to stubForge, prCapturingForge, testForge, and fakeForge. go build/vet/test ./... now clean across the whole module.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-633","title":"config.docker.toml missing required fields, no overlay merge implemented","description":"config.docker.toml was rewritten to be a docs-as-overlay file (comment says base+overlay merge) but internal/config.Load has no merge logic and docker-compose.yml mounts only config.docker.toml at /etc/archie/config.toml. It is missing bot_user, [forge], [dispatch], [models], [providers], [budgets] which Load requires -\u003e daemon fails to start in docker as currently configured. Implement real base+overlay config loading (or restore a full standalone docker config) so there is one source of truth.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-24T02:42:07Z","created_by":"Sam Catlow","updated_at":"2026-07-24T02:44:53Z","started_at":"2026-07-24T02:42:11Z","closed_at":"2026-07-24T02:44:53Z","close_reason":"Implemented config.LoadOverlay (base decode + overlay decode into same struct, then shared finalize/validate), wired -config-overlay flag in cmd/archied, fixed docker-compose.yml to mount both base config.toml and config.docker.toml overlay, minimized config.docker.toml to true diff-only overlay, added tests proving overlay-omitted required fields (bot_user, repos) still come from base.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-u64","title":"Daemon: process multiple tasks concurrently (max_concurrency enforcement)","description":"Daemon currently processes one task at a time (docs/prds/archie-core-v2-architecture.md Phase 2). This is the core blocker between current state and any multi-agent scaling mode — needed before container max_concurrency or same-repo concurrency can matter. Wire the daemon's dispatch loop to run N tasks in parallel, respecting a configurable max_concurrency.","design":"internal/container/pool.go already enforces max_concurrency for container lifecycle — reuse that limit/pattern in the daemon's task dispatch rather than inventing a second concurrency control.","acceptance_criteria":"Daemon dispatch loop runs multiple tasks concurrently up to a configured max_concurrency limit; single-task-at-a-time behavior is gone.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-23T19:36:31Z","created_by":"Sam Catlow","updated_at":"2026-07-23T21:37:42Z","started_at":"2026-07-23T21:29:41Z","closed_at":"2026-07-23T21:37:42Z","close_reason":"Implemented concurrent SQLite and NATS task dispatch using containers.max_concurrency, with default same-repo serialization and race-tested dispatcher coverage.","dependency_count":0,"dependent_count":2,"comment_count":0} +{"_type":"issue","id":"archie-core-ts9","title":"[BUG] find fallback reports a cancelled walk as 'no matches found'","description":"runFindGoFallback's walk callback swallows every per-entry error (returns nil to skip inaccessible entries), so the only error that can escape filepath.WalkDir is ctx.Err() from the cancellation select. The guard 'if err != nil \u0026\u0026 !errors.Is(err, ctx.Err())' therefore never fires: on timeout or /stop the function falls through and returns whatever it had collected, or 'no matches found' when it had collected nothing. This is the same failure the grep exit-code bug had -- the model is told a search found nothing when the search did not finish. Behaviour predates 6d4e0be; the errors.Is autofix in that commit is behaviour-neutral here (errors.Is(err, nil) is false for non-nil err, matching the old err != ctx.Err() when the context is live).","acceptance_criteria":"A find whose context is cancelled mid-walk returns an error result naming the cancellation, not 'no matches found' and not a silently partial list. Regression test in the style of TestGrepReportsSearchFailureRatherThanNoMatches.","status":"open","priority":2,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T16:19:00Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:19:00Z","dependencies":[{"issue_id":"archie-core-ts9","depends_on_id":"archie-core-ifi","type":"discovered-from","created_at":"2026-07-30T02:18:59Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-60f","title":"Seed a default SOUL without clobbering user edits","description":"Write a starter SOUL on first run and allow upgrading untouched scaffolding in place, following Hermes' is_legacy_template_soul approach: compare normalised content against known-shipped templates, which carry zero user intent, and only replace on an exact match.","acceptance_criteria":"First run seeds a documented starter SOUL. A SOUL matching a known shipped template can be upgraded in place. A SOUL the user has edited in any way is never modified. Comparison normalises line endings and trailing whitespace so a CRLF checkout does not defeat it.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:58Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:58Z","dependencies":[{"issue_id":"archie-core-60f","depends_on_id":"archie-core-4gv","type":"parent-child","created_at":"2026-07-30T02:09:57Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-t08","title":"Reconcile SOUL with PersonaRegistry and the six built-in personas","description":"Decide what happens to DefaultPersonas() (archie, helpful, concise, technical, creative, teacher) and the /personality command once SOUL owns identity. Options: SOUL replaces the default archie persona and the rest remain selectable style modifiers; or personas become seed templates a user copies into their SOUL; or personas are retired. Currently GetActive composes the baseline archie prompt with the selected persona, so the interaction with SOUL must be explicit rather than emergent.","acceptance_criteria":"Precedence between SOUL and a selected persona is defined and documented. /personality either keeps working with stated semantics or is removed deliberately. No path lets a persona selection blank out the user's SOUL without them asking.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:57Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:57Z","dependencies":[{"issue_id":"archie-core-t08","depends_on_id":"archie-core-4gv","type":"parent-child","created_at":"2026-07-30T02:09:57Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-3fb","title":"worktree.Manager gets an empty token when the forge degrades","description":"Since 518a1a0 a missing forge credential disables the forge instead of stopping archied. resolveForge returns an empty token in that case and cmd/archied/main.go still hands it to worktree.Manager{Token: token}. If repos are configured while the forge is disabled, clone/push fails at push time rather than at startup. This is the intended trade -- a deferred error beats a crash loop -- but the failure is currently discovered late and its message will not explain that the cause is an unconfigured forge.","acceptance_criteria":"A worktree operation attempted with no forge credential fails with a message naming the missing forge configuration as the cause, rather than a bare git transport error. Alternatively the manager refuses the operation up front. Either way the operator can tell why from the error alone.","status":"open","priority":2,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:21Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:21Z","dependency_count":0,"dependent_count":0,"comment_count":0} @@ -192,7 +195,7 @@ {"_type":"issue","id":"archie-core-abg.16.36","title":"Telegram: /restore to revert the last change","description":"Operator escape hatch requested alongside /restart: revert the last change from chat when an agent-authored change breaks something, without needing shell access to the host. Gateway-scoped.","acceptance_criteria":"Admin-only (allowlisted sender). Reverts the last change and reports what was reverted. Safe to run when there is nothing to revert.","notes":"Design finding: /restore must restore the latest agent-authored filesystem checkpoint, not revert an arbitrary daemon checkout commit. The change boundary will be owned by the sandboxed MCP execution layer: capture a pre-change checkpoint once per mutating agent turn, retain enough metadata to report files, and make restore safe/idempotent when empty. Hermes reference behavior uses this same filesystem-checkpoint boundary for /rollback; /undo is conversation-only. Blocked on 17.43.","status":"in_progress","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:15:34Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:27:32Z","started_at":"2026-07-26T19:25:16Z","dependencies":[{"issue_id":"archie-core-abg.16.36","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:15:33Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-abg.16.36","depends_on_id":"archie-core-abg.17.43","type":"blocks","created_at":"2026-07-27T05:27:32Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-a5w","title":"Evaluate internal/workflow architecture and APIs","description":"Perform a read-only, repository-grounded evaluation of internal/workflow. Identify correctness, definition clarity, reuse, interface ownership, coupling, testability, and maintainability improvements, with concrete evidence and prioritized recommendations.","acceptance_criteria":"Assessment covers package definitions, consumers, subpackages, tests, and architecture invariants; findings are prioritized with file references and actionable recommendations; no code or git changes are made.","notes":"Evaluation completed. Highest-priority findings: repository Yaegi stages expose full TaskContext and may be evaluated in the daemon; workflow Run ignores persistence failures and returns no result; baseline runs after repo stages; push precedes custom gate and diff cap; TDD repro is not environmentally restricted to tests; routing and status models are stringly and ambiguous; extension loaders duplicate incompatible plugin contracts and silently skip failures; AgentStage review is unused by production definitions; chat tasks still hit issue-only operations; lifecycle and routing tests are materially incomplete. Scoped workflow tests passed with GPG fixture access and scoped golangci-lint reported zero issues.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T06:39:19Z","created_by":"Sam Catlow","updated_at":"2026-07-26T06:47:45Z","started_at":"2026-07-26T06:39:27Z","closed_at":"2026-07-26T06:47:45Z","close_reason":"Read-only package evaluation completed and reported with prioritized, actionable findings.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-abg.17.42","title":"wire MCP per-server parallel-tool-calls flag into config and daemon startup","description":"Follow-up to archie-core-abg.17.20, which added mcp.Client.parallelToolCalls + WithParallelToolCalls(bool) at the client-API level (adversarially reviewed, race-clean). Nothing currently sets it: config.MCPServer (internal/config/config.go) has no field for it, and both NewClient call sites (cmd/archied/main.go:510's mcp.NewClient, and internal/tools/provider/mcp/provider.go:85's protocol.NewClient) construct clients without the option -- so the flag has zero effect in production as things stand today.","acceptance_criteria":"config.MCPServer gains a ParallelToolCalls bool field (default false, matching the client's safe-by-default); both NewClient call sites read it and pass mcp.WithParallelToolCalls(cfg value) accordingly; a config-driven test proves a server configured with parallel_tool_calls=true actually gets a parallel-opted Client.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T06:36:40Z","created_by":"Sam Catlow","updated_at":"2026-07-26T06:36:40Z","dependencies":[{"issue_id":"archie-core-abg.17.42","depends_on_id":"archie-core-abg.17","type":"parent-child","created_at":"2026-07-26T16:36:39Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-xec.4","title":"generalize Provider.APIKeyEnv / NATS.TokenEnv / Telegram.TokenEnv to SecretRef","description":"Follow-up to archie-core-xec, which only migrated Forge.TokenEnv (self-contained call site). Provider.APIKeyEnv is forwarded THREE different ways that all assume the secret is reachable by name in the daemon's own env, not resolved centrally:\n1. agentexec.NewRuntime -\u003e passes the env-var NAME into ai-sdk/runtime's AuthConfig.APIKeyEnv, which lazily os.Getenv's it later (external module, cannot change its contract).\n2. agentexec.WorkerEnvironment / subprocess.go WorkerEnvironment() -\u003e allowlist-forwards the NAME into a subprocess's environment for archie-agent to read itself.\n3. daemon.containerEnv() -\u003e already eagerly resolves via os.Getenv and injects NAME=value into a container env (this one generalizes cleanly).\n\nMigrating Provider.APIKeyEnv to SecretRef requires switching cases 1 and 2 from name-forwarding to eager-resolve-via-secret.Registry-then-inject-value (ai-sdk/runtime.AuthConfig.APIKey literal field already supports this per its ResolveAPIKey fallback chain -- no ai-sdk/runtime changes needed, just stop relying on its lazy os.Getenv path for non-env engines). Also migrate NATSConfig.TokenEnv and TelegramConfig.TokenEnv (each has a single simple os.Getenv call site, lower risk than Provider).","design":"secret.Registry must be threaded into agentexec.NewRuntime, WorkerEnvironment, and daemon.containerEnv (or a shared secret-resolution helper) so eager-resolve-then-inject replaces name-forwarding for engines other than the built-in env engine.","acceptance_criteria":"Provider.APIKeyEnv, NATSConfig.TokenEnv, TelegramConfig.TokenEnv replaced with SecretRef; all three consumption paths (in-process runtime, subprocess worker env, container env) resolve via secret.Registry; task check passes; adversarial review finds zero surviving findings; explicit test proving a non-env engine (e.g. a fake test engine) correctly delivers a provider API key to agentexec.NewRuntime via the AuthConfig.APIKey literal field, not APIKeyEnv.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T04:18:36Z","created_by":"Sam Catlow","updated_at":"2026-07-26T04:18:36Z","dependencies":[{"issue_id":"archie-core-xec.4","depends_on_id":"archie-core-xec","type":"parent-child","created_at":"2026-07-26T14:18:36Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-xec.4","title":"generalize Provider.APIKeyEnv / NATS.TokenEnv / Telegram.TokenEnv to SecretRef","description":"Follow-up to archie-core-xec, which only migrated Forge.TokenEnv (self-contained call site). Provider.APIKeyEnv is forwarded THREE different ways that all assume the secret is reachable by name in the daemon's own env, not resolved centrally:\n1. agentexec.NewRuntime -\u003e passes the env-var NAME into ai-sdk/runtime's AuthConfig.APIKeyEnv, which lazily os.Getenv's it later (external module, cannot change its contract).\n2. agentexec.WorkerEnvironment / subprocess.go WorkerEnvironment() -\u003e allowlist-forwards the NAME into a subprocess's environment for archie-agent to read itself.\n3. daemon.containerEnv() -\u003e already eagerly resolves via os.Getenv and injects NAME=value into a container env (this one generalizes cleanly).\n\nMigrating Provider.APIKeyEnv to SecretRef requires switching cases 1 and 2 from name-forwarding to eager-resolve-via-secret.Registry-then-inject-value (ai-sdk/runtime.AuthConfig.APIKey literal field already supports this per its ResolveAPIKey fallback chain -- no ai-sdk/runtime changes needed, just stop relying on its lazy os.Getenv path for non-env engines). Also migrate NATSConfig.TokenEnv and TelegramConfig.TokenEnv (each has a single simple os.Getenv call site, lower risk than Provider).","design":"secret.Registry must be threaded into agentexec.NewRuntime, WorkerEnvironment, and daemon.containerEnv (or a shared secret-resolution helper) so eager-resolve-then-inject replaces name-forwarding for engines other than the built-in env engine.","acceptance_criteria":"Provider.APIKeyEnv, NATSConfig.TokenEnv, TelegramConfig.TokenEnv replaced with SecretRef; all three consumption paths (in-process runtime, subprocess worker env, container env) resolve via secret.Registry; task check passes; adversarial review finds zero surviving findings; explicit test proving a non-env engine (e.g. a fake test engine) correctly delivers a provider API key to agentexec.NewRuntime via the AuthConfig.APIKey literal field, not APIKeyEnv.","notes":"Hit this while implementing archie-core-rs9 (TOML write strategy for `archied setup`). The parent epic archie-core-ewk / child archie-core-cbk describe setup step 2 (LLM provider) and step 5 (chat channel) as writing the credential \"via the secret engine\" -- i.e. a general {engine,key} SecretRef, same as Forge.Token. That's not accurate yet: as this bead already says, Provider.APIKeyEnv and Telegram.TokenEnv are plain env-var-name strings with no Registry involved, so today they can only ever mean the built-in \"env\" engine, whatever setup writes into them.\n\nPractical effect on archie-core-cbk: until this migrates, cbk's provider and chat-channel steps should either (a) only support the env engine for those two fields and say so explicitly when prompting, or (b) block on this bead if full multi-engine secret support is a hard requirement for setup. I did not attempt to fix this myself -- out of scope for rs9, and this bead already scopes the real fix (thread secret.Registry into agentexec.NewRuntime/WorkerEnvironment and daemon side). Flagging so whoever picks up cbk decides (a) vs (b) deliberately rather than discovering it mid-implementation.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T04:18:36Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:18:12Z","dependencies":[{"issue_id":"archie-core-xec.4","depends_on_id":"archie-core-xec","type":"parent-child","created_at":"2026-07-26T14:18:36Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-xec.2","title":"secret engine plugin: bws (Bitwarden Secrets Manager)","description":"Ship a yaegi-loaded secrets engine plugin wrapping the bws CLI (os/exec), following the internal/secret Engine interface from archie-core-xec.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T04:14:26Z","created_by":"Sam Catlow","updated_at":"2026-07-26T04:14:26Z","dependencies":[{"issue_id":"archie-core-xec.2","depends_on_id":"archie-core-xec","type":"parent-child","created_at":"2026-07-26T14:14:25Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-xec.3","title":"secret engine plugin: vault/openbao","description":"Ship a yaegi-loaded secrets engine plugin talking to Vault/OpenBao's HTTP KV API (net/http), following the internal/secret Engine interface from archie-core-xec.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T04:14:26Z","created_by":"Sam Catlow","updated_at":"2026-07-26T04:14:26Z","dependencies":[{"issue_id":"archie-core-xec.3","depends_on_id":"archie-core-xec","type":"parent-child","created_at":"2026-07-26T14:14:26Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-xec.1","title":"secret engine plugin: sops","description":"Ship a yaegi-loaded secrets engine plugin wrapping the sops CLI (os/exec), following the internal/secret Engine interface from archie-core-xec. Lives under the shipped engines directory, loaded the same way as custom engines to prove the extension point.","status":"open","priority":2,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T04:14:25Z","created_by":"Sam Catlow","updated_at":"2026-07-26T04:14:25Z","dependencies":[{"issue_id":"archie-core-xec.1","depends_on_id":"archie-core-xec","type":"parent-child","created_at":"2026-07-26T14:14:25Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} @@ -307,6 +310,7 @@ {"_type":"issue","id":"archie-core-5zh","title":"Promote archie-agent to per-task process; move workflow routing out of archied","description":"cmd/archie-agent exists but only executes one workflow stage per invocation over the internal/agentexec stdin/stdout JSON protocol (v1). Phase 1 of the PRD requires promoting it to the PRD's per-task process model, moving workflow.Route/workflow.Run out of archied and into archie-agent.","acceptance_criteria":"workflow.Route and workflow.Run execute inside archie-agent, not archied; archie-agent handles a full task (not a single stage) per invocation.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-23T19:36:32Z","created_by":"Sam Catlow","updated_at":"2026-07-23T23:15:04Z","started_at":"2026-07-23T21:51:46Z","closed_at":"2026-07-23T23:15:04Z","close_reason":"All sub-issues (5zh.1 Store RPC, 5zh.2 Forge RPC, 5zh.3 worktree Prepare/Push RPC, 5zh.5 curated TaskConfig payload, 5zh.6 TaskContext interface refactor, 5zh.7 archie-agent full-task handler, 5zh.9 register RPC servers, 5zh.8 daemon handoff) are closed. Original acceptance criterion met: workflow.Route and workflow.Run execute inside archie-agent, not archied, in sandboxed NATS+container mode; archie-agent handles a full task per invocation. inprocess/subprocess modes unaffected.","dependencies":[{"issue_id":"archie-core-5zh","depends_on_id":"archie-core-l1q","type":"blocks","created_at":"2026-07-24T05:36:36Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-l1q","title":"NATS transport: JetStream task queue + request-reply between daemon and archie-agent","description":"Phase 1 of docs/prds/archie-core-v2-architecture.md. internal/events.Bus (in-process pub/sub, already feeding SQLite + SSE) is the natural seam to replace the transport under. Daemon publishes tasks, archie-agent consumes, results return via NATS. Preserve current inprocess mode via [agent] mode default for local dev.","design":"Add optional [nats] config block (url, token_env), default anonymous auth for single-node, credentials required for multi-node per PRD sec.9 open question 2.","acceptance_criteria":"Daemon can dispatch a task to archie-agent over NATS JetStream and receive results via request-reply; inprocess mode still works unchanged.","status":"closed","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-23T19:36:31Z","created_by":"Sam Catlow","updated_at":"2026-07-23T21:49:40Z","started_at":"2026-07-23T21:43:05Z","closed_at":"2026-07-23T21:49:40Z","close_reason":"Completed JetStream task dispatch and NATS agent request/reply, including token_env authentication for archied and canonical NATS_URL/NATS_TOKEN propagation to container workers; anonymous local mode remains supported and race-tested.","dependencies":[{"issue_id":"archie-core-l1q","depends_on_id":"archie-core-u64","type":"blocks","created_at":"2026-07-24T05:36:36Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"archie-core-rig","title":"Audit archie-core repo for bugs/improvements, file as Gitea issues","description":"Fan out exploration subagents across internal/ subsystems to find bugs, tech debt, and enhancement opportunities. Each confirmed finding gets filed as a Gitea issue on git.catlow.cloud/sam/archie-core.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-22T16:24:07Z","created_by":"Sam Catlow","updated_at":"2026-07-22T16:37:16Z","started_at":"2026-07-22T16:24:09Z","closed_at":"2026-07-22T16:37:16Z","close_reason":"Audit complete: 58 Gitea issues (#3-#60) filed at git.catlow.cloud/sam/archie-core. 60 raw findings, 59 verified, 58 successfully filed. 8 agents hit session limit at end (webui/workflow/worktree file-phase).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-ewk.2","title":"config.example.toml has no token_env placeholder under [chat.telegram]","description":"TelegramConfig.TokenEnv (internal/config/config.go:536) is a real, used field (cmd/archied/telegram_setup.go reads it via os.Getenv), but the commented [chat.telegram] block in config.example.toml only documents update_check_command / update_install_command -- there is no \"# token_env = ...\" line. An operator reading the example file to learn what's configurable would not discover this key exists.\n\nDiscovered while implementing archie-core-rs9 and testing tomlwrite.Apply against the real template: setting chat.telegram.token_env for the first time falls through to Apply's \"key not found in table\" path (uncomment header, append key), which works fine -- this is a documentation completeness gap in the template, not a functional blocker for archie-core-cbk.","acceptance_criteria":"Add a commented `# token_env = \"...\"` line (with a short comment on what it should point to, e.g. an env var containing the @BotFather token) under the commented [chat.telegram] block in config.example.toml, matching the style of the other commented-out optional fields.","status":"open","priority":3,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T16:19:02Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:19:02Z","dependencies":[{"issue_id":"archie-core-ewk.2","depends_on_id":"archie-core-ewk","type":"parent-child","created_at":"2026-07-30T02:19:02Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-ahw","title":"isForgeDisabled is duplicated in cmd/archied","description":"resolveForge in cmd/archied/main.go needs the none/off/disabled predicate, but the identical helper in internal/infrastructure/configuration is unexported, so 518a1a0 copied it with a comment noting the duplication. Two copies of a validation predicate drift: adding a fourth disabled-alias in one place silently leaves the other accepting it.","acceptance_criteria":"One definition of the disabled-forge predicate, referenced by both the configuration package and cmd/archied. The comment noting the duplication is removed with it.","status":"open","priority":3,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:22Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:22Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-cg9","title":"install.sh: REPO_URL points at a repository that does not exist","description":"install.sh:26 sets REPO_URL to https://github.com/samcharles93/archie-core.git, which is not reachable; origin is https://git.catlow.cloud/sam/archie-core.git. Only affects the path where the installer is not run from a local clone -- i.e. the curl-to-shell install this script exists to serve. Sam is working locally for now and deliberately deferred this on 2026-07-30; filed so it is not forgotten before any public install path is offered.","acceptance_criteria":"REPO_URL resolves to a repository the installer can actually clone, or the clone path is removed in favour of requiring a local checkout.","status":"open","priority":3,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T16:09:03Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:09:03Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-abg.22.19","title":"ratelimit.Limiter: evict stale per-key entries to bound memory","description":"internal/ratelimit's Limiter.hits map never removes entries for (platform, userID) pairs that stop being used -- a user who fires once and never again leaves a permanent (eventually-empty-slice) map entry for the life of the process. Not a bug today since the package isn't wired into any caller yet, but flagged by adversarial review as needing an eviction/TTL story before it's wired into a long-running daemon path handling many distinct/cycling identities (otherwise an eventual memory leak / DoS vector).","status":"open","priority":3,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T06:53:13Z","created_by":"Sam Catlow","updated_at":"2026-07-26T06:53:13Z","dependencies":[{"issue_id":"archie-core-abg.22.19","depends_on_id":"archie-core-abg.22","type":"parent-child","created_at":"2026-07-26T16:53:12Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/internal/channels/telegram/model.go b/internal/channels/telegram/model.go index d67aa07bf..699cb35a5 100644 --- a/internal/channels/telegram/model.go +++ b/internal/channels/telegram/model.go @@ -39,9 +39,8 @@ func isModelCommand(text string) bool { // after the /model command token. It handles --provider=, // --provider , --global, --session, and --refresh. func parseModelRest(rest string) (model, provider string, global, session, refresh bool) { - fields := strings.Fields(rest) + provider, fields := splitProviderFlag(strings.Fields(rest)) var modelParts []string - provider = extractProviderFlag(fields, &modelParts) for _, f := range fields { switch f { case "--global": @@ -51,33 +50,38 @@ func parseModelRest(rest string) (model, provider string, global, session, refre case "--refresh": refresh = true default: - if !strings.HasPrefix(f, "--provider") { - modelParts = append(modelParts, f) - } + modelParts = append(modelParts, f) } } model = strings.Join(modelParts, " ") return model, provider, global, session, refresh } -// extractProviderFlag extracts --provider= or --provider -// from fields, returning the non-provider fields via modelParts. -func extractProviderFlag(fields []string, modelParts *[]string) string { - for i := range fields { +// splitProviderFlag extracts --provider= or --provider and +// returns the provider along with the fields that remain. It is the only place +// the surviving fields are accumulated: an earlier version handed a shared +// slice to the helper and appended to it again in the caller's loop, so every +// model name was doubled ("/model gpt-4o" asked for "gpt-4o gpt-4o"). A +// space-separated provider value is removed with its flag rather than left in +// the remainder, where it would be joined into the model name. +func splitProviderFlag(fields []string) (provider string, remaining []string) { + for i := 0; i < len(fields); i++ { f := fields[i] if !strings.HasPrefix(f, "--provider") { - *modelParts = append(*modelParts, f) + remaining = append(remaining, f) continue } if after, ok := strings.CutPrefix(f, "--provider="); ok { - return after + provider = after + continue } // --provider (space-separated) if i+1 < len(fields) && !strings.HasPrefix(fields[i+1], "--") { - return fields[i+1] + provider = fields[i+1] + i++ } } - return "" + return provider, remaining } // handleModelCommand handles /model with arguments, performing direct diff --git a/internal/channels/telegram/model_test.go b/internal/channels/telegram/model_test.go index 4bcd2562b..61ac05982 100644 --- a/internal/channels/telegram/model_test.go +++ b/internal/channels/telegram/model_test.go @@ -443,3 +443,62 @@ func TestProviderCallbackRejectsUnauthorizedAndMalformedSelections(t *testing.T) }) } } + +// TestParseModelRestReturnsDeclaredValuesInOrder covers the naked return that a +// nakedret autofix expanded in 6d4e0be. Every result shares a type with at +// least one other -- two strings, three bools -- so a transposed pair compiles +// silently and would surface only as /model switching the wrong scope. Each +// case sets exactly one flag so no pair of bools can swap undetected. +func TestParseModelRestReturnsDeclaredValuesInOrder(t *testing.T) { + tests := []struct { + name string + rest string + model string + provider string + global bool + session bool + refresh bool + }{ + {name: "model only", rest: "gpt-5.6", model: "gpt-5.6"}, + {name: "inline provider", rest: "gpt-5.6 --provider=openai", model: "gpt-5.6", provider: "openai"}, + {name: "separated provider", rest: "gpt-5.6 --provider openai", model: "gpt-5.6", provider: "openai"}, + {name: "global scope", rest: "gpt-5.6 --global", model: "gpt-5.6", global: true}, + {name: "session scope", rest: "gpt-5.6 --session", model: "gpt-5.6", session: true}, + {name: "refresh", rest: "--refresh", refresh: true}, + {name: "provider without model", rest: "--provider=openai --global", provider: "openai", global: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + model, provider, global, session, refresh := parseModelRest(tt.rest) + if model != tt.model || provider != tt.provider { + t.Fatalf("parseModelRest(%q) = model %q, provider %q; want %q, %q", + tt.rest, model, provider, tt.model, tt.provider) + } + if global != tt.global || session != tt.session || refresh != tt.refresh { + t.Fatalf("parseModelRest(%q) = global %v, session %v, refresh %v; want %v, %v, %v", + tt.rest, global, session, refresh, tt.global, tt.session, tt.refresh) + } + }) + } +} + +// TestParseModelRestDoesNotDoubleTheModelName guards the regression introduced +// by the nestif extraction in 651de0a: the extracted helper appended surviving +// fields to a slice the caller then appended to again, so "/model gpt-5.6" +// asked the router for "gpt-5.6 gpt-5.6" and every direct model switch failed +// as an unknown model. A separated provider value was doubled into the name +// too. The assertion is on field count rather than equality so that a future +// re-extraction cannot pass by doubling a different part of the string. +func TestParseModelRestDoesNotDoubleTheModelName(t *testing.T) { + for _, rest := range []string{ + "gpt-5.6", + "gpt-5.6 --global", + "gpt-5.6 --provider openai", + "gpt-5.6 --provider=openai --session", + } { + model, _, _, _, _ := parseModelRest(rest) + if fields := strings.Fields(model); len(fields) != 1 { + t.Fatalf("parseModelRest(%q) model = %q; want a single field", rest, model) + } + } +} diff --git a/internal/tools/builtin/shell_exit_test.go b/internal/tools/builtin/shell_exit_test.go new file mode 100644 index 000000000..4e1e30e15 --- /dev/null +++ b/internal/tools/builtin/shell_exit_test.go @@ -0,0 +1,33 @@ +package builtin + +import ( + "context" + "encoding/json" + "strings" + "testing" +) + +// TestShellReportsExitCodeRatherThanAGenericError covers the errorlint autofix +// in 6d4e0be, which rewrote `err.(*exec.ExitError)` into errors.As here. The +// same rewrite in grep.go dropped a companion exit-code check and turned failed +// searches into empty results; this call site had no companion check to lose, +// but nothing guarded the branch either. If the assertion ever stops matching, +// a non-zero exit degrades to "error executing command" and the model loses the +// exit code it uses to tell a failed command from a broken one. +func TestShellReportsExitCodeRatherThanAGenericError(t *testing.T) { + tool := NewShellTool(t.TempDir(), nil) + + result, err := tool.Execute(context.Background(), json.RawMessage(`{"command":"exit 3"}`), nil) + if err != nil { + t.Fatalf("execute: %v", err) + } + if !result.IsError { + t.Fatalf("a non-zero exit must be reported as an error, got %#v", result) + } + if result.ErrorKind != "command_exit" { + t.Fatalf("error kind = %q, want command_exit; result: %#v", result.ErrorKind, result) + } + if !strings.Contains(result.Content, "[exit code: 3]") { + t.Fatalf("exit code missing from result: %s", result.Content) + } +}