Commit Graph

9309 Commits

Author SHA1 Message Date
765e7058e8 chore: use container memory if containerised for oom notifications (#17062)
Currently we query only the underlying host's memory usage for our
memory resource monitor. This PR changes that to check if the workspace
is in a container, and if so it queries the container's memory usage,
falling back to the host's memory usage if not.
2025-03-24 11:14:21 +00:00
674f60fc5b fix(cli): replace $SESSION_TOKEN placeholder for external apps (#17048)
Fixes an oversight in https://github.com/coder/coder/pull/17032

The FE has logic to replace the string `$SESSION_TOKEN` with a
newly-minted session token.
This adds corresponding logic to the `coder open app` command.
2025-03-24 09:03:30 +00:00
77fe10ead8 chore(dogfood): update EU server from Helsinki to Falkenstein (#17061) 2025-03-24 02:22:34 +11:00
60c4944503 chore: bump golang to 1.22.12 (#17058) 2025-03-22 00:58:09 +00:00
5c30806db6 chore: bump next from 14.2.23 to 14.2.25 in /offlinedocs (#17055)
Bumps [next](https://github.com/vercel/next.js) from 14.2.23 to 14.2.25.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.25</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.
This release contains a security patch for <a
href="https://github.com/vercel/next.js/security/advisories/GHSA-f82v-jwr5-mffw">CVE-2025-29927</a>.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Update middleware request header (<a
href="https://redirect.github.com/vercel/next.js/issues/77202">#77202</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/ijjk"><code>@​ijjk</code></a> for helping!</p>
<h2>v14.2.24</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>fix: ensure lint worker errors aren't silenced (<a
href="https://redirect.github.com/vercel/next.js/issues/75779">#75779</a>)</li>
<li>add additional x-middleware-set-cookie filtering (<a
href="https://redirect.github.com/vercel/next.js/issues/75561">#75561</a>
&amp; <a
href="https://redirect.github.com/vercel/next.js/issues/73482">#73482</a>)</li>
</ul>
<h3>Credits</h3>
<p>Huge thanks to <a
href="https://github.com/ztanner"><code>@​ztanner</code></a> for
helping!</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d36a1f3c35"><code>d36a1f3</code></a>
v14.2.25</li>
<li><a
href="5fd3ae8f85"><code>5fd3ae8</code></a>
[backport] Update middleware request header (<a
href="https://redirect.github.com/vercel/next.js/issues/77202">#77202</a>)</li>
<li><a
href="756be15c4c"><code>756be15</code></a>
v14.2.24</li>
<li><a
href="ba6453d5ef"><code>ba6453d</code></a>
fix corepack keys</li>
<li><a
href="c482c2072f"><code>c482c20</code></a>
[backport v14] fix: ensure lint worker errors aren't silenced (<a
href="https://redirect.github.com/vercel/next.js/issues/75766">#75766</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/75779">#75779</a>)</li>
<li><a
href="5791cb6778"><code>5791cb6</code></a>
[Backport v14] add additional x-middleware-set-cookie filtering (<a
href="https://redirect.github.com/vercel/next.js/issues/75561">#75561</a>)
(<a
href="https://redirect.github.com/vercel/next.js/issues/75">#75</a>...</li>
<li><a
href="8129a61880"><code>8129a61</code></a>
test: fix eslint plugin test (<a
href="https://redirect.github.com/vercel/next.js/issues/75687">#75687</a>)</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/compare/v14.2.23...v14.2.25">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=next&package-manager=npm_and_yarn&previous-version=14.2.23&new-version=14.2.25)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/coder/coder/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 22:47:05 +00:00
17fe7f6ea2 chore: bump github.com/golang-jwt/jwt/v4 from 4.5.1 to 4.5.2 (#17054)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt)
from 4.5.1 to 4.5.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/golang-jwt/jwt/releases">github.com/golang-jwt/jwt/v4's
releases</a>.</em></p>
<blockquote>
<h2>v4.5.2</h2>
<p>See <a
href="https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp">https://github.com/golang-jwt/jwt/security/advisories/GHSA-mh63-6h87-95cp</a></p>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2">https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2f0e9add62"><code>2f0e9ad</code></a>
Backporting 0951d18 to v4</li>
<li>See full diff in <a
href="https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/golang-jwt/jwt/v4&package-manager=go_modules&previous-version=4.5.1&new-version=4.5.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/coder/coder/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-21 22:41:03 +00:00
e40ea258dc fix: fix double ws connection for notifications (#17044)
**Issue:**
The UI was creating two web socket connections to receive notification
updates causing duplicated values.

**Cause:**
We were rendering the notification container twice. One for the desktop
nav and another for mobile.

**Fix:**
Only use one notification container for the nav.

**Improvements for later:**
I think would be better at some point to move the networking and data
logic into a provider but it would require testing and some tiny rework.
Since the actual fix works well, and it is not complex or difficult, I
think it is ok to stay with it until we require to load notifications in
more places.
2025-03-21 14:12:22 -03:00
1593861d7c feat: add load more notifications on inbox (#17030)
Users need to see older notifications, so to make that happen, we added
a load more button at the end of the notifications list.

**Demo:**


https://github.com/user-attachments/assets/bd3d7964-a8f5-4164-8da0-9ba89ae88c9c

**What is missing?**
As you can notice, I didn't add tests for this feature. I tried, but I
didn't find a good solution for testing scroll events. However I was
able to get it working, but it was too cumbersome that I decided to
remove because of its maintenence burden.
2025-03-21 13:38:17 -03:00
82e37732ea feat(coderd): add format option to inbox notifications watch endpoint (#17034)
This PR aims to allow clients to use different format for the title and
content of inbox notifications - on the watch endpoint.

This solution will help to have it working and formatted differently on
VSCode, WebUI ...
[Related to this issue](https://github.com/coder/internal/issues/523)
2025-03-21 16:41:13 +01:00
0474888eb4 feat(cli): add open app <workspace> <app-slug> command (#17032)
Fixes https://github.com/coder/coder/issues/17009

Adds a CLI command `coder open app <workspace> <app-slug>` that allows
opening arbitrary `coder_apps` via the CLI.

Users can optionally specify a region for workspace
applications.
2025-03-21 15:28:08 +00:00
3b6bee9676 chore(Makefile): fix apidoc dependencies (#17042)
Our apidoc generation had some circular dependencies, this change splits
them up into separate Makefile targets.
2025-03-21 17:16:17 +02:00
fe24a7a4a8 feat(coderd): remove greetings from notifications templates (#16991)
This PR aimes to [fix this
issue](https://github.com/coder/internal/issues/448) -

The main idea is to remove greetings from templates stored in the DB -
and instead push it into the template for require methods - for now
SMTP.
2025-03-21 16:05:08 +01:00
bbe7dacd35 docs: document definition of workspace activity (#16941)
closes: https://github.com/coder/coder/issues/16884

aligns the documentation with what users see when they adjust settings
and uses the [notion
discussion](https://www.notion.so/coderhq/Definitions-of-Workspace-Usage-Autostop-Dormancy-e7fa8ff782a948c19bbe4ef8315c26cb)
as a reference. This PR reflects current behavior from what I can tell.


[preview](https://coder.com/docs/@16884-define-activity/user-guides/workspace-scheduling#activity-detection)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-03-21 10:36:24 -04:00
f4b6f429c6 chore(Makefile): fix dependencies and timestamps (#17040)
This change should reduce "infinite" dependency cycles.

I added some unnecessary `touch`es for completeness.
2025-03-21 15:33:07 +02:00
6908c1b2b7 chore: linkspector ignore mutagen.io (#17041) 2025-03-21 13:18:19 +00:00
b79167293c chore(Makefile): update golden files as part of make gen (#17039)
Updating golden files is an unnecessary extra step in addition to gen
that is easily overlooked, leading to the developer noticing the issue
in CI leading to lost developer time waiting for tests to complete.
2025-03-21 13:04:30 +00:00
de6080c46d chore: update comment on the users.github_com_user_id field (#17037)
Follow up to https://github.com/coder/coder/pull/17029.
2025-03-21 13:31:17 +01:00
a71aa202dc feat: filter users by github user id in the users list CLI command (#17029)
Add the `--github-user-id` option to `coder users list`, which makes the
command only return users with a matching GitHub user id. This will
enable https://github.com/coder/start-workspace-action to find a Coder
user that corresponds to a GitHub user requesting to start a workspace.
2025-03-21 13:30:47 +01:00
69ba27e347 feat: allow specifying devcontainer on agent in terraform (#16997)
This change allows specifying devcontainers in terraform and plumbs it
through to the agent via agent manifest.

This will be used for autostarting devcontainers in a workspace.

Depends on coder/terraform-provider-coder#368
Updates #16423
2025-03-20 19:09:39 +02:00
287e3198d8 fix: use navigator.locale to evaluate time format (#17025)
Fixes: https://github.com/coder/coder/issues/15452
2025-03-20 15:53:03 +01:00
3bd32a2e2a chore(cli): wait for agent to connect before dialing it in TestExpRpty (#17026)
Fixes flake seen here:
https://github.com/coder/coder/actions/runs/13970861685/job/39113344525
2025-03-20 14:44:30 +00:00
72d9876c76 fix(coderd/workspaceapps): prevent race in workspace app audit session updates (#17020)
Fixes coder/internal#520
2025-03-20 14:10:45 +00:00
68624092a4 feat(agent/reconnectingpty): allow selecting backend type (#17011)
agent/reconnectingpty: allow specifying backend type
cli: exp rpty: automatically select backend based on command
2025-03-20 13:45:31 +00:00
0cd254f219 feat: enable mark all inbox notifications as read (#17023)
Bind the "Mark all notifications as read" action to the correct API
request in the UI.
2025-03-20 10:30:05 -03:00
8d5e6f3cc0 fix: fix IsGithubDotComURL check (#17022)
When DeviceFlow with GitHub OAuth2 is configured, the
`api.GithubOAuth2Config.AuthCode` is
[overridden](b08c8c9e1e/coderd/userauth.go (L779))
and returns a value that doesn't pass the `IsGithubDotComURL` check.
This PR ensures the original `AuthCodeURL` method is used instead.
2025-03-20 13:24:38 +00:00
7d60186b7e feat: add user_tailnet_connections to telemetry (#17018)
## Summary
- Add UserTailnetConnection struct to track desktop client connections
- Add new field to Snapshot struct for telemetry
- Data collection to be implemented in a future PR

relates to coder/nexus#197
2025-03-20 17:04:43 +04:00
bf59c7ca0f fix: add notifications back to desktop (#17021)
The notifications were removed on [this PR
](https://github.com/coder/coder/pull/17008)by accident.
2025-03-20 09:42:08 -03:00
4960a1e85a feat(coderd): add mark-all-as-read endpoint for inbox notifications (#16976)
[Resolve this issue](https://github.com/coder/internal/issues/506)

Add a mark-all-as-read endpoint which is marking as read all
notifications that are not read for the authenticated user.
Also adds the DB logic.
2025-03-20 13:41:54 +01:00
d8d4b9b86e feat: display quiet hours using 24-hour time format (#17016)
Fixes: https://github.com/coder/coder/issues/15452
2025-03-20 10:40:42 +01:00
38b21ab35d fix(site): gracefully handle reselection of the same preset (#17014)
This PR closes https://github.com/coder/coder/issues/16953.

Reselecting a preset that was already the selected preset returned an
undefined option to the onSelect function. We then tried to read an
attribute of this undefined value. With this fix, we handle the
undefined option correctly.
2025-03-20 07:42:51 +00:00
b39477c07a fix: resolve flakey inbox tests (#17010) 2025-03-19 22:06:47 +00:00
4ea5ef925f feat: make notifications header sticky (#17005)
When having a bunch of notifications and the user is scrolling down the
content it is helpful to keep the header visible so the user can easily
mark all of them as read if they want to.
2025-03-19 16:02:45 -03:00
c88d86bf50 docs: add new doc on how to deploy Coder on Rancher (#16534)
[preview](https://coder.com/docs/@deploy-on-rancher/install/rancher)

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-03-19 18:50:52 +00:00
ab763ca242 fix: show notifications on mobile (#17008)
Show the notifications close to the menu button.

**After fix:**
<img width="515" alt="Screenshot 2025-03-19 at 15 09 36"
src="https://github.com/user-attachments/assets/38f86c5b-d324-4a8b-9c68-ea818b226ae4"
/>
2025-03-19 15:19:57 -03:00
abbd88b819 feat: update notification badge to support 99+ (#17007)
After dogfooding the notifications we noticed that admins will probably
have a larger number of unread notifications everyday so with that in
mind we decided to increase the "truncate" rate from 9+ to 99+.
2025-03-19 15:15:31 -03:00
6a7c43d76c chore: add the start workspace workflow (#17002)
The workflow triggers when an issue is created or a comment is posted.
If the string "@coder" appears in the body of the issue or comment, a
Coder workspace owned by the issue creator or commentator will be
created with the parameters specified in the workflow.
2025-03-19 12:39:37 -04:00
bd243c17fb docs: add AWS AMI upgrade instructions (#16973)
followup to @d1str0's #16937 

> Adds a small note for those who just used the AWS AMI for their
initial installation.

This PR rearranges the Upgrade doc to use tabs for each section + adds
AWS AMI

[preview](https://coder.com/docs/@upgrade-tabs/install/upgrade)

---------

Co-authored-by: Brady Sullivan <brady@bsull.com>
Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-03-19 10:10:58 -04:00
4a548021c3 fix: close popover when notification settings are clicked (#17001)
When a user clicks in the notification settings does not make sense to
keep the popover open, instead, we want to close it.
2025-03-19 10:52:04 -03:00
86d907126d fix: fix overflowing text in inbox notifications (#17000)
- Break white spaces 
- Break long words in inbox notifications

**Before:**
<img width="499" alt="Screenshot 2025-03-19 at 10 10 36"
src="https://github.com/user-attachments/assets/4729cf51-0e2c-412b-b5e5-bb37a4b7d86f"
/>

**Now:**
<img width="498" alt="Screenshot 2025-03-19 at 10 10 15"
src="https://github.com/user-attachments/assets/331e8492-0114-4100-bd46-a66258741e46"
/>
2025-03-19 10:39:37 -03:00
3ac844ad3d chore(codersdk): rename WorkspaceAgent(Dev)container structs (#16996)
This is to free up the devcontainer name space for more targeted
structs.

Updates #16423
2025-03-19 10:16:14 +00:00
ef62e626c8 fix: ensure targets are propagated to inbox (#16985)
Currently the `targets` column in `inbox_notifications` doesn't get
filled. This PR fixes that. Rather than give targets special treatment,
we should put it in the payload like everything else. This correctly
propagates notification targets to the inbox table without much code
change.
2025-03-19 09:51:49 +00:00
995e9402b4 chore: don't autofocus OrganizationAutocomplete on user creation page (#16989) 2025-03-18 15:33:40 -06:00
ab8ba96707 feat: add notifications widget in the navbar (#16983)
**Preview:**
<img width="479" alt="Screenshot 2025-03-18 at 10 38 25"
src="https://github.com/user-attachments/assets/2e4cb48e-3606-478c-a68d-13465789330b"
/>

[Figma
file](https://www.figma.com/design/5kRpzK8Qr1k38nNz7H0HSh/Inbox-notifications?node-id=1-2726&t=PUsQwLrwyzXUxhf1-0)

**This PR adds:**
- Notification widget in the navbar
- Show notifications
- Option to mark each notification as read
- Update notifications in realtime 

**What is next?**
- Option to mark all the notifications as read at once
- Option to load previous notifications - Right now, it only shows the
latest 25 notifications
- Having custom icons for each type of notification

**And about tests?**
The notification widget components are well covered by the current
stories, but we definitely want to have e2e tests for it. However, in my
recent projects, I found more useful to ship the UI features first, get
feedback, change whatever needs to be changed, and then, add the e2e
tests to avoid major rework.

Related to https://github.com/coder/internal/issues/336
2025-03-18 15:21:22 -03:00
cb19fd47b0 chore: use user admin and template admin for even more e2e tests (#16974) 2025-03-18 09:11:39 -06:00
49a35e3784 chore: add e2e tests for organization auditors (#16899) 2025-03-18 09:10:42 -06:00
75b27e8f19 fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port (#16887)
* Improves separation of concerns between `runDockerInspect` and
`convertDockerInspect`: `runDockerInspect` now just runs the command and
returns the output, while `convertDockerInspect` now does all of the
conversion and parsing logic.
* Improves testing of `convertDockerInspect` using real test fixtures.
* Fixes issue where the container port is returned instead of the host
port.
* Updates UI to link to correct host port. Container port is still
displayed in the button text, but the HostIP:HostPort is shown in a
popover.
* Adds stories for workspace agent UI
2025-03-18 14:37:45 +00:00
13d0dac795 feat: display error if app is not installed (#16980)
Fixes: https://github.com/coder/coder/issues/13937
2025-03-18 14:24:02 +01:00
13a3ddd964 fix(agent/agentcontainers): generate devcontainer metadata from schema (#16881)
Adds new dcspec package containing automatically generated devcontainer schema (using glideapps/quicktype).
2025-03-18 13:00:21 +00:00
ec517657a8 chore: add targets to oom/ood notifications (#16968)
Add targets to OOM/OOD notifications to allow Coder Inbox clients to
filter on these notifications.
2025-03-18 12:59:30 +00:00
a3f6308006 fix: rewrite login type migrations (#16978)
When trying to add [system
users](https://github.com/coder/coder/pull/16916), we discovered an
issue in two migrations that added values to the login_type enum.
After some
[consideration](https://github.com/coder/coder/pull/16916#discussion_r1998758887),
we decided to retroactively correct them.
2025-03-18 14:47:30 +02:00