diff --git a/gui/src/components/BackgroundMode/AgentsList.tsx b/gui/src/components/BackgroundMode/AgentsList.tsx
index 216026176..7e45ee2c1 100644
--- a/gui/src/components/BackgroundMode/AgentsList.tsx
+++ b/gui/src/components/BackgroundMode/AgentsList.tsx
@@ -16,7 +16,11 @@ interface Agent {
};
}
-export function AgentsList() {
+interface AgentsListProps {
+ isCreatingAgent?: boolean;
+}
+
+export function AgentsList({ isCreatingAgent = false }: AgentsListProps) {
const { session } = useAuth();
const ideMessenger = useContext(IdeMessengerContext);
const currentOrg = useAppSelector(selectCurrentOrg);
@@ -93,7 +97,7 @@ export function AgentsList() {
if (agents.length === 0) {
return (
- No background agents yet. Submit a message above to create one.
+ No background tasks yet. Submit a message above to create one.
);
}
@@ -101,7 +105,7 @@ export function AgentsList() {
return (
- Recent Agents
+ Background Tasks
{agents.map((agent) => (
diff --git a/gui/src/components/BackgroundMode/BackgroundModeView.tsx b/gui/src/components/BackgroundMode/BackgroundModeView.tsx
index fe5105e37..fdcf92bcd 100644
--- a/gui/src/components/BackgroundMode/BackgroundModeView.tsx
+++ b/gui/src/components/BackgroundMode/BackgroundModeView.tsx
@@ -1,4 +1,5 @@
import {
+ ArrowPathIcon,
ExclamationTriangleIcon,
RocketLaunchIcon,
} from "@heroicons/react/24/outline";
@@ -11,9 +12,13 @@ import { AgentsList } from "./AgentsList";
interface BackgroundModeViewProps {
onCreateAgent: (editorState: any) => void;
+ isCreatingAgent?: boolean;
}
-export function BackgroundModeView({ onCreateAgent }: BackgroundModeViewProps) {
+export function BackgroundModeView({
+ onCreateAgent,
+ isCreatingAgent = false,
+}: BackgroundModeViewProps) {
const { session, login } = useAuth();
const ideMessenger = useContext(IdeMessengerContext);
const currentOrg = useAppSelector(selectCurrentOrg);
@@ -129,10 +134,19 @@ export function BackgroundModeView({ onCreateAgent }: BackgroundModeViewProps) {
)}
-
- Agents you trigger will run in the background and appear below.
+
+
+ Submit a task above to run a background agent. Your task will appear
+ below in ~30 seconds once the container starts.
+
+ {isCreatingAgent && (
+
+ )}
-
+
);
}
diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx
index e654a6e1e..1b22647c9 100644
--- a/gui/src/pages/gui/Chat.tsx
+++ b/gui/src/pages/gui/Chat.tsx
@@ -110,6 +110,7 @@ export function Chat() {
);
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const [stepsOpen] = useState<(boolean | undefined)[]>([]);
+ const [isCreatingAgent, setIsCreatingAgent] = useState(false);
const mainTextInputRef = useRef(null);
const stepsDivRef = useRef(null);
const tabsRef = useRef(null);
@@ -181,13 +182,28 @@ export function Chat() {
const currentOrg = selectCurrentOrg(stateSnapshot);
const organizationId =
currentOrg?.id !== "personal" ? currentOrg?.id : undefined;
- ideMessenger.post("createBackgroundAgent", {
- editorState,
- organizationId,
- });
+
+ setIsCreatingAgent(true);
+
+ // Clear input immediately for better UX
if (editorToClearOnSend) {
editorToClearOnSend.commands.clearContent();
}
+
+ // Create agent and track loading state
+ (async () => {
+ try {
+ await ideMessenger.request("createBackgroundAgent", {
+ editorState,
+ organizationId,
+ });
+ setIsCreatingAgent(false);
+ } catch (error) {
+ console.error("Failed to create background agent:", error);
+ setIsCreatingAgent(false);
+ }
+ })();
+
return;
}
@@ -257,7 +273,7 @@ export function Chat() {
}
}
},
- [dispatch, ideMessenger, reduxStore],
+ [dispatch, ideMessenger, reduxStore, setIsCreatingAgent],
);
useWebviewListener(
@@ -480,14 +496,11 @@ export function Chat() {
{!hasDismissedExploreDialog && }
{mode === "background" ? (
{
- const organizationId =
- currentOrg?.id !== "personal" ? currentOrg?.id : undefined;
- ideMessenger.post("createBackgroundAgent", {
- editorState,
- organizationId,
- });
+ onCreateAgent={() => {
+ // This callback is kept for compatibility but not used
+ // Agent creation is now handled in sendInput for better loading state management
}}
+ isCreatingAgent={isCreatingAgent}
/>
) : (
history.length === 0 && (