refactor: centralize command specs and dynamic help text for Telegram

This commit is contained in:
sam committed 2026-07-27 05:34:46 +10:00
1 parent 19a6311f6c
commit 3cab289b41
5 files changed
+103 -21

No files matched your search

+4
View File
@@ -145,3 +145,7 @@
{"id":"int-1b6bdffe51700db83938f5128b005a97","kind":"field_change","created_at":"2026-07-26T18:57:43.797683721Z","actor":"Sam Catlow","issue_id":"archie-core-abg.16.32","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Implemented via go-telegram/bot v1.22.0 rich messages. gateway.LLMStreamResponder + Router.RouteStream provide the streaming seam (degrades to Route when unset); telegram draft.go streams deltas through sendRichMessageDraft throttled to 700ms; main.go derives blocking and streaming responders from one shared turn impl using runtime.ChatStream. Also removed the markdownToHTML converter from the prior commit -- v1.22 takes Markdown natively and supports tables, so the conversion was unnecessary. 4 RouteStream tests; full suite + golangci-lint clean."}}
{"id":"int-932a44040e5dc8c24f4212f377b16115","kind":"field_change","created_at":"2026-07-26T19:15:22.216249366Z","actor":"Sam Catlow","issue_id":"archie-core-abg.16.33","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Shipped in cec0f3e. 16.33: chat.telegram.allowed_user_ids plumbed through config; empty list now DENIES (was: allowed everyone); matches sender from.id not chat id so groups cannot inherit access; rejections logged with sender id; startup warns on empty list. Old TestIsChatAllowed asserted the vulnerable fail-open behaviour and was replaced with fail-closed tests. Sam's id 1312197967 added to carina's config.toml before push. 16.34: SetMyCommands publishes the command list Router actually handles; non-fatal on failure."}}
{"id":"int-51ec484ce6786e942b4127275b3fac4e","kind":"field_change","created_at":"2026-07-26T19:15:22.402251424Z","actor":"Sam Catlow","issue_id":"archie-core-abg.16.34","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"Shipped in cec0f3e. 16.33: chat.telegram.allowed_user_ids plumbed through config; empty list now DENIES (was: allowed everyone); matches sender from.id not chat id so groups cannot inherit access; rejections logged with sender id; startup warns on empty list. Old TestIsChatAllowed asserted the vulnerable fail-open behaviour and was replaced with fail-closed tests. Sam's id 1312197967 added to carina's config.toml before push. 16.34: SetMyCommands publishes the command list Router actually handles; non-fatal on failure."}}
{"id":"int-b44a2378b0927cc61e4d22e5bb092014","kind":"field_change","created_at":"2026-07-26T19:21:59.711877413Z","actor":"Sam Catlow","issue_id":"archie-core-abg.16.35","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shipped. Start is now a supervisor loop; /restart hands off via buffered channel (handler runs on the bot being stopped, so inline teardown would deadlock); duplicate requests dropped; failed reload keeps previous settings so a bad edit cannot permanently kill chat; admin-only by construction via the allowlist. main.go Reload re-reads config for token+allowlist. 2 tests."}}
{"id":"int-992125ccd2337e4407963a7e70651acb","kind":"field_change","created_at":"2026-07-26T19:26:24.561475744Z","actor":"Sam Catlow","issue_id":"archie-core-abg.16.35","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shipped in e600cfa. Temporarily reopened after seeing a Telegram transcript where /restart fell through to the LLM, then Sam clarified that transcript predates deployment; no regression evidence."}}
{"id":"int-6d6e840984054dec54aee42bb99042a5","kind":"field_change","created_at":"2026-07-26T19:29:37.633205149Z","actor":"Sam Catlow","issue_id":"archie-core-abg.17.43","extra":{"field":"status","new_value":"open","old_value":"in_progress"}}
{"id":"int-e370a7bbd16c6f091d318dc5520481ef","kind":"field_change","created_at":"2026-07-26T19:29:37.633258328Z","actor":"Sam Catlow","issue_id":"archie-core-abg.17.43","extra":{"field":"assignee","new_value":"","old_value":"Sam Catlow"}}
+6 -3
View File
@@ -53,8 +53,11 @@
{"_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":"open","priority":0,"issue_type":"epic","owner":"sam@catlow.tech","created_at":"2026-07-25T14:02:22Z","created_by":"Sam Catlow","updated_at":"2026-07-25T14:02:22Z","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-abg.17.43","title":"Wire MCP tool servers for the chat agent, sandboxed","description":"The chat agent has only memory_edit and skill_activate, so it cannot act on the codebase. cfg.Tools.MCPServers + the stdio transport are the designed extension point (configuredMCPProvider in cmd/archied/main.go already builds providers from config). Sam's requirement is to expose specific capabilities narrowly rather than granting host access, and he has a Firecracker sandbox POC at /work/clones/gorev (firecracker/sandbox) intended for exactly this.","acceptance_criteria":"MCP servers configurable per deployment. Tool execution runs inside the Firecracker sandbox rather than on the host. Chat agent can make a code change end to end. Depends on the sender allowlist (16.33, done) being in place first.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:15:34Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:15:34Z","dependencies":[{"issue_id":"archie-core-abg.17.43","depends_on_id":"archie-core-abg.17","type":"parent-child","created_at":"2026-07-27T05:15:34Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.35","title":"Telegram: /restart command to reload gateway config","description":"Operator escape hatch: restart the chat gateway from chat to pick up config changes (notably the allowlist) or recover from a wedged adapter, without shell access to the host.","acceptance_criteria":"/restart is admin-only (allowlisted sender). Re-reads config and restarts the gateway. Replies with the outcome. In-flight agent tasks are not killed.","notes":"Sam also wants /restore (revert last change) alongside /restart; both are gateway-scoped operator escape hatches. Constraint from Sam: must NOT kill in-flight agent tasks, so prefer a gateway-scoped restart (Stop, re-read config, Start the telegram gateway) over exiting the process. Note the container restart policy is unless-stopped, so a process exit WOULD come back, but it would nuke running tasks. Must be admin-only - gate on the new chat.telegram.allowed_user_ids.","status":"in_progress","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:11:42Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:20:06Z","started_at":"2026-07-26T19:20:06Z","dependencies":[{"issue_id":"archie-core-abg.16.35","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:11:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.17.44","title":"Firecracker substrate for sandboxed MCP code tools","description":"Replace the interim daemon-container code MCP execution path with a real Firecracker boundary. Extend or extract the gorev POC to support a long-lived bidirectional guest process, explicit workspace import/export, per-turn filesystem checkpoints, lifecycle/health, and concurrent-instance-safe networking. Then adapt the MCP provider launcher without changing the chat/tool contract.","acceptance_criteria":"MCP server code and tool execution occur inside a Firecracker VM; the guest cannot access daemon-host files outside the imported workspace; changes export deterministically; pre-change checkpoints support /restore; lifecycle cleanup survives crashes; tests prove the configured provider cannot silently fall back to host execution.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:31:13Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:31:13Z","dependencies":[{"issue_id":"archie-core-abg.17.44","depends_on_id":"archie-core-abg.17","type":"parent-child","created_at":"2026-07-27T05:31:13Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.38","title":"Telegram: interactive /model selector","description":"When /model is invoked without an argument, present Telegram-native interactive controls rather than only plain text usage. Use the pinned go-telegram/bot SDK inline keyboard and callback query APIs; preserve /model provider/model for typed selection and enforce the existing sender allowlist on callbacks.","acceptance_criteria":"An allowlisted user invoking /model receives an inline keyboard of configured models with the active model marked; tapping a model switches it through gateway.ModelManager, acknowledges the callback, and updates the message; unauthorized or malformed callbacks cannot switch models; empty model catalogs degrade safely.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:29:39Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:29:39Z","dependencies":[{"issue_id":"archie-core-abg.16.38","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:29:38Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.37","title":"Telegram: comprehensive truthful /help output","description":"The live /help response lists only /status and /help and still says LLM chat is not wired, despite the gateway supporting model, task, restart, and free-text chat paths. Replace the stale hardcoded copy with a complete, maintainable command guide that matches the registered menu and actual router behavior.","acceptance_criteria":"/help describes every published command with accurate usage, includes free-text chat behavior, no longer claims chat is unwired, and a regression test fails if the published command menu and help surface drift.","status":"in_progress","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:29:38Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:29:46Z","started_at":"2026-07-26T19:29:46Z","dependencies":[{"issue_id":"archie-core-abg.16.37","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:29:38Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.17.43","title":"Wire MCP tool servers for the chat agent, sandboxed","description":"The chat agent has only memory_edit and skill_activate, so it cannot act on the codebase. cfg.Tools.MCPServers + the stdio transport are the designed extension point (configuredMCPProvider in cmd/archied/main.go already builds providers from config). Sam's requirement is to expose specific capabilities narrowly rather than granting host access, and he has a Firecracker sandbox POC at /work/clones/gorev (firecracker/sandbox) intended for exactly this.","acceptance_criteria":"MCP servers are configurable per deployment and discovered into the chat agent tool loop. A narrowly scoped code MCP server runs in the daemon container against an explicitly configured workspace and can make a code change end to end. Firecracker execution remains a requirement tracked separately in archie-core-abg.17.44.","notes":"User explicitly re-scoped on 2026-07-27: implement the chat code MCP path without Firecracker for now; Sam will wire Firecracker later. This interim path must be labelled unsandboxed and constrained to the daemon container/workspace, with a narrow launcher/execution boundary so the later sandbox can replace it. Prior Firecracker substrate findings remain relevant.","status":"open","priority":1,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:15:34Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:32:29Z","started_at":"2026-07-26T19:27:33Z","dependencies":[{"issue_id":"archie-core-abg.17.43","depends_on_id":"archie-core-abg.17","type":"parent-child","created_at":"2026-07-27T05:15:34Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.35","title":"Telegram: /restart command to reload gateway config","description":"Operator escape hatch: restart the chat gateway from chat to pick up config changes (notably the allowlist) or recover from a wedged adapter, without shell access to the host.","acceptance_criteria":"/restart is admin-only (allowlisted sender). Re-reads config and restarts the gateway. Replies with the outcome. In-flight agent tasks are not killed.","notes":"Live Telegram transcript on 2026-07-27 shows /restart fell through to the LLM, which falsely replied that everything was reset. /help also omits /restart. Reopened for production-path diagnosis before /restore.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:11:42Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:26:25Z","started_at":"2026-07-26T19:20:06Z","closed_at":"2026-07-26T19:26:25Z","close_reason":"Shipped in e600cfa. Temporarily reopened after seeing a Telegram transcript where /restart fell through to the LLM, then Sam clarified that transcript predates deployment; no regression evidence.","dependencies":[{"issue_id":"archie-core-abg.16.35","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:11:42Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.34","title":"Telegram: register command menu via SetMyCommands","description":"The bot never calls SetMyCommands, so Telegram shows no command menu and the commands the Router implements (/status, /help, /models, /model, /spawn, /approve, /cancel) are undiscoverable. Asking the bot for /commands makes the LLM answer that it has none, which is wrong.","acceptance_criteria":"SetMyCommands is called at startup with the commands the Router actually handles. Failure is logged, not fatal.","status":"closed","priority":1,"issue_type":"task","owner":"sam@catlow.tech","created_at":"2026-07-26T19:11:41Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:15:22Z","closed_at":"2026-07-26T19:15:22Z","close_reason":"Shipped in cec0f3e. 16.33: chat.telegram.allowed_user_ids plumbed through config; empty list now DENIES (was: allowed everyone); matches sender from.id not chat id so groups cannot inherit access; rejections logged with sender id; startup warns on empty list. Old TestIsChatAllowed asserted the vulnerable fail-open behaviour and was replaced with fail-closed tests. Sam's id 1312197967 added to carina's config.toml before push. 16.34: SetMyCommands publishes the command list Router actually handles; non-fatal on failure.","dependencies":[{"issue_id":"archie-core-abg.16.34","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T05:11:41Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-abg.16.32","title":"Telegram: stream LLM replies via sendMessageDraft","description":"Chat replies currently block for the whole LLM turn, then arrive as one message. The typing indicator masks the wait but shows no progress. go-telegram/bot exposes SendMessageDraft (see examples/streaming_draft) and ai-sdk's runtime.ChatStream already returns core.StreamResult with a TextStream \u003c-chan string, so both halves exist -- only the gateway seam is missing, since gateway.LLMResponder is func(ctx, Message) (string, error) and cannot emit partial output.","acceptance_criteria":"Gateway exposes an optional streaming responder; Router falls back to the blocking path when unset. Telegram adapter streams deltas into a draft, then finalises with a formatted SendMessage. Draft updates are throttled to respect Telegram rate limits. Streaming failure falls back to a normal send rather than losing the reply.","status":"closed","priority":1,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T18:52:20Z","created_by":"Sam Catlow","updated_at":"2026-07-26T18:57:44Z","started_at":"2026-07-26T18:52:30Z","closed_at":"2026-07-26T18:57:44Z","close_reason":"Implemented via go-telegram/bot v1.22.0 rich messages. gateway.LLMStreamResponder + Router.RouteStream provide the streaming seam (degrades to Route when unset); telegram draft.go streams deltas through sendRichMessageDraft throttled to 700ms; main.go derives blocking and streaming responders from one shared turn impl using runtime.ChatStream. Also removed the markdownToHTML converter from the prior commit -- v1.22 takes Markdown natively and supports tables, so the conversion was unnecessary. 4 RouteStream tests; full suite + golangci-lint clean.","dependencies":[{"issue_id":"archie-core-abg.16.32","depends_on_id":"archie-core-abg.16","type":"parent-child","created_at":"2026-07-27T04:52:20Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-50z","title":"Enforce typed plugin engine architecture rule","description":"Cement the repository invariant that a plugin engine is a typed capability family with an owning registry/manager and lifecycle semantics, never a generic daemon hook. Add one canonical architecture rule referenced by both AGENTS.md and CLAUDE.md, record it in Beads memory, and add an executable architecture test that prevents drift without touching the concurrently edited secret/config packages.","acceptance_criteria":"A canonical rule defines typed domain contract, owning registry/manager, lifecycle and health expectations, narrow host access, and trust boundaries; AGENTS.md and CLAUDE.md both surface the rule through their shared source; an architecture test fails for generic plugin-hook expansion or an engine interface without a family manager; focused tests and task check pass; fresh adversarial review has no surviving findings.","notes":"Complete. Red proof: architecture test failed on missing canonical rule. Green: internal/plugin tests pass; golangci-lint ./internal/plugin reports zero issues; gofumpt diff is empty. Fresh adversarial review initially found bypassable owner checks and ambiguous trust wording; remediated with signature-linked single-owner validation, negative fixtures (metadata-only, embedded-only, unrelated/split owners, pointer and collection wrappers), and precise trusted-in-process/out-of-process/container language. Final fresh review: zero surviving findings. Full task check was attempted but is currently blocked by concurrent unrelated migrations: gateway fakeTaskCreator still implements CreateTask(context.Context,string) while interface now wants SpawnRequest, and daemon EnqueueIssue callers omit the new eighth argument. No secret/config source was edited by this issue.","status":"closed","priority":1,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T05:00:36Z","created_by":"Sam Catlow","updated_at":"2026-07-26T05:14:06Z","started_at":"2026-07-26T05:00:43Z","closed_at":"2026-07-26T05:14:06Z","close_reason":"Strict plugin-engine invariant documented in canonical architecture and shared AGENTS/CLAUDE instructions, persisted in Beads memory, mechanically enforced with adversarial negative controls, and independently reviewed with zero findings.","dependency_count":0,"dependent_count":0,"comment_count":0}
@@ -120,7 +123,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-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.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:15:34Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:15:34Z","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":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_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}
+41 -13
View File
@@ -3,24 +3,52 @@ package telegram
import (
"context"
"fmt"
"strings"
"github.com/go-telegram/bot"
"github.com/go-telegram/bot/models"
)
// gatewayCommands is the command list published to Telegram. It mirrors
// what gateway.Router actually handles: publishing a command the router
// does not implement sends the user to the LLM, which has no idea the
// command exists.
var gatewayCommands = []models.BotCommand{
{Command: "status", Description: "Show task status"},
{Command: "models", Description: "List available models"},
{Command: "model", Description: "Show or switch the active model"},
{Command: "spawn", Description: "Spawn a task from a title"},
{Command: "approve", Description: "Approve a task awaiting review"},
{Command: "cancel", Description: "Cancel a task"},
{Command: "restart", Description: "Restart the gateway and reload config"},
{Command: "help", Description: "Show available commands"},
type commandSpec struct {
Command string
Description string
Usage string
}
// gatewayCommandSpecs is the single source of truth for both Telegram's
// published command menu and /help. Keeping the discoverability surfaces
// together prevents a newly registered command from being omitted from help.
var gatewayCommandSpecs = []commandSpec{
{Command: "status", Description: "Show task counts by state", Usage: "/status"},
{Command: "models", Description: "List available models", Usage: "/models"},
{Command: "model", Description: "Show the model selector or switch directly", Usage: "/model [provider/model]"},
{Command: "spawn", Description: "Create a tracked task", Usage: "/spawn [identity=name] [repo=owner/name] [workflow=name] <title>"},
{Command: "approve", Description: "Approve and requeue a waiting task", Usage: "/approve [identity=name] <task-id>"},
{Command: "cancel", Description: "Cancel a queued or waiting task", Usage: "/cancel [identity=name] <task-id>"},
{Command: "restart", Description: "Restart the gateway and reload its config", Usage: "/restart"},
{Command: "help", Description: "Show this guide", Usage: "/help"},
}
var gatewayCommands = func() []models.BotCommand {
commands := make([]models.BotCommand, 0, len(gatewayCommandSpecs))
for _, spec := range gatewayCommandSpecs {
commands = append(commands, models.BotCommand{
Command: spec.Command,
Description: spec.Description,
})
}
return commands
}()
func gatewayHelpText() string {
var help strings.Builder
help.WriteString("🤖 **Archie Gateway**\n\n")
help.WriteString("Send a message to chat with Archie. Replies stream into Telegram as they are generated.\n\n")
help.WriteString("**Commands**\n")
for _, spec := range gatewayCommandSpecs {
fmt.Fprintf(&help, "`%s`\n%s\n\n", spec.Usage, spec.Description)
}
return strings.TrimSpace(help.String())
}
// commandScopes are the scopes the menu is published to.
+1 -5
View File
@@ -239,11 +239,7 @@ func (g *Gateway) helpHandler() bot.HandlerFunc {
if !ok {
return
}
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID,
"🤖 **Archie Gateway**\n\n"+
"/status -- Show task status\n"+
"/help -- This message\n\n"+
"Anything else: chat with the LLM (not yet wired -- coming soon).")
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID, gatewayHelpText())
}
}
@@ -2,6 +2,7 @@ package telegram
import (
"context"
"encoding/json"
"log/slog"
"net/http"
"net/http/httptest"
@@ -36,6 +37,56 @@ func TestNewStoresFields(t *testing.T) {
}
}
func TestHelpDescribesPublishedCommandsAndChat(t *testing.T) {
const allowedUserID = int64(42)
var sentText string
api := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := r.ParseMultipartForm(1 << 20); err != nil {
t.Errorf("parse Telegram request: %v", err)
} else {
var rich models.InputRichMessage
if err := json.Unmarshal([]byte(r.FormValue("rich_message")), &rich); err != nil {
t.Errorf("decode Telegram rich_message: %v", err)
} else {
sentText = rich.Markdown
}
}
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"ok":true,"result":{"message_id":1,"date":1,"chat":{"id":7,"type":"private"}}}`))
}))
defer api.Close()
b, err := bot.New(
"1:test",
bot.WithServerURL(api.URL),
bot.WithSkipGetMe(),
bot.WithNotAsyncHandlers(),
)
if err != nil {
t.Fatalf("new test bot: %v", err)
}
g := New("1:test", "", "", []int64{allowedUserID}, slog.Default())
g.helpHandler()(context.Background(), b, &models.Update{
Message: &models.Message{
From: &models.User{ID: allowedUserID},
Chat: models.Chat{ID: 7, Type: models.ChatTypePrivate},
},
})
for _, command := range gatewayCommands {
if !strings.Contains(sentText, "/"+command.Command) {
t.Errorf("help text does not describe published /%s command:\n%s", command.Command, sentText)
}
}
if strings.Contains(sentText, "not yet wired") {
t.Errorf("help text still claims working LLM chat is not wired:\n%s", sentText)
}
if !strings.Contains(strings.ToLower(sentText), "chat") {
t.Errorf("help text does not describe free-text chat:\n%s", sentText)
}
}
// The allowlist must fail closed: a bot handle is public, so an unset
// allowlist has to deny rather than admit everyone.
func TestSenderAllowlistFailsClosed(t *testing.T) {