fix: commands respect selected environment
Backend: AgentRegistryService gains findByApplicationAndEnvironment() and environment-aware addGroupCommandWithReplies() overload. AgentCommandController and ApplicationConfigController accept optional environment query parameter. When set, commands only target agents in that environment. Backward compatible — null means all environments. Frontend: All command mutations (config update, route control, traced processors, tap config, route recording) now pass selectedEnv to the backend via query parameter. Prevents cross-environment command leakage — e.g., updating config for prod no longer pushes to dev agents. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
import type { Column } from '@cameleer/design-system';
|
||||
import { useApplicationConfig, useUpdateApplicationConfig } from '../../api/queries/commands';
|
||||
import type { ApplicationConfig, TapDefinition, ConfigUpdateResponse } from '../../api/queries/commands';
|
||||
import { useEnvironmentStore } from '../../api/environment-store';
|
||||
import { useCatalog } from '../../api/queries/catalog';
|
||||
import type { CatalogApp, CatalogRoute } from '../../api/queries/catalog';
|
||||
import { applyTracedProcessorUpdate, applyRouteRecordingUpdate } from '../../utils/config-draft-utils';
|
||||
@@ -75,6 +76,7 @@ export default function AppConfigDetailPage() {
|
||||
const { appId } = useParams<{ appId: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const selectedEnv = useEnvironmentStore((s) => s.environment);
|
||||
const { data: config, isLoading } = useApplicationConfig(appId);
|
||||
const updateConfig = useUpdateApplicationConfig();
|
||||
const { data: catalog } = useCatalog();
|
||||
@@ -147,7 +149,7 @@ export default function AppConfigDetailPage() {
|
||||
tracedProcessors: tracedDraft,
|
||||
routeRecording: routeRecordingDraft,
|
||||
} as ApplicationConfig;
|
||||
updateConfig.mutate(updated, {
|
||||
updateConfig.mutate({ config: updated, environment: selectedEnv }, {
|
||||
onSuccess: (saved: ConfigUpdateResponse) => {
|
||||
setEditing(false);
|
||||
if (saved.pushResult.success) {
|
||||
|
||||
Reference in New Issue
Block a user