feat(telegram): report installed component versions

This commit is contained in:
sam committed 2026-07-27 12:53:59 +10:00
1 parent 647537c00a
commit c1c3a973c6
6 files changed
+42 -2

No files matched your search

+1
View File
@@ -151,3 +151,4 @@
{"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"}}
{"id":"int-98886b5c0eed086effa6684ec75bbb48","kind":"field_change","created_at":"2026-07-26T20:33:10.385698708Z","actor":"Sam Catlow","issue_id":"archie-core-3ro","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shipped locally: Telegram calls the assistant Archie rather than Gateway; restart copy is Archie-facing; new sessions receive and preserve an Archie baseline identity; model selector shows provider in the header and provider-free model names; successful selections acknowledge the chosen model; model/provider callbacks use stable tokens so stale keyboards cannot select a different option. task check and lint pass; fresh review clean."}}
{"id":"int-09fd2039fe043eb9110fa9bdb678b3e9","kind":"field_change","created_at":"2026-07-27T01:44:06.19963429Z","actor":"Sam Catlow","issue_id":"archie-core-n55","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shipped locally: /models removed from Telegram menu, help, and Router; /model is the sole model selector/direct-switch command; /help menu text is now 'See what Archie can do'; command docs updated. task check passes and fresh review reports no findings."}}
{"id":"int-30b8e857c7ac14ce8bfbac49283d7853","kind":"field_change","created_at":"2026-07-27T02:53:55.882577468Z","actor":"Sam Catlow","issue_id":"archie-core-rqp.1","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Shipped: authorized /version reports installed gateway and runtime build versions from the composition root; menu/help parity covered; task check and scoped lint clean; fresh review found no blocking issues."}}
+2 -1
View File
@@ -127,8 +127,9 @@
{"_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-rqp.1","title":"Telegram: report installed gateway and runtime versions","description":"Add an authorized /version command as the installed-version prerequisite for component-aware /update. Telegram remains presentation-only; the composition root supplies installed component versions.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T02:50:47Z","created_by":"Sam Catlow","updated_at":"2026-07-27T02:53:56Z","started_at":"2026-07-27T02:50:48Z","closed_at":"2026-07-27T02:53:56Z","close_reason":"Shipped: authorized /version reports installed gateway and runtime build versions from the composition root; menu/help parity covered; task check and scoped lint clean; fresh review found no blocking issues.","dependencies":[{"issue_id":"archie-core-rqp.1","depends_on_id":"archie-core-rqp","type":"parent-child","created_at":"2026-07-27T12:50:46Z","created_by":"Sam Catlow","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-n55","title":"Simplify Telegram model command surface","description":"Remove the redundant /models command from Telegram's published and executable command surface; retain /model selector. Make /help menu copy useful rather than self-referential.","status":"closed","priority":2,"issue_type":"task","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-27T01:41:43Z","created_by":"Sam Catlow","updated_at":"2026-07-27T01:44:06Z","started_at":"2026-07-27T01:41:50Z","closed_at":"2026-07-27T01:44:06Z","close_reason":"Shipped locally: /models removed from Telegram menu, help, and Router; /model is the sole model selector/direct-switch command; /help menu text is now 'See what Archie can do'; command docs updated. task check passes and fresh review reports no findings.","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-rqp","title":"Telegram: component-aware /update with approve or defer","description":"Add an /update control flow that checks for available releases, presents separate archied gateway and archie-agent runtime versions/changelog sections, and lets an authorized user approve or defer. Keep discovery and execution behind typed interfaces so Docker/Watchtower, package-manager, and other installations can supply their own updater without the Telegram gateway assuming a deployment mechanism.","acceptance_criteria":"/update reports whether gateway and runtime updates are available, with separate version and changelog sections and explicit no-change wording. Telegram provides Approve and Defer actions restricted to authorized users. Deferral is persisted and suppresses repeated prompts according to an explicit policy. Approval calls a typed installation updater and reports progress/failure without claiming success early. No Watchtower-only or Docker-only behavior exists in the gateway package. Commands, menu, help, callback authorization, concurrency, persistence, and failure paths are tested.","status":"open","priority":2,"issue_type":"feature","owner":"sam@catlow.tech","created_at":"2026-07-26T19:47:21Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:47:21Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-rqp","title":"Telegram: component-aware /update with approve or defer","description":"Add an /update control flow that checks for available releases, presents separate archied gateway and archie-agent runtime versions/changelog sections, and lets an authorized user approve or defer. Keep discovery and execution behind typed interfaces so Docker/Watchtower, package-manager, and other installations can supply their own updater without the Telegram gateway assuming a deployment mechanism.","acceptance_criteria":"/update reports whether gateway and runtime updates are available, with separate version and changelog sections and explicit no-change wording. Telegram provides Approve and Defer actions restricted to authorized users. Deferral is persisted and suppresses repeated prompts according to an explicit policy. Approval calls a typed installation updater and reports progress/failure without claiming success early. No Watchtower-only or Docker-only behavior exists in the gateway package. Commands, menu, help, callback authorization, concurrency, persistence, and failure paths are tested.","status":"in_progress","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:47:21Z","created_by":"Sam Catlow","updated_at":"2026-07-27T02:49:27Z","started_at":"2026-07-27T02:49:27Z","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"archie-core-b8t","title":"Telegram: announce newly installed Archie releases","description":"When archied starts after an installed release upgrade, notify authorized Telegram users once with an exact component-aware rundown from CHANGELOG.md. Present archied as THE GATEWAY and archie-agent as THE RUNTIME, explicitly saying when either component has no changes. Persist announced versions per recipient so ordinary restarts do not repeat notifications.","acceptance_criteria":"Repository has a maintained component-aware CHANGELOG.md. On an installed version advance, each configured authorized Telegram user receives one concise message with separate THE GATEWAY and THE RUNTIME sections and explicit no-change wording where applicable. Announced component versions are persisted and duplicate restarts do not repeat. First-run and development builds have explicit non-spam behavior. Parsing, version transition, persistence failure, and delivery failure paths are tested.","notes":"Component history decision: CHANGELOG.archied.md for gateway/control plane and CHANGELOG.archie.md for agent runtime, with root CHANGELOG.md as index. Installed/update messages render both sources and explicitly state when a component has no changes.","status":"in_progress","priority":2,"issue_type":"feature","assignee":"Sam Catlow","owner":"sam@catlow.tech","created_at":"2026-07-26T19:39:18Z","created_by":"Sam Catlow","updated_at":"2026-07-26T19:48:38Z","started_at":"2026-07-26T19:46:23Z","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}
+3
View File
@@ -292,6 +292,9 @@ func run() int {
"Add your Telegram user id to chat.telegram.allowed_user_ids to enable the bot.")
}
tg := telegram.New(tgToken, "", "", cfg.Chat.Telegram.AllowedUserIDs, log)
tg.Version = func() string {
return fmt.Sprintf("Archie\nGateway: %s\nRuntime: %s", gatewayVersion, runtimeVersion)
}
releaseAnnouncements := &releaseannounce.Announcer{
StatePath: releaseAnnouncementStatePath(cfg.WorkDir, cfg.BotUser),
Components: []releaseannounce.Component{
+2 -1
View File
@@ -20,6 +20,7 @@ type commandSpec struct {
// 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: "version", Description: "Show installed Archie versions", Usage: "/version"},
{Command: "provider", Description: "Choose the provider used for chat", Usage: "/provider"},
{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>"},
@@ -29,7 +30,7 @@ var gatewayCommandSpecs = []commandSpec{
{Command: "help", Description: "See what Archie can do", Usage: "/help"},
}
var telegramOnlyCommands = []string{"provider", "restart", "help"}
var telegramOnlyCommands = []string{"provider", "restart", "help", "version"}
var gatewayCommands = func() []models.BotCommand {
commands := make([]models.BotCommand, 0, len(gatewayCommandSpecs))
+18
View File
@@ -41,6 +41,9 @@ type Gateway struct {
// It is supplied by the composition root because version, changelog, and
// persistence paths are deployment concerns.
ReleaseAnnouncements ReleaseAnnouncer
// Version reports installed component versions. The composition root owns
// build metadata; Telegram only renders it for authorized users.
Version func() string
// restartCh carries /restart requests from a bot handler to the
// supervisor loop in Start. Buffered so a handler never blocks.
@@ -154,6 +157,7 @@ func (g *Gateway) launch(ctx context.Context, router *gateway.Router) (*bot.Bot,
// Gateway-local commands: handled directly, no LLM.
b.RegisterHandler(bot.HandlerTypeMessageText, "/status", bot.MatchTypeExact, g.statusHandler(router))
b.RegisterHandler(bot.HandlerTypeMessageText, "/version", bot.MatchTypeExact, g.versionHandler())
b.RegisterHandler(bot.HandlerTypeMessageText, "/start", bot.MatchTypeExact, g.startHandler())
b.RegisterHandler(bot.HandlerTypeMessageText, "/help", bot.MatchTypeExact, g.helpHandler())
b.RegisterHandler(bot.HandlerTypeMessageText, "/restart", bot.MatchTypeExact, g.restartHandler())
@@ -276,6 +280,20 @@ func (g *Gateway) statusHandler(router *gateway.Router) bot.HandlerFunc {
}
}
func (g *Gateway) versionHandler() bot.HandlerFunc {
return func(ctx context.Context, b *bot.Bot, update *models.Update) {
msg, ok := g.authorizedMessage(ctx, b, update)
if !ok {
return
}
if g.Version == nil {
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID, "Version information is not configured.")
return
}
g.sendMessage(ctx, b, msg.Chat.ID, msg.MessageThreadID, g.Version())
}
}
func (g *Gateway) helpHandler() bot.HandlerFunc {
return func(ctx context.Context, b *bot.Bot, update *models.Update) {
msg, ok := g.authorizedMessage(ctx, b, update)
@@ -140,6 +140,22 @@ func TestStartHasDeterministicGatewayResponse(t *testing.T) {
}
}
func TestVersionReportsBothComponents(t *testing.T) {
const allowedUserID = int64(42)
g := New("1:test", "", "", []int64{allowedUserID}, slog.Default())
g.Version = func() string { return "Archie\nGateway: v1.2.3\nRuntime: v4.5.6" }
b, requests := newTelegramTestBot(t)
g.versionHandler()(context.Background(), b, &models.Update{Message: &models.Message{
From: &models.User{ID: allowedUserID},
Chat: models.Chat{ID: 7, Type: models.ChatTypePrivate},
}})
if len(*requests) != 1 || !strings.Contains((*requests)[0].form["rich_message"], "Gateway: v1.2.3") || !strings.Contains((*requests)[0].form["rich_message"], "Runtime: v4.5.6") {
t.Fatalf("version reply = %#v", *requests)
}
}
func TestPublishedCommandsMatchExecutableCommandSurface(t *testing.T) {
executable := make(map[string]bool)
for _, command := range gateway.LocalCommands() {