fix(channels): converge on runtime per-channel files + live status in admin - #25
Merged
Merged
Conversation
… admin Companion to CleanSlice/runtime#7 (telegram restart recovery). The API read the legacy data/channels.json while the runtime long since moved to data/channels/<type>.json — chat-configured bots were invisible in the admin Channels tab and to deploy-time env injection, and a panel-then-chat history served the stale panel token. - AgentChannelGateway reads data/channels/telegram.json (read-only fallback to the frozen legacy file for pre-convergence agents; a groups-only per-channel file still defers to legacy) and merges the runtime-written data/channels/status.json into GET /agents/:id/channels. - PUT writes per-channel files via read-modify-write preserving the runtime-owned group registry; channels omitted from the exhaustive list get {removed: true} tombstones so stale pod env vars can't resurrect them. - AgentChannelDto gains connected / statusReason / statusUpdatedAt (null = unknown); SDK clients regenerated for admin and app. - Admin Channels tab: live Connected/Disconnected(+reason)/Unknown badge, storage copy corrected (was still describing data/channels.json). - buildAgentEnv spec: tombstoned channel injects no TELEGRAM_* env vars. - specs/003-telegram-restart-recovery/: spec-kit artifacts (spec, research, plan, contracts, tasks with status). Version: 0.3.30 → 0.3.31 (release-platform tags v0.3.31 on merge). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…recovery # Conflicts: # .specify/feature.json
Auto-merge combined the branch's channel-status fields with main's usage overview endpoint inside generated files — regenerate from the merged swagger so the artifacts match the generator output exactly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Second half of the Telegram restart-recovery fix (runtime side: CleanSlice/runtime#7). The API read/wrote the legacy
data/channels.jsonwhile the runtime moved to per-channeldata/channels/<type>.json:Full root cause and decisions:
specs/003-telegram-restart-recovery/(spec, research, contracts — included in this PR).Changes
API (
agentChannelslice)GET /agents/:id/channels: readsdata/channels/telegram.json, falls back read-only to the frozen legacy file for pre-convergence agents (a groups-only per-channel file still defers to legacy — env/panel-configured bots keep working), merges runtime-writtendata/channels/status.json→connected/statusReason/statusUpdatedAt(null= unknown).PUT /agents/:id/channels: writes per-channel files via read-modify-write preserving the runtime-ownedgroups; omitted channels get{removed: true}tombstones (never deletes — stale pod env vars must not resurrect them). Legacy file is never written again.buildAgentEnv: tombstoned channel → noTELEGRAM_*env injection (new spec).Admin
data/channels.json+ wrong restart semantics).SDK: regenerated for
adminandappfrom the updated swagger.Version: 0.3.30 → 0.3.31 — release-platform tags
v0.3.31on merge so this reaches prod.Testing
apiJest: 132 pass (was 118) — new: per-channel read, legacy fallback, tombstone-beats-legacy, groups-only-defers, status merge (connected: nullwithout status), PUT preserve-groups/tombstone/no-op, env-injection exclusion.tsc --noEmitclean.specs/003-telegram-restart-recovery/quickstart.mdscenarios 1–5.Rollout
Merge after CleanSlice/runtime#7 — agents run
ghcr.io/cleanslice/runtime:latestwithimagePullPolicy: Always, so the runtime half is live for an agent as soon as it restarts on the new image; already-broken agents heal on their next restart with zero manual steps.🤖 Generated with Claude Code