8000 chore: pull in cherry picks for v2.24 by stirby · Pull Request #18674 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

chore: pull in cherry picks for v2.24 #18674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
73ffb71
chore: remove chats experiment (#18535)
dannykopping Jun 25, 2025
cc51308
feat: allow new immutable parameters for existing workspaces (#18579)
Emyrk Jun 25, 2025
fac6263
chore: upgrade aisdk-go lib, remove vestigial code (#18577)
dannykopping Jun 25, 2025
4c938c0
refactor: remove beta label from 'select a preset' menu (#18538)
BrunoQuaresma Jun 25, 2025
19d8a40
fix: hide the preset parameter visibility switch when it has no effec…
SasSwart Jun 26, 2025
a4a5892
feat: graduate prebuilds to general availability (#18607)
SasSwart Jun 26, 2025
8e6417a
fix(agent): start devcontainers through agentcontainers package (#18471)
DanielleMaywood Jun 25, 2025
63b619c
fix(agent/agentcontainers): filter out "is test run" devcontainers (#…
mafredri Jun 25, 2025
03d1570
feat(agent/agentcontainers): add feature options as envs (#18576)
mafredri Jun 25, 2025
5be5bf3
fix(coderd/agentapi): make sub agent slugs more unique (#18581)
DanielleMaywood Jun 25, 2025
cf6d208
feat(agent/agentcontainers): add more envs to readconfig for app URL …
mafredri Jun 26, 2025
226aec1
fix!: use devcontainer ID when rebuilding a devcontainer (#18604)
DanielleMaywood Jun 26, 2025
766fc4c
fix(agent/agentcontainers): chown coder binary (#18611)
DanielleMaywood Jun 26, 2025 8000
07d749c
fix(agent/agentcontainers): stop logging empty lines (#18605)
DanielleMaywood Jun 26, 2025
aab5059
chore: parse app status link (#18439)
code-asher Jun 26, 2025
cbc97de
fix(agent): delay containerAPI init to ensure startup scripts run bef…
mafredri Jun 27, 2025
5058d1b
feat: add task link in the workspace page when it is running a task (…
BrunoQuaresma Jun 27, 2025
b7c7d1a
refactor: move required external auth buttons to the submit side (#18…
BrunoQuaresma Jun 27, 2025
b8930ec
fix(agent): fix script filtering for devcontainers (#18635)
mafredri Jun 27, 2025
1891c6f
refactor: show the apps as soon as possible (#18625)
BrunoQuaresma Jun 27, 2025
99f3664
feat: redirect to the task page after creation (#18626)
BrunoQuaresma Jun 27, 2025
19089ad
fix: use default preset when creating a workspace for task (#18623)
BrunoQuaresma Jun 27, 2025
47f813e
fix(agent/agentcontainers): ensure proper channel closure for updateT…
mafredri Jun 27, 2025
2a68b01
fix(agent/agentcontainers): split Init into Init and Start for early …
mafredri Jun 27, 2025
2daec01
feat: make task panels resizable (#18590)
BrunoQuaresma Jun 27, 2025
9e923f9
fix: use only template version ID to create task workspace (#18642)
BrunoQuaresma Jun 27, 2025
830a9ed
chore: add beta badge to tasks (#18656)
dannykopping Jun 30, 2025
da71915
fix(agent/agentcontainers): always derive devcontainer name from work…
mafredri Jun 30, 2025
9a9dd5d
fix: handle health status when displaying task apps (#18675)
hugodutka Jun 30, 2025
4bcbc96
fix: improve reliability of app statuses (#18622)
code-asher Jun 30, 2025
2d210aa
chore: fix idle state icon when disabled (#18554)
code-asher Jun 25, 2025
459b9d9
docs: add warning about prebuilds incompatibility with certain featur…
ssncferreira Jul 1, 2025
b975443
Merge branch 'release/2.24' into cherry-picks-2.24
stirby Jul 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: move required external auth buttons to the submit side (#18586
)

**Before:**
![Screenshot 2025-06-25 at 14 40
16](https://github.com/user-attachments/assets/cbc558f5-6eee-4133-afc9-2474f04a8a67)

**After:**
![Screenshot 2025-06-25 at 14 53
53](https://github.com/user-attachments/assets/3a638f60-d1e4-40a4-a066-8d69fe96c198)

(cherry picked from commit 59a6541)
  • Loading branch information
BrunoQuaresma authored and stirby committed Jun 30, 2025
commit b7c7d1af0b13c1793fd9a86fb4185c8520997314
1 change: 1 addition & 0 deletions site/src/hooks/useExternalAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ export const useExternalAuth = (versionId: string | undefined) => {
externalAuthPollingState,
isLoadingExternalAuth,
externalAuthError: error,
isPollingExternalAuth: externalAuthPollingState === "polling",
};
};
2 changes: 1 addition & 1 deletion site/src/pages/TasksPage/TasksPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const MissingExternalAuth: Story = {
});

await step("Renders external authentication", async () => {
await canvas.findByRole("button", { name: /login with github/i });
await canvas.findByRole("button", { name: /connect to github/i });
});
},
};
Expand Down
169 changes: 114 additions & 55 deletions site/src/pages/TasksPage/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import Skeleton from "@mui/material/Skeleton";
import { API } from "api/api";
import { getErrorDetail, getErrorMessage } from "api/errors";
import { disabledRefetchOptions } from "api/queries/util";
import type { Template } from "api/typesGenerated";
import type { Template, TemplateVersionExternalAuth } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Avatar } from "components/Avatar/Avatar";
import { AvatarData } from "components/Avatar/AvatarData";
import { AvatarDataSkeleton } from "components/Avatar/AvatarDataSkeleton";
import { Button } from "components/Button/Button";
import { Form, FormFields, FormSection } from "components/Form/Form";
import { displayError } from "components/GlobalSnackbar/utils";
import { Margins } from "components/Margins/Margins";
import {
Expand Down Expand Up @@ -37,9 +36,16 @@ import {
TableRowSkeleton,
} from "components/TableLoader/TableLoader";

import { ExternalImage } from "components/ExternalImage/ExternalImage";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "components/Tooltip/Tooltip";
import { useAuthenticated } from "hooks";
import { useExternalAuth } from "hooks/useExternalAuth";
import { RotateCcwIcon, SendIcon } from "lucide-react";
import { RedoIcon, RotateCcwIcon, SendIcon } from "lucide-react";
import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks";
import { WorkspaceAppStatus } from "modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus";
import { generateWorkspaceName } from "modules/workspaces/generateWorkspaceName";
Expand All @@ -50,12 +56,12 @@ import { Link as RouterLink } from "react-router-dom";
import TextareaAutosize from "react-textarea-autosize";
import { pageTitle } from "utils/page";
import { relativeTime } from "utils/time";
import { ExternalAuthButton } from "../CreateWorkspacePage/ExternalAuthButton";
import { type UserOption, UsersCombobox } from "./UsersCombobox";

type TasksFilter = {
user: UserOption | undefined;
};

const TasksPage: FC = () => {
const { user, permissions } = useAuthenticated();
const [filter, setFilter] = useState<TasksFilter>({
Expand Down Expand Up @@ -201,21 +207,24 @@ type TaskFormProps = {
const TaskForm: FC<TaskFormProps> = ({ templates }) => {
const { user } = useAuthenticated();
const queryClient = useQueryClient();

const [templateId, setTemplateId] = useState<string>(templates[0].id);
const [selectedTemplateId, setSelectedTemplateId] = useState<string>(
templates[0].id,
);
const selectedTemplate = templates.find(
(t) => t.id === selectedTemplateId,
) as Template;
const {
externalAuth,
externalAuthPollingState,
startPollingExternalAuth,
isLoadingExternalAuth,
externalAuthError,
} = useExternalAuth(
templates.find((t) => t.id === templateId)?.active_version_id,
);

const hasAllRequiredExternalAuth = externalAuth?.every(
(auth) => auth.optional || auth.authenticated,
isPollingExternalAuth,
isLoadingExternalAuth,
} = useExternalAuth(selectedTemplate.active_version_id);
const missedExternalAuth = externalAuth?.filter(
(auth) => !auth.optional && !auth.authenticated,
);
const isMissingExternalAuth = missedExternalAuth
? missedExternalAuth.length > 0
: true;

const createTaskMutation = useMutation({
mutationFn: async ({ prompt, templateId }: CreateTaskMutationFnProps) =>
Expand All @@ -235,10 +244,6 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
const prompt = formData.get("prompt") as string;
const templateID = formData.get("templateID") as string;

if (!prompt || !templateID) {
return;
}

try {
await createTaskMutation.mutateAsync({
prompt,
Expand All @@ -253,8 +258,12 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
};

return (
<Form onSubmit={onSubmit} aria-label="Create AI task">
{Boolean(externalAuthError) && <ErrorAlert error={externalAuthError} />}
<form
onSubmit={onSubmit}
aria-label="Create AI task"
className="flex flex-col gap-4"
>
{externalAuthError && <ErrorAlert error={externalAuthError} />}

<fieldset
className="border border-border border-solid rounded-lg p-4"
Expand All @@ -274,7 +283,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
<div className="flex items-center justify-between pt-2">
<Select
name="templateID"
onValueChange={(value) => setTemplateId(value)}
onValueChange={(value) => setSelectedTemplateId(value)}
defaultValue={templates[0].id}
required
>
Expand All @@ -294,43 +303,93 @@ const TaskForm: FC<TaskFormProps> = ({ templates }) => {
</SelectContent>
</Select>

<Button
size="sm"
type="submit"
disabled={!hasAllRequiredExternalAuth}
>
<Spinner
loading={createTaskMutation.isPending || isLoadingExternalAuth}
>
<SendIcon />
</Spinner>
Run task
</Button>
<div className="flex items-center gap-2">
{missedExternalAuth && (
<ExternalAuthButtons
template={selectedTemplate}
missedExternalAuth={missedExternalAuth}
/>
)}

<Button size="sm" type="submit" disabled={isMissingExternalAuth}>
<Spinner
loading={
isLoadingExternalAuth ||
isPollingExternalAuth ||
createTaskMutation.isPending
}
>
<SendIcon />
</Spinner>
Run task
</Button>
</div>
</div>
</fieldset>
</form>
);
};

{!hasAllRequiredExternalAuth &&
externalAuth &&
externalAuth.length > 0 && (
<FormSection
title="External Authentication"
description="This template uses external services for authentication."
>
<FormFields>
{externalAuth.map((auth) => (
<ExternalAuthButton
key={auth.id}
auth={auth}
isLoading={externalAuthPollingState === "polling"}
onStartPolling={startPollingExternalAuth}
displayRetry={externalAuthPollingState === "abandoned"}
/>
))}
</FormFields>
</FormSection>
type ExternalAuthButtonProps = {
template: Template;
missedExternalAuth: TemplateVersionExternalAuth[];
};

const ExternalAuthButtons: FC<ExternalAuthButtonProps> = ({
template,
missedExternalAuth,
}) => {
const {
startPollingExternalAuth,
isPollingExternalAuth,
externalAuthPollingState,
} = useExternalAuth(template.active_version_id);
const shouldRetry = externalAuthPollingState === "abandoned";

return missedExternalAuth.map((auth) => {
return (
<div className="flex items-center gap-2" key={auth.id}>
<Button
variant="outline"
size="sm"
disabled={isPollingExternalAuth || auth.authenticated}
onClick={() => {
window.open(
auth.authenticate_url,
"_blank",
"width=900,height=600",
);
startPollingExternalAuth();
}}
>
<Spinner loading={isPollingExternalAuth}>
<ExternalImage src={auth.display_icon} />
</Spinner>
Connect to {auth.display_name}
</Button>

{shouldRetry && !auth.authenticated && (
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger asChild>
<Button
variant="outline"
size="icon"
onClick={startPollingExternalAuth}
>
<RedoIcon />
<span className="sr-only">Refresh external auth</span>
</Button>
</TooltipTrigger>
<TooltipContent>
Retry connecting to {auth.display_name}
</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
</Form>
);
</div>
);
});
};

type TasksFilterProps = {
Expand Down
0