diff --git a/.beads/interactions.jsonl b/.beads/interactions.jsonl index 7adc09d20..15b09cf43 100644 --- a/.beads/interactions.jsonl +++ b/.beads/interactions.jsonl @@ -227,3 +227,4 @@ {"id":"int-708d599fdab7b76f04111619b278a3de","kind":"field_change","created_at":"2026-07-30T17:39:36.940566206Z","actor":"Sam Catlow","issue_id":"archie-core-v8x","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Implemented SDK-backed provider discovery, unified Telegram model picker, safe catalog caching, and execution composition tests"}} {"id":"int-f1b886821c69a4b52d422bc826c5c153","kind":"field_change","created_at":"2026-07-30T17:47:08.215418355Z","actor":"Sam Catlow","issue_id":"archie-core-6he","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Telegram confirmation edits now omit nil reply_markup; regression test passes"}} {"id":"int-a5d387a7885fbe49d1a2b6d910b26fcf","kind":"field_change","created_at":"2026-07-30T22:45:57.584919906Z","actor":"Sam Catlow","issue_id":"archie-core-u4v","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Built-in BWS and custom secret engines are production-wired; provider SecretRefs resolve safely across root and identity execution paths; full gate and adversarial review pass"}} +{"id":"int-84add6a34b78c40cb9697eef5a9eb109","kind":"field_change","created_at":"2026-07-30T22:48:38.349111694Z","actor":"Sam Catlow","issue_id":"archie-core-u4v","extra":{"field":"status","new_value":"closed","old_value":"open","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"}} diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 063e63d0f..300fe6808 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -53,7 +53,7 @@ {"_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-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:45:58Z","started_at":"2026-07-30T17:52:13Z","closed_at":"2026-07-30T22:45:58Z","close_reason":"Built-in BWS and custom secret engines are production-wired; provider SecretRefs resolve safely across root and identity execution paths; full gate and adversarial review pass","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_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} diff --git a/internal/infrastructure/modelcatalog/catalog.go b/internal/infrastructure/modelcatalog/catalog.go index 89c7d1c5e..fc3be3cc4 100644 --- a/internal/infrastructure/modelcatalog/catalog.go +++ b/internal/infrastructure/modelcatalog/catalog.go @@ -181,21 +181,15 @@ func usableProvider(key string, source catalogProvider, opts Options) (Provider, if len(models) == 0 { return Provider{}, false } - class, baseURL, supported := providerRuntimeDefaults(source) + class, baseURL := providerRuntimeDefaults(source) if configured { if override.Class != "" { class = override.Class - // Explicit classes may be registered by the application before - // runtime construction, so configuration is authoritative here. - supported = true } if override.BaseURL != "" { baseURL = override.BaseURL } } - if !supported { - return Provider{}, false - } name := strings.TrimSpace(source.Name) if name == "" { name = displayName(id) @@ -206,9 +200,12 @@ func usableProvider(key string, source catalogProvider, opts Options) (Provider, }, true } -func providerRuntimeDefaults(source catalogProvider) (class, baseURL string, supported bool) { - class, supported = runtime.NPMClassMapping[source.NPM] - return class, source.API, supported +func providerRuntimeDefaults(source catalogProvider) (class, baseURL string) { + class = "openai-compatible" + if mapped, ok := runtime.NPMClassMapping[source.NPM]; ok { + class = mapped + } + return class, source.API } func firstSetEnv(names []string, getenv func(string) string) string { diff --git a/internal/infrastructure/modelcatalog/catalog_test.go b/internal/infrastructure/modelcatalog/catalog_test.go index 08626c829..fa1d6e333 100644 --- a/internal/infrastructure/modelcatalog/catalog_test.go +++ b/internal/infrastructure/modelcatalog/catalog_test.go @@ -209,7 +209,7 @@ func TestLoadMapsGoogleCatalogProviderToSDKGeminiClass(t *testing.T) { } } -func TestLoadExcludesProviderWithoutSupportedSDKClass(t *testing.T) { +func TestLoadUsesSDKOpenAICompatibleFallbackForUnknownPackage(t *testing.T) { const body = `{ "native-only": { "id":"native-only", @@ -225,7 +225,7 @@ func TestLoadExcludesProviderWithoutSupportedSDKClass(t *testing.T) { if err != nil { t.Fatal(err) } - if len(got.Providers) != 0 { - t.Fatalf("providers = %#v, want unsupported provider excluded", got.Providers) + if len(got.Providers) != 1 || got.Providers[0].Class != "openai-compatible" { + t.Fatalf("providers = %#v, want SDK openai-compatible fallback", got.Providers) } }