fix(gateway): remove the web /restart command that no process could serve

This commit is contained in:
sam committed 2026-10-11 04:11:37 +11:00
1 parent 64979ef650
commit eba2e8e53a
7 files changed
+4 -24

No files matched your search

-1
View File
@@ -15,7 +15,6 @@ type ChatSnapshot struct {
// frontends display it rather than stamping their own build, so a
// partially upgraded deployment cannot report itself as matched.
Version string
RestartAvailable bool
CancellationAvailable bool
// VoiceAvailable reports that a voice clip is transcribed into the turn.
VoiceAvailable bool
+1 -2
View File
@@ -10,7 +10,7 @@ var localCommands = []string{
"/new", "/reset", "/topic", "/retry", "/undo",
"/title", "/branch", "/fork", "/compress", "/compact",
"/whoami", "/profile", "/sessions", "/resume", "/delete", "/agents",
"/personality", "/help", "/version", "/update", "/restart",
"/personality", "/help", "/version", "/update",
}
// CommandSpec describes a local command for adapter-provided discovery.
@@ -49,7 +49,6 @@ var localCommandSpecs = []CommandSpec{
{Command: "/help", Description: "See what Archie can do", Usage: "/help"},
{Command: "/version", Description: "Show installed Archie versions", Usage: "/version"},
{Command: "/update", Description: "Check for Archie updates", Usage: "/update"},
{Command: "/restart", Description: "Reload the chat adapter", Usage: "/restart"},
}
// LocalCommands returns the command names Route answers from local state.
+1 -1
View File
@@ -44,7 +44,7 @@ func (a *LocalChatAdapter) Snapshot(ctx context.Context) (ChatSnapshot, error) {
if err != nil {
return ChatSnapshot{}, err
}
s := ChatSnapshot{Sessions: sessions, Models: []string{}, Providers: []string{}, Personas: []string{}, ModelsByProvider: map[string][]string{}, ActivePersonas: map[string]string{}, RestartAvailable: a.Router.Restart != nil, CancellationAvailable: a.Turns != nil, PersonasAvailable: a.Personas != nil, VoiceAvailable: a.VoiceAvailable, Version: a.Router.Version}
s := ChatSnapshot{Sessions: sessions, Models: []string{}, Providers: []string{}, Personas: []string{}, ModelsByProvider: map[string][]string{}, ActivePersonas: map[string]string{}, CancellationAvailable: a.Turns != nil, PersonasAvailable: a.Personas != nil, VoiceAvailable: a.VoiceAvailable, Version: a.Router.Version}
if a.Models != nil {
s.Models = slices.Clone(a.Models.Models())
if manager, ok := a.Models.(OrgModelManager); ok {
-16
View File
@@ -158,9 +158,6 @@ type Router struct {
Version string
// Updates handles the shared /update command. Nil means unavailable.
Updates UpdateService
// Restart requests a scoped chat-adapter reload. It deliberately does not
// restart the daemon; Telegram's /restart has this same boundary.
Restart func(context.Context) error
// Sessions persists session metadata and conversation history.
// When set, session lifecycle commands (/new, /branch, /title,
// /undo, /retry, /compress) are available. When nil, those
@@ -386,8 +383,6 @@ func (r *Router) dispatchLocalMisc(ctx context.Context, msg messaging.Message, p
return r.handleVersion(), true, nil
case "/update":
return r.handleUpdateCheck(ctx), true, nil
case "/restart":
return r.handleRestartAdapter(ctx), true, nil
}
return r.dispatchSessionCommand(ctx, msg, platform, cmd, rest)
}
@@ -412,17 +407,6 @@ func (r *Router) handleUpdateCheck(ctx context.Context) string {
return releaseupdate.FormatSnapshot(snapshot)
}
// handleRestartAdapter reloads the chat adapter.
func (r *Router) handleRestartAdapter(ctx context.Context) string {
if r.Restart == nil {
return "Chat adapter restart is not configured."
}
if err := r.Restart(ctx); err != nil {
return fmt.Sprintf("Could not restart the chat adapter: %v", err)
}
return "Chat adapter reload requested."
}
// dispatchSessionCommand handles the session-lifecycle command group
// (/new, /topic, /retry, /undo, /title, /branch, /compress and their
// aliases). Split out from dispatchLocal to keep cyclomatic complexity
-1
View File
@@ -49,7 +49,6 @@ var slashAdminOnly = map[string]bool{
"/personality": true,
"/settings": true,
"/update": true,
"/restart": true,
}
// SlashAccessPolicy decides which slash commands a sender may run. Deny by
+2 -2
View File
@@ -257,7 +257,7 @@ func snapshotProto(v messaging.ChatSnapshot) *pb.SnapshotResponse {
for k, list := range v.ModelsByProvider {
groups[k] = &pb.StringList{Values: list}
}
return &pb.SnapshotResponse{Sessions: mapValues(v.Sessions, sessionProto), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, RestartAvailable: v.RestartAvailable, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
return &pb.SnapshotResponse{Sessions: mapValues(v.Sessions, sessionProto), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
}
func snapshotValue(v *pb.SnapshotResponse) messaging.ChatSnapshot {
@@ -265,5 +265,5 @@ func snapshotValue(v *pb.SnapshotResponse) messaging.ChatSnapshot {
for k, list := range v.ModelsByProvider {
groups[k] = list.GetValues()
}
return messaging.ChatSnapshot{Sessions: mapValues(v.Sessions, sessionValue), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, RestartAvailable: v.RestartAvailable, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
return messaging.ChatSnapshot{Sessions: mapValues(v.Sessions, sessionValue), Models: v.Models, ModelsByProvider: groups, Providers: v.Providers, ActiveModel: v.ActiveModel, ActiveProvider: v.ActiveProvider, Personas: v.Personas, ActivePersonas: v.ActivePersonas, CancellationAvailable: v.CancellationAvailable, PersonasAvailable: v.PersonasAvailable, VoiceAvailable: v.VoiceAvailable, Version: v.Version}
}
-1
View File
@@ -181,7 +181,6 @@ func (s *Server) handleChatSessions(w http.ResponseWriter, r *http.Request) {
"voice_available": snapshot.VoiceAvailable,
"active_personas": active,
"commands": chatCommandSpecs(chat),
"restart_available": snapshot.RestartAvailable,
})
}