Cian Johnston
544259b809
feat: add database tables and API routes for agentic chat feature ( #17570 )
...
Backend portion of experimental `AgenticChat` feature:
- Adds database tables for chats and chat messages
- Adds functionality to stream messages from LLM providers using
`kylecarbs/aisdk-go`
- Adds API routes with relevant functionality (list, create, update
chats, insert chat message)
- Adds experiment `codersdk.AgenticChat`
---------
Co-authored-by: Kyle Carberry <kyle@carberry.com >
2025-05-02 17:29:57 +01:00
brettkolodny
b7e08ba7c9
fix: filter out deleted users when attempting to delete an organization ( #17621 )
...
Closes
[coder/internal#601 ](https://github.com/coder/internal/issues/601 )
2025-05-01 13:26:01 -03:00
Cian Johnston
2acf0adcf2
chore(codersdk/toolsdk): improve static analyzability of toolsdk.Tools ( #17562 )
...
* Refactors toolsdk.Tools to remove opaque `map[string]any` argument in
favour of typed args structs.
* Refactors toolsdk.Tools to remove opaque passing of dependencies via
`context.Context` in favour of a tool dependencies struct.
* Adds panic recovery and clean context middleware to all tools.
* Adds `GenericTool` implementation to allow keeping `toolsdk.All` with
uniform type signature while maintaining type information in handlers.
* Adds stricter checks to `patchWorkspaceAgentAppStatus` handler.
2025-04-29 16:05:23 +01:00
Mathias Fredriksson
1fc74f629e
refactor(agent): update agentcontainers api initialization ( #17600 )
...
There were too many ways to configure the agentcontainers API resulting
in inconsistent behavior or features not being enabled. This refactor
introduces a control flag for enabling or disabling the containers API.
When disabled, all implementations are no-op and explicit endpoint
behaviors are defined. When enabled, concrete implementations are used
by default but can be overridden by passing options.
2025-04-29 17:53:10 +03:00
Yevhenii Shcherbina
02b2de9ae4
refactor: skip reconciliation for some presets ( #17595 )
2025-04-29 07:55:37 -04:00
ケイラ
12589026b6
chore: update error message for duplicate organization members ( #17594 )
...
Closes https://github.com/coder/internal/issues/345
2025-04-28 14:51:33 -06:00
Yevhenii Shcherbina
a78f0fc4e1
refactor: use specific error for agpl and prebuilds ( #17591 )
...
Follow-up PR to https://github.com/coder/coder/pull/17458
Addresses this discussion:
https://github.com/coder/coder/pull/17458#discussion_r2055940797
2025-04-28 16:37:41 -04:00
Steven Masley
14105ff301
test: do not run memory race test in parallel ( #17582 )
...
Closes
https://github.com/coder/internal/issues/597#issuecomment-2835262922
The parallelized tests share configs, which when accessed concurrently
throw race errors. The configs are read only, so it is fine to run these
tests with shared idp configs.
2025-04-28 12:20:07 -05:00
Steven Masley
37c5e7c440
chore: return safe copy of string slice in 'ParseStringSliceClaim' ( #17439 )
...
Claims parsed should be safe to mutate and filter. This was likely not
causing any bugs or issues, and just doing this out of precaution
2025-04-28 12:18:02 -05:00
Danny Kopping
e0483e3136
feat: add prebuilds metrics collector ( #17547 )
...
Closes https://github.com/coder/internal/issues/509
---------
Signed-off-by: Danny Kopping <dannykopping@gmail.com >
2025-04-28 12:28:56 +02:00
Danny Kopping
08ad910171
feat: add prebuilds configuration & bootstrapping ( #17527 )
...
Closes https://github.com/coder/internal/issues/508
---------
Signed-off-by: Danny Kopping <dannykopping@gmail.com >
Co-authored-by: Cian Johnston <cian@coder.com >
2025-04-25 11:07:15 +02:00
Yevhenii Shcherbina
118f12ac3a
feat: implement claiming of prebuilt workspaces ( #17458 )
...
Signed-off-by: Danny Kopping <dannykopping@gmail.com >
Co-authored-by: Danny Kopping <dannykopping@gmail.com >
Co-authored-by: Danny Kopping <danny@coder.com >
Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com >
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com >
Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com >
Co-authored-by: Ethan <39577870+ethanndickson@users.noreply.github.com >
Co-authored-by: M Atif Ali <atif@coder.com >
Co-authored-by: Aericio <16523741+Aericio@users.noreply.github.com >
Co-authored-by: M Atif Ali <me@matifali.dev >
Co-authored-by: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com >
2025-04-24 09:39:38 -04:00
ケイラ
36a72a2b25
chore: loosen static validation when using dynamic parameters ( #17516 )
...
Co-authored-by: Steven Masley <stevenmasley@gmail.com >
2025-04-23 10:15:49 -06:00
Steven Masley
71dbd0c888
fix: nil ptr deref when removing OIDC from deployment and accessing old users ( #17501 )
...
If OIDC is removed from a deployment, trying to create a workspace for a previous user
on OIDC would panic.
2025-04-23 08:45:26 -05:00
Steven Masley
ca38729840
chore: revert dynamic params as a safe experiment ( #17510 )
2025-04-22 16:21:15 +00:00
ケイラ
2cc56ab515
chore: fill out workspace owner data for dynamic parameters ( #17366 )
2025-04-17 14:51:50 -06:00
Steven Masley
ea65ddc17d
fix: correct user roles being passed into terraform context ( #17460 )
...
Roles were being passed into the workspace context incorrectly. Site
wide scopes were being org scoped. Roles outside the org should also not
be sent.
2025-04-17 15:42:23 -05:00
Yevhenii Shcherbina
183146e2c9
fix: add minor fix to reconciliation loop ( #17454 )
...
Follow-up PR to https://github.com/coder/coder/pull/17261
I noticed that 1 metrics-related test fails in `dk/prebuilds` after
merging my PR into `dk/prebuilds`.
2025-04-17 13:43:24 -04:00
Yevhenii Shcherbina
27bc60d1b9
feat: implement reconciliation loop ( #17261 )
...
Closes https://github.com/coder/internal/issues/510
<details>
<summary> Refactoring Summary </summary>
### 1) `CalculateActions` Function
#### Issues Before Refactoring:
- Large function (~150 lines), making it difficult to read and maintain.
- The control flow is hard to follow due to complex conditional logic.
- The `ReconciliationActions` struct was partially initialized early,
then mutated in multiple places, making the flow error-prone.
Original source:
https://github.com/coder/coder/blob/fe60b569ad754245e28bac71e0ef3c83536631bb/coderd/prebuilds/state.go#L13-L167
#### Improvements After Refactoring:
- Simplified and broken down into smaller, focused helper methods.
- The flow of the function is now more linear and easier to understand.
- Struct initialization is cleaner, avoiding partial and incremental
mutations.
Refactored function:
https://github.com/coder/coder/blob/eeb0407d783cdda71ec2418c113f325542c47b1c/coderd/prebuilds/state.go#L67-L84
---
### 2) `ReconciliationActions` Struct
#### Issues Before Refactoring:
- The struct mixed both actionable decisions and diagnostic state, which
blurred its purpose.
- It was unclear which fields were necessary for reconciliation logic,
and which were purely for logging/observability.
#### Improvements After Refactoring:
- Split into two clear, purpose-specific structs:
- **`ReconciliationActions`** — defines the intended reconciliation
action.
- **`ReconciliationState`** — captures runtime state and metadata,
primarily for logging and diagnostics.
Original struct:
https://github.com/coder/coder/blob/fe60b569ad754245e28bac71e0ef3c83536631bb/coderd/prebuilds/reconcile.go#L29-L41
</details>
---------
Signed-off-by: Danny Kopping <dannykopping@gmail.com >
Co-authored-by: Sas Swart <sas.swart.cdk@gmail.com >
Co-authored-by: Danny Kopping <dannykopping@gmail.com >
Co-authored-by: Dean Sheather <dean@deansheather.com >
Co-authored-by: Spike Curtis <spike@coder.com >
Co-authored-by: Danny Kopping <danny@coder.com >
2025-04-17 09:29:29 -04:00
Michael Suchacz
daafa0d689
chore: add missing prometheus tests for UNKNOWN/STATIC paths ( #17446 )
2025-04-17 13:50:18 +02:00
Steven Masley
0bc49ff5ae
test: fix flake in TestRoleSyncTable with test cases sharing resources ( #17441 )
...
The test case definition shares maps that can have concurrent access if run in parallel.
2025-04-17 00:14:11 +00:00
ケイラ
7f6e5139eb
chore: format code ( #17438 )
2025-04-16 17:21:14 -06:00
Steven Masley
2e5cd299f2
chore: load 'assign_default' value from legacy value ( #17428 )
...
If this value was set before v2.19.0, then assign_default was in a json
field that would not match. And it would default to `false`. This
corrects that.
2025-04-16 15:55:37 -05:00
Steven Masley
c4d3dd2791
chore: prevent null loading sync settings ( #17430 )
...
Nulls passed to the frontend caused a page to fail to load.
`Record<string,string>` can be `nil` in golang
2025-04-16 14:39:57 -05:00
ケイラ
f670bc31f5
chore: update testutil chan helpers ( #17408 )
2025-04-16 10:37:09 -06:00
ケイラ
2a76f5028e
fix: don't attempt to insert empty terraform plans into the database ( #17426 )
2025-04-16 10:14:35 -06:00
Steven Masley
669e790df6
test: add unit test to excercise bug when idp sync hits deleted orgs ( #17405 )
...
Deleted organizations are still attempting to sync members. This causes
an error on inserting the member, and would likely cause issues later in
the sync process even if that member is inserted. Deleted orgs should be
skipped.
2025-04-16 09:27:35 -05:00
Sas Swart
64172d374f
fix: set preset parameters in the API rather than the frontend ( #17403 )
...
Follow-up from a [previous Pull
Request](https://github.com/coder/coder/pull/16965 ) required some
additional testing of Presets from the API perspective.
In the process of adding the new tests, I updated the API to enforce
preset parameter values based on the selected preset instead of trusting
whichever frontend makes the request. This avoids errors scenarios in
prebuilds where a prebuild might expect a certain preset but find a
different set of actual parameter values.
2025-04-16 15:54:06 +02:00
Michael Suchacz
f8971bb3cc
feat: add path & method labels to prometheus metrics for current requests ( #17362 )
...
Closes : #17212
2025-04-16 11:10:39 +02:00
Steven Masley
a7646d1524
chore: disable authz-header in all builds ( #17409 )
...
Header payload being large is causing some issues in dev builds. Another
method of opting in needs to be determined
2025-04-16 01:22:21 +00:00
Edward Angert
0cd531dd33
docs: document workspace naming rules and restrictions ( #17312 )
...
closes #12047
[preview](https://coder.com/docs/@12047-workspace-names/user-guides/workspace-management )
---------
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com >
2025-04-15 14:11:05 -04:00
Michael Suchacz
06d39151dc
feat: extend request logs with auth & DB info ( #17304 )
...
Closes #16903
2025-04-15 13:27:23 +02:00
Cian Johnston
979687c37f
chore(codersdk): deprecate WorkspaceAppStatus.{NeedsUserAttention,Icon} ( #17358 )
...
https://github.com/coder/coder/pull/17163 introduced the
`workspace_app_statuses` table. Two of these fields
(`needs_user_attention`, `icon`) turned out to be surplus to
requirements.
- Removes columns `needs_user_attention` and `icon` from
`workspace_app_statuses`
- Marks the corresponding fields of `codersdk.WorkspaceAppStatus` as
deprecated.
2025-04-15 10:47:42 +01:00
Danny Kopping
0b18e458f4
fix: reduce excessive logging when database is unreachable ( #17363 )
...
Fixes #17045
---------
Signed-off-by: Danny Kopping <dannykopping@gmail.com >
2025-04-15 10:55:30 +02:00
Sas Swart
a98605913a
feat: mark prebuilds as such and set their preset ids ( #16965 )
...
This pull request closes https://github.com/coder/internal/issues/513
2025-04-14 15:34:50 +02:00
Spike Curtis
d8fcb062bc
chore: add logging for coderdtest server lifecycle ( #17376 )
...
regarding https://github.com/coder/internal/issues/581
Adds logging around the lifecyle of the coderd HTTP server.
2025-04-14 16:15:06 +04:00
Jon Ayers
c06ef7c1eb
chore!: remove JFrog integration ( #17353 )
...
- Removes displaying XRay scan results in the dashboard. I'm not sure
anyone was even using this integration so it's just debt for us to
maintain. We can open up a separate issue to get rid of the db tables
once we know for sure that we haven't broken anyone.
2025-04-11 14:45:21 -04:00
Cian Johnston
1235550637
feat(codersdk): add toolsdk and replace existing mcp server tool impl ( #17343 )
...
- Refactors existing `mcp` package to use `kylecarbs/aisdk-go` and moves
to `codersdk/toolsdk` package.
- Updates existing MCP server implementation to use `codersdk/toolsdk`
Co-authored-by: Kyle Carberry <kyle@coder.com >
2025-04-11 10:24:45 +01:00
Spike Curtis
12dc086628
feat: return hostname suffix on AgentConnectionInfo ( #17334 )
...
Adds the Hostname Suffix to `AgentConnectionInfo` --- the VPN provider will use it to control the suffix for DNS hostnames.
part of: #16828
2025-04-11 13:09:51 +04:00
ケイラ
859dd2fc3f
feat: add dynamic parameters websocket endpoint ( #17165 )
2025-04-10 14:08:50 -06:00
Cian Johnston
1e0051a9a2
feat(testutil): add GetRandomNameHyphenated ( #17342 )
...
This started coming up more often for me, so time for a test helper!
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-04-10 19:08:38 +01:00
ケイラ
46d4b28384
chore: add x-authz-checks debug header when running in dev mode ( #16873 )
2025-04-10 11:36:27 -06:00
Danielle Maywood
6dd1056025
feat(coderd/notifications): group workspace build failure report ( #17306 )
...
Closes https://github.com/coder/coder/issues/15745
Instead of sending X many reports to a single template admin, we instead
send only 1.
2025-04-10 13:32:19 +01:00
Steven Masley
0b58798a1a
feat: remove site wide perms from creating a workspace ( #17296 )
...
Creating a workspace required `read` on site wide `user`.
Only organization permissions should be required.
2025-04-09 14:35:43 -05:00
Spike Curtis
3f3e2017bd
fix: fix http cache dir creation order in coderdtest ( #17303 )
...
fixes coder/internal#565
Fixes the ordering of creating the HTTP cache temp dir with respect to
starting the Coderd HTTP server, so that they are cleaned up in the
correct (reverse) order.
2025-04-09 11:19:48 +00:00
Cian Johnston
a8fbe71a22
chore(cli): increase healthcheck timeout in TestSupportbundle ( #17291 )
...
Fixes https://github.com/coder/internal/issues/272
* Increases healthcheck timeout in tests. This seems to be the most
usual cause of test failures.
* Adds a non-nilness check before caching a healthcheck report.
* Modifies the HTTP response code to 503 (was 404) when no healthcheck
report is available. 503 seems to be a better indicator of the server
state in this case, whereas 404 could be misinterpreted as a typo in the
healthcheck URL.
2025-04-09 09:21:17 +01:00
Utsavkumar Lal
0e658219b2
feat: support filtering users table by login type ( #17238 )
...
#15896 Mentions ability to add support for filtering by login type
The issue mentions that backend API support exists but the backend did
not seem to have the support for this filter. So I have added the
ability to filter it.
I also added a corresponding update to readme file to make sure the docs
will correctly showcase this feature
2025-04-09 13:59:41 +10:00
Steven Masley
52d555880c
chore: add custom samesite options to auth cookies ( #16885 )
...
Allows controlling `samesite` cookie settings from the deployment config
2025-04-08 14:15:14 -05:00
Marcin Tojek
88b7c9ef5d
feat: install more terminal fonts ( #17289 )
...
Related: https://github.com/coder/coder/issues/15024
2025-04-08 14:36:15 +02:00
Michael Suchacz
ce22de8d15
feat: log long-lived connections acceptance ( #17219 )
...
Closes #16904
2025-04-08 08:30:05 +00:00