feat(app): CMP-12 review agent drafts before deployment - #63
Conversation
9132f16 to
98a923e
Compare
98a923e to
e323208
Compare
There was a problem hiding this comment.
3 issues found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/app/components/agent-builder/team-agent-detail.tsx">
<violation number="1" location="apps/app/components/agent-builder/team-agent-detail.tsx:343">
P2: After deployment, the detail page's Activity tab still shows the pre-deployment audit list and count until a reload because this handler does not invalidate `agents.activity`; invalidating `trpc.agents.activity.pathKey()` with the other agent queries keeps the new deployment event visible.</violation>
<violation number="2" location="apps/app/components/agent-builder/team-agent-detail.tsx:386">
P2: A draft version returned as `reviewVersion` can be clicked for deployment even though the API rejects `DRAFT` versions with “Only a validated agent version can be deployed”; gate this button on the API-accepted version statuses so users do not hit a guaranteed error.</violation>
<violation number="3" location="apps/app/components/agent-builder/team-agent-detail.tsx:543">
P2: The Overview can say “No external actions” when the manifest contains an action without a `summary`, because this mapping drops that entry; falling back to its action type (or a generic configured-action label) preserves an accurate review.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| </Button> | ||
| ) : null} | ||
| <Button | ||
| disabled={!version || deployAction.pending} |
There was a problem hiding this comment.
P2: A draft version returned as reviewVersion can be clicked for deployment even though the API rejects DRAFT versions with “Only a validated agent version can be deployed”; gate this button on the API-accepted version statuses so users do not hit a guaranteed error.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/components/agent-builder/team-agent-detail.tsx, line 386:
<comment>A draft version returned as `reviewVersion` can be clicked for deployment even though the API rejects `DRAFT` versions with “Only a validated agent version can be deployed”; gate this button on the API-accepted version statuses so users do not hit a guaranteed error.</comment>
<file context>
@@ -310,6 +325,82 @@ export function TeamAgentDetail({
+ </Button>
+ ) : null}
+ <Button
+ disabled={!version || deployAction.pending}
+ aria-busy={deployAction.pending}
+ onClick={() => deployAction.run()}
</file context>
| disabled={!version || deployAction.pending} | |
| disabled={ | |
| !version || | |
| (version.status !== "READY" && version.status !== "DEPLOYED") || | |
| deployAction.pending | |
| } |
| ? manifest.actions.map(recordOf) | ||
| : []; | ||
| const actionSummaries = actions | ||
| .map((action) => textOf(action.summary, "")) |
There was a problem hiding this comment.
P2: The Overview can say “No external actions” when the manifest contains an action without a summary, because this mapping drops that entry; falling back to its action type (or a generic configured-action label) preserves an accurate review.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/components/agent-builder/team-agent-detail.tsx, line 543:
<comment>The Overview can say “No external actions” when the manifest contains an action without a `summary`, because this mapping drops that entry; falling back to its action type (or a generic configured-action label) preserves an accurate review.</comment>
<file context>
@@ -435,18 +526,33 @@ function TabButton({
+ ? manifest.actions.map(recordOf)
+ : [];
+ const actionSummaries = actions
+ .map((action) => textOf(action.summary, ""))
+ .filter(Boolean);
+ const access = Array.isArray(manifest.access)
</file context>
| .map((action) => textOf(action.summary, "")) | |
| .map((action) => | |
| textOf(action.summary, textOf(action.type, "Configured action")), | |
| ) |
| await Promise.all([ | ||
| queryClient.invalidateQueries({ | ||
| queryKey: trpc.agents.byId.pathKey(), | ||
| }), | ||
| queryClient.invalidateQueries({ | ||
| queryKey: trpc.agents.list.pathKey(), | ||
| }), | ||
| queryClient.invalidateQueries({ | ||
| queryKey: trpc.conversations.builderById.pathKey(), | ||
| }), | ||
| queryClient.invalidateQueries({ | ||
| queryKey: trpc.conversations.builderList.pathKey(), | ||
| }), | ||
| ]); |
There was a problem hiding this comment.
P2: After deployment, the detail page's Activity tab still shows the pre-deployment audit list and count until a reload because this handler does not invalidate agents.activity; invalidating trpc.agents.activity.pathKey() with the other agent queries keeps the new deployment event visible.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/components/agent-builder/team-agent-detail.tsx, line 343:
<comment>After deployment, the detail page's Activity tab still shows the pre-deployment audit list and count until a reload because this handler does not invalidate `agents.activity`; invalidating `trpc.agents.activity.pathKey()` with the other agent queries keeps the new deployment event visible.</comment>
<file context>
@@ -310,6 +325,82 @@ export function TeamAgentDetail({
+ const deploy = useMutation(
+ trpc.agents.deploy.mutationOptions({
+ onSuccess: async () => {
+ await Promise.all([
+ queryClient.invalidateQueries({
+ queryKey: trpc.agents.byId.pathKey(),
</file context>
| await Promise.all([ | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.agents.byId.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.agents.list.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.conversations.builderById.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.conversations.builderList.pathKey(), | |
| }), | |
| ]); | |
| await Promise.all([ | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.agents.byId.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.agents.list.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.agents.activity.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.conversations.builderById.pathKey(), | |
| }), | |
| queryClient.invalidateQueries({ | |
| queryKey: trpc.conversations.builderList.pathKey(), | |
| }), | |
| ]); |
Summary
Makes agent drafts reviewable before deployment and moves deployment into the agent detail flow.
Why
A draft is already a meaningful artifact. Requiring deployment before users can inspect its details reverses the intended review and approval flow.
Stack
Depends on #62 — private agent-builder workspace.
Verification