From a751be66b3680abec1aa7791fc33573c9967ae64 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Tue, 4 Aug 2026 23:33:08 +1000 Subject: [PATCH] chore(beads): close archie-core-ky6 --- .beads/interactions.jsonl | 1 + .beads/issues.jsonl | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.beads/interactions.jsonl b/.beads/interactions.jsonl index c10a69e85..c7e08203c 100644 --- a/.beads/interactions.jsonl +++ b/.beads/interactions.jsonl @@ -252,3 +252,4 @@ {"id":"int-3be21f823391c1ca4f895e87e456dc3f","kind":"field_change","created_at":"2026-08-04T12:48:09.558765245Z","actor":"Sam Catlow","issue_id":"archie-core-12n","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Closed"}} {"id":"int-0acabfbc83fa1bd117fca76693a7846c","kind":"field_change","created_at":"2026-08-04T12:48:09.945490827Z","actor":"Sam Catlow","issue_id":"archie-core-iyx","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Closed"}} {"id":"int-ada12b543691cdbcf87cc50c0ee0f3ff","kind":"field_change","created_at":"2026-08-04T12:48:10.334971684Z","actor":"Sam Catlow","issue_id":"archie-core-8u8.2","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}} +{"id":"int-2f6f4fe49056cd5f69cff38279f533b0","kind":"field_change","created_at":"2026-08-04T13:33:08.314758463Z","actor":"Sam Catlow","issue_id":"archie-core-ky6","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Closed"}} diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 249359b60..8e8c17878 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -81,7 +81,7 @@ {"_type":"issue","id":"archie-core-u4v","title":"Wire secret engines into provider discovery and execution","description":"Production creates only the env registry, never loads secret-engine plugins, and Provider lacks the documented api_key SecretRef. Implement startup plugin loading, backwards-compatible provider secret references, resolved provider discovery/runtime/container propagation, tests, release, and Carina deployment.","acceptance_criteria":"Provider api_key SecretRefs resolve through loaded engines at startup; existing api_key_env remains compatible; discovered providers, chat runtime, taskrun and containers receive resolved credentials without logging or serializing secret values; production composition tests and task check pass.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-30T17:52:08Z","created_by":"Sam Catlow","updated_at":"2026-07-30T22:48:38Z","started_at":"2026-07-30T17:52:13Z","closed_at":"2026-07-30T22:48:38Z","close_reason":"Live BWS discovery verified and ai-sdk openai-compatible fallback restored; 4+ provider catalog can now surface; full gate and final adversarial review pass","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-6he","title":"Telegram rejects model confirmation when clearing inline keyboard","description":"Selecting a model calls editMessageText with a typed nil reply_markup; Telegram rejects it as object expected, leaving the picker visible. Omit reply_markup when no keyboard is required and cover the request shape.","acceptance_criteria":"Selecting any model replaces the picker with metadata confirmation and the Telegram edit request omits reply_markup when clearing controls.","status":"closed","priority":1,"issue_type":"bug","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-30T17:46:25Z","created_by":"Sam Catlow","updated_at":"2026-07-30T17:47:08Z","started_at":"2026-07-30T17:46:29Z","closed_at":"2026-07-30T17:47:08Z","close_reason":"Telegram confirmation edits now omit nil reply_markup; regression test passes","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-v8x","title":"Unify Telegram provider and model selection around SDK catalog","description":"Replace the separate /provider and static configured-model surfaces with one /model provider-to-model wizard. Build the usable provider catalog from the local ai-sdk models.dev catalog plus environment credentials and explicit overrides, cache the filtered tool-capable catalog under the active config directory, and use the same resolved provider/model state across chat and execution paths. Remove the handwritten WellKnown table and remove external-framework references from the Archie tree.","acceptance_criteria":"/model first shows usable providers, then paginated tool-capable models, then atomically switches provider/model and reports model metadata and scope. /provider is absent from executable/menu/help surfaces. Catalog refresh is downloaded at daemon startup and cached beside configuration with safe cached fallback. Environment discovery and explicit overrides flow through chat, identities, subprocess and container/taskrun paths. Focused and composition tests cover discovery, pagination, callbacks and execution parity. A case-insensitive repository scan outside the explicit .references source tree finds no forbidden external-framework name.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-30T17:10:38Z","created_by":"Sam Catlow","updated_at":"2026-07-30T17:39:37Z","started_at":"2026-07-30T17:10:59Z","closed_at":"2026-07-30T17:39:37Z","close_reason":"Implemented SDK-backed provider discovery, unified Telegram model picker, safe catalog caching, and execution composition tests","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-ky6","title":"One optional MCP provider failing takes down the whole daemon","description":"internal/tools/provider/provider.go Start() is atomic by design -- 'Any failure rolls the complete family back' -- so a single failing provider unregisters every other provider including the builtins, capabilityHost.Start returns the error, and cmd/archied/main.go:655 exits 1. Under compose restart or systemd Restart=on-failure that is a crash loop. Observed 2026-07-30 on carina: mcp.desktop-commander could not start (missing unzip in the runtime image, fixed in 455fd6f) and archied restarted continuously, losing chat, the gateway and every builtin tool over one third-party npm package.\\n\\nAtomicity is correct for a provider the daemon requires. It is wrong for an external MCP server pulled from a registry at runtime, which is exactly the category that should be allowed to be absent -- the same reasoning applied to the forge in 518a1a0, where a missing credential now disables the capability rather than the daemon.","design":"Needs a required/optional distinction on the registration or manifest, which does not exist today. Keep the all-or-nothing path for required providers; the atomic batch semantics for tool visibility (tools appear only after Start and Discover both succeed) should hold per-provider either way. Relates to the plugin engine rule in ARCHITECTURE.md: failure isolation is explicitly the owning manager's responsibility.","acceptance_criteria":"A provider can be declared optional. An optional provider that fails to start or discover is logged, excluded from the running set, and does not roll back the family or stop the daemon. A required provider keeps today's atomic rollback. Provider health reflects the degraded state so the failure is visible rather than silent. Regression test starts a family containing one failing optional provider and asserts the other providers' tools remain registered and Start returns nil.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-30T06:49:26Z","created_by":"Sam Catlow","updated_at":"2026-07-30T06:49:26Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-ky6","title":"One optional MCP provider failing takes down the whole daemon","description":"internal/tools/provider/provider.go Start() is atomic by design -- 'Any failure rolls the complete family back' -- so a single failing provider unregisters every other provider including the builtins, capabilityHost.Start returns the error, and cmd/archied/main.go:655 exits 1. Under compose restart or systemd Restart=on-failure that is a crash loop. Observed 2026-07-30 on carina: mcp.desktop-commander could not start (missing unzip in the runtime image, fixed in 455fd6f) and archied restarted continuously, losing chat, the gateway and every builtin tool over one third-party npm package.\\n\\nAtomicity is correct for a provider the daemon requires. It is wrong for an external MCP server pulled from a registry at runtime, which is exactly the category that should be allowed to be absent -- the same reasoning applied to the forge in 518a1a0, where a missing credential now disables the capability rather than the daemon.","design":"Needs a required/optional distinction on the registration or manifest, which does not exist today. Keep the all-or-nothing path for required providers; the atomic batch semantics for tool visibility (tools appear only after Start and Discover both succeed) should hold per-provider either way. Relates to the plugin engine rule in ARCHITECTURE.md: failure isolation is explicitly the owning manager's responsibility.","acceptance_criteria":"A provider can be declared optional. An optional provider that fails to start or discover is logged, excluded from the running set, and does not roll back the family or stop the daemon. A required provider keeps today's atomic rollback. Provider health reflects the degraded state so the failure is visible rather than silent. Regression test starts a family containing one failing optional provider and asserts the other providers' tools remain registered and Start returns nil.","notes":"Fixed 2026-08-04 in a8c9483.\n\nRegistry.RegisterOptional marks a provider the daemon can run without; Register is unchanged and keeps atomic rollback. The distinction lives on the registration rather than the manifest: required-vs-optional is a deployment fact, not a property of the code, and keeping it out of plugin.Manifest preserves the metadata-only rule.\n\nAn optional provider failing Start, Discover or index registration is stopped (so a half-started child process is not leaked), excluded from the running set, and recorded in Skipped(). The family carries on. Per-provider atomic tool visibility still holds either way: tools appear only after Start and Discover both succeed.\n\nDependency cascade: a provider whose dependency was skipped cannot run. Optional dependents are skipped with the reason; a required dependent is a hard failure, since it declared it cannot work without something now absent.\n\nVisibility: Health returns degraded naming each excluded provider and its cause, Skipped() exposes the set programmatically, and cmd/archied logs one error line per exclusion after capability host startup.\n\nmain.go now registers every [[tools.mcp_servers]] entry with RegisterOptional, and a registration error warns and continues rather than exiting.\n\nVerified: TestCarinaScenarioThroughCapabilityHost drives the real plugin.Host, the path main.go calls. Registered as required it fails with 'start plugin module \"archie.tools\": start tool provider \"mcp.desktop-commander\": npx exec: unzip: not found' -- verbatim the crash loop. As optional the host starts, read/shell/edit/memory_edit stay registered, and health is degraded carrying the cause.\n\nCLAUDE.md's per-package trap note updated; it documented the old hard-failure behaviour.\n\nNOT DONE, deliberately: there is no per-server required/optional switch in config. Every MCP server is optional. An operator who genuinely depends on one gets a degraded daemon and an error log rather than a refusal to start, which matches the forge and container precedent. Add a config knob only if a real deployment needs it.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-30T06:49:26Z","created_by":"Sam Catlow","updated_at":"2026-08-04T13:33:08Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-qa4.5","title":"Phase 5: the 56 lint findings Phase 4 left behind","description":"Discovered as a side effect of the 6d4e0be audit (archie-core-ifi), not as its\ngoal: running golangci-lint over the two packages I had touched showed findings\nin files nobody had flagged, so I ran it repo-wide.\n\nAll four children of archie-core-qa4 are closed and the epic reports \"4/4\ncomplete (100%) -- eligible for close\", but `golangci-lint run ./...` still\nreports 56 issues. The epic must not be closed on that prompt; its own\ndescription says the gate is RED until it closes, so closing it early declares\na green gate that does not exist.\n\nBreakdown: noctx 11, gocognit 11, gocritic 6, errcheck 6, nilerr 4, recvcheck 3,\nnestif 3, godox 3, sloglint 2, predeclared 2, funlen 2, gofumpt 1, cyclop 1,\nstaticcheck 0 (the one hit, configtemplate.go:6, is fixed).\n\nThe gocognit remainder is concentrated in exactly the functions Phase 4 named as\ndeferred -- cmd/archied/main.go run (106, the description predicted \"108-\u003e30\nremaining\" and it did not land), internal/workflow AgentStage.Stage (68),\nFeasibility and TDD (funlen), cmd/archie-agent startMCPProviders (45) -- plus\nthe whole of internal/tools/builtin: grepFallback 58, runFindGoFallback 57,\nmakeReadExecutor 56, makeGrepExecutor 41, makeShellExecutor 40, makeWriteExecutor\n38, suggestPaths 36. tomlwrite.Apply (82) is new, uncommitted-until-7fab597 code.\n\nREAD archie-core-qa4's notes before starting. Both known behaviour regressions\nfrom this epic came out of structural extraction, and every remaining gocognit\nsite is a structural extraction waiting to happen. The nilerr findings in\ngrep.go are not noise either -- see archie-core-ts9, where the same swallow in\nfind.go is a live false-negative bug. Fixing nilerr by \"returning the error\"\nwithout deciding what the caller does with it will change tool behaviour.","acceptance_criteria":"golangci-lint run ./... reports 0 issues, or every remaining finding has an explicit nolint with a reason. Each structural extraction lands with a behavioural test for the function it splits, per the discipline recorded in archie-core-qa4's notes.","status":"open","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T16:26:57Z","created_by":"Sam Catlow","updated_at":"2026-07-29T16:26:57Z","dependencies":[{"issue_id":"archie-core-qa4.5","depends_on_id":"archie-core-qa4","type":"parent-child","created_at":"2026-07-30T02:26:57Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-qa4.5","depends_on_id":"archie-core-ts9","type":"blocks","created_at":"2026-07-30T02:27:02Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-qa4.5","depends_on_id":"archie-core-ifi","type":"discovered-from","created_at":"2026-07-30T02:26:57Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"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.","design":"Two ways to fix the double append were available. Rejected: keep the helper\nsignature and delete the caller's default-branch append. That restores correct\noutput but leaves the shape intact -- a helper holding a pointer to the\ncaller's accumulator, with two loops over the same fields -- so the next person\nwho adds a field type has the same trap waiting. It also does not fix the\nspace-separated provider value, because the helper returns early on the first\n--provider and never sees the fields after it.\n\nChosen: splitProviderFlag returns (provider, remaining) and is the sole\naccumulator. One loop owns the fields, and there is no shared slice to append\nto twice. The index loop is kept deliberately -- i++ after reading a\nspace-separated value is what removes it with its flag, and converting that to\na range loop is precisely what 651de0a did wrong.\n\nLast --provider wins if repeated, matching the pre-651de0a behaviour rather\nthan the buggy helper's first-wins. Not worth a flag: /model does not document\nrepeating it.","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:26:09Z","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} @@ -100,7 +100,7 @@ {"_type":"issue","id":"archie-core-lp1","title":"Ship the file-writing store as the default memory engine","description":"Reframe internal/memory/builtin as the reference engine implementation behind the new contract, so the standard install keeps writing memories to files with no configuration and no behaviour change.","acceptance_criteria":"The builtin store implements the engine contract and registers as the default. A config that names no memory engine behaves exactly as today, verified by existing internal/memory tests continuing to pass unmodified where they assert behaviour rather than structure. Its lifecycle methods are real or explicit no-ops, not stubs that silently do nothing surprising.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T15:46:57Z","created_by":"Sam Catlow","updated_at":"2026-07-29T15:46:57Z","dependencies":[{"issue_id":"archie-core-lp1","depends_on_id":"archie-core-huu","type":"parent-child","created_at":"2026-07-30T01:46:57Z","created_by":"Sam Catlow","metadata":"{}"},{"issue_id":"archie-core-lp1","depends_on_id":"archie-core-1x7","type":"blocks","created_at":"2026-07-30T01:48:15Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-1x7","title":"Memory engine contract and owning registry","description":"Define the typed memory engine interface and the registry that owns provider registration, discovery, and lifecycle. This is the load-bearing design step: everything else in the epic is written against this contract.","acceptance_criteria":"A typed interface exposes real memory operations beyond identity metadata. An owning Registry/Manager controls registration, init, start, health, and stop, and defines failure isolation and shutdown ordering. Providers receive only a typed registrar and the host services their capability declares. internal/plugin/architecture_test.go passes with memory recognised as a conforming engine family. Stateless providers may declare explicit no-op lifecycle.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-29T15:46:56Z","created_by":"Sam Catlow","updated_at":"2026-07-29T15:46:56Z","dependencies":[{"issue_id":"archie-core-1x7","depends_on_id":"archie-core-huu","type":"parent-child","created_at":"2026-07-30T01:46:56Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":4,"comment_count":0} {"_type":"issue","id":"archie-core-huu","title":"[EPIC] Pluggable memory engine: typed family + external providers","description":"Make the memory subsystem a pluggable engine family so an external memory backend (Honcho, or a future alternative) can be bolted on without touching the agent loop, while the file-writing store ships as the default. internal/memory already has a Manager and lifecycle hooks (TurnStartHook, SessionEndHook, SessionSwitchHook); this epic promotes that into a conforming engine family per the strict plugin engine rule in ARCHITECTURE.md rather than inventing a parallel abstraction.","design":"Constraint from the plugin engine rule: 'engine' requires a typed domain contract, an owning Registry or Manager, explicit lifecycle/health, and narrow typed registrars -- providers never receive *daemon.Daemon or untyped hook maps. The contract must express real memory operations (write observation, query, list, forget), not just Name/Version.","acceptance_criteria":"Memory is a typed engine family with an owning registry/manager, start/health/stop lifecycle, and narrow typed host access, satisfying every invariant in ARCHITECTURE.md 'Plugin engine rule (strict)' and passing internal/plugin/architecture_test.go. The builtin file-writing store is the shipped default engine and remains the behaviour when nothing is configured. At least one external engine is implementable against the contract without changes to the agent loop or gateway. Engine selection and per-engine settings are configurable, validated, and documented. Failure of a non-default engine degrades to a reported error rather than taking down a turn.","status":"open","priority":1,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-29T15:46:38Z","created_by":"Sam Catlow","updated_at":"2026-07-29T15:46:38Z","dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"archie-core-qiq","title":"chat: mid-conversation context loss, undiagnosed","description":"Reported from a real Telegram transcript (29 Jul, ~09:47 AEST / 23:47 UTC 28\nJul). Turn 3 of a coherent conversation was answered with a fresh greeting as\nthough no history existed; turn 4 was coherent again.\n\nRuled out by evidence:\n- Not two processes racing the bot token. docker compose ps on carina shows a\n single archied container.\n- Not a restart. That container had 43h uptime spanning the whole exchange.\n- Not history compression. DefaultCompressionConfig protects the first 3 and\n last 20 messages and triggers at 50% of a 128k window; there were three\n messages.\n- Not a canned greeting. No such string exists in the codebase, so the reply\n was model-generated from little or no history.\n- Not the session-key namespace split fixed in 96ab167: the deployed image\n predates the session lifecycle commands entirely.\n\nBlocked on evidence, now unblocked: chat turns were completely unlogged (76\nlog lines covered two days, none a conversation). 96ab167 adds a \"chat turn\"\nlog line carrying session id, channel, thread and history depth.\n\nNext step when it recurs: check the chat turn log for that message. A session\nid differing from neighbouring turns points at key resolution (e.g. ThreadID\nappearing on one message); history_messages of 0 or 1 with a stable session id\npoints at the store read path.\n\nDo not close this by guessing. It needs one reproduction with the new log line.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T05:17:39Z","created_by":"Sam Catlow","updated_at":"2026-07-29T05:17:39Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"archie-core-qiq","title":"chat: mid-conversation context loss, undiagnosed","description":"Reported from a real Telegram transcript (29 Jul, ~09:47 AEST / 23:47 UTC 28\nJul). Turn 3 of a coherent conversation was answered with a fresh greeting as\nthough no history existed; turn 4 was coherent again.\n\nRuled out by evidence:\n- Not two processes racing the bot token. docker compose ps on carina shows a\n single archied container.\n- Not a restart. That container had 43h uptime spanning the whole exchange.\n- Not history compression. DefaultCompressionConfig protects the first 3 and\n last 20 messages and triggers at 50% of a 128k window; there were three\n messages.\n- Not a canned greeting. No such string exists in the codebase, so the reply\n was model-generated from little or no history.\n- Not the session-key namespace split fixed in 96ab167: the deployed image\n predates the session lifecycle commands entirely.\n\nBlocked on evidence, now unblocked: chat turns were completely unlogged (76\nlog lines covered two days, none a conversation). 96ab167 adds a \"chat turn\"\nlog line carrying session id, channel, thread and history depth.\n\nNext step when it recurs: check the chat turn log for that message. A session\nid differing from neighbouring turns points at key resolution (e.g. ThreadID\nappearing on one message); history_messages of 0 or 1 with a stable session id\npoints at the store read path.\n\nDo not close this by guessing. It needs one reproduction with the new log line.","notes":"CANDIDATE CAUSE 2026-08-04, from the gateway adversarial review. NOT closing -- this is a hypothesis matching the symptom, and the bead rightly asks for one reproduction with the chat turn log line before believing it.\n\narchie-core-x35: sessionTracker.resolve saved a newly created session BEFORE asking the cache who had won a concurrent race. Two callers resolving the same channel at once could each end up on a different session id, and the loser's turn ran against a session that had just been created -- i.e. an empty history -- while the next turn hit the now-settled cache and was coherent again.\n\nThat matches every point of evidence here: one turn answered as though no history existed, the next turn fine, single process, no restart, no compression involved, and no canned greeting (the model was answering with an empty history, so it greeted).\n\nConfirmed reachable by forcing the interleaving -- the store held 2 sessions where it should hold 1 -- and fixed in 3ebedcd, which claims the cache slot before the store write so only the winner writes and all racing callers agree.\n\nTwo other fixes from the same review could produce the same symptom and are also now in:\n- archie-core-jex (182375b): /topic off cached an empty session id, permanently routing a channel to session \"\".\n- archie-core-7s3 (740ec50): resolve picked an arbitrary session rather than the most recent, so a restart could resume a stale one. Ruled out here by the 43h uptime, but the same class.\n\nTO CONFIRM: if this recurs on a build containing 3ebedcd, the cause is something else and the chat turn log will show it. If it does not recur, that is consistent but not proof.","status":"open","priority":1,"issue_type":"bug","owner":"sam@catlow.tech","created_at":"2026-07-29T05:17:39Z","created_by":"Sam Catlow","updated_at":"2026-08-04T12:48:43Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-uxk","title":"gateway: restore /whoami /profile /sessions /resume /agents handlers","description":"These five command handlers were lost during parallel merges of the Telegram\nworkers. The Router fields they need (Identity, Models, Sessions, Agents)\nalready exist; the handlers and their Route cases do not.\n\n18 tests in internal/gateway/gateway_test.go already specify the exact\nbehaviour. They are currently failing. Run them and make them pass:\n\n go test ./internal/gateway/...\n\nFailing: TestRouteWhoami, TestRouteWhoamiNoIdentity, TestRouteWhoamiWithModel,\nTestRouteProfile, TestRouteProfileNoIdentity, TestRouteSessionsEmpty,\nTestRouteSessionsNotConfigured, TestRouteSessionsError, TestRouteResumeNoArg,\nTestRouteResumeNotConfigured, TestRouteResumeNoMatch, TestRouteResumeAmbiguous,\nTestRouteResumeExactMatch, TestRouteAgentsEmpty, TestRouteAgentsNotConfigured,\nTestRouteAgentsWithTasks, TestRouteAgentsError, TestLocalCommandsIncludesNewCommands\n\nScope:\n- ONLY internal/gateway/. Do not touch any other package.\n- Read the tests first; they define the exact reply text fragments expected\n (\"not configured\", \"No sessions\", \"Usage\", etc). Do not invent wording.\n- Follow the shape of the existing handlers in gateway.go and\n session_commands.go: handleX methods on *Router returning (string, error).\n- A nil dependency means \"not configured\" and returns a reply, not an error.\n A dependency that returns an error must propagate it (see TestRouteSessionsError).\n- Add the new commands to the Route switch and to LocalCommands.\n\nConstraints:\n- Do NOT add //nolint or otherwise suppress lint findings. Fix issues properly.\n- Do NOT write architecture docs, ledgers, plans or new beads. Just the code.\n- Do NOT modify the tests to make them pass. The tests are correct.\n\nDone when: go build ./... , go vet ./... , gofmt -l . clean, and\ngo test ./internal/gateway/... passes with zero failures.","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-29T00:58:16Z","created_by":"Sam Catlow","updated_at":"2026-07-29T01:11:44Z","closed_at":"2026-07-29T01:11:44Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-o3l","title":"infrastructure/eventbus/nats: relocate NATS transport","description":"Create internal/infrastructure/eventbus/nats as a properly structured replacement for internal/nats. This is NOT a mechanical move: the existing code has no interfaces, leaks vendor types (Conn() *nats.Conn, PublishMsg(*nats.Msg), Fetch() jetstream.Msg) into all four consumers, uses a 7-positional-parameter publish with stringly-typed comma-separated labels, stores an unused logger, returns (nil, nil) for 'no message', and hardcodes stream/consumer/timeout config. Rebuild it with: separate files per concern; a Message wrapper so jetstream types stop crossing the boundary; Publisher/Consumer interfaces; a Config struct; sentinel errors; consistent %w wrapping; real logging. Then update cmd/archied, cmd/archie-agent, internal/daemon and internal/agentexec to the new API.","acceptance_criteria":"internal/nats no longer exists; internal/infrastructure/eventbus/nats has its contents. All imports updated. task check clean. Container and NATS behaviour unchanged.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T00:02:50Z","created_by":"Sam Catlow","updated_at":"2026-07-29T00:14:19Z","started_at":"2026-07-29T00:04:35Z","closed_at":"2026-07-29T00:06:37Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"archie-core-vq4","title":"infrastructure/configuration: external input boundary","description":"Read docs/architecture/configuration.md. Create internal/infrastructure/configuration as the external config input boundary. It owns TOML/YAML decoding, env and secret references, base/overlay precedence, compatibility aliases, input validation, and provenance. It must NOT own domain behaviour. Preserve current LoadOverlay behaviour exactly and keep every existing TOML field name working. Translate the decoded input into the current internal/config.Config shape at the composition boundary as an explicitly-marked temporary adapter, so runtime behaviour is unchanged. Do not migrate consumers in this bead.","acceptance_criteria":"internal/infrastructure/configuration exists and is the loader used by cmd/archied. Old config files still load with identical effective values. task check clean. No consumer outside cmd/archied changed. The temporary adapter carries a comment naming its deletion condition.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-29T00:02:49Z","created_by":"Sam Catlow","updated_at":"2026-07-29T00:13:04Z","started_at":"2026-07-29T00:04:30Z","closed_at":"2026-07-29T00:13:04Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}