Skip to content

Commit 213aabb

Browse files
authored
fix(registry/modules/goose): default subdomain to false (#420)
Relates to coder/coder#18779 See also #419 By default, we set subdomain = true. Most folks testing this out don't have a wildcard subdomain setup. This switches to path-based behaviour by default and adds a note to the troubleshooting section.
1 parent 2937286 commit 213aabb

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

registry/coder/modules/goose/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run the [Goose](https://block.github.io/goose/) agent in your workspace to gener
1313
```tf
1414
module "goose" {
1515
source = "registry.coder.com/coder/goose/coder"
16-
version = "2.1.1"
16+
version = "2.1.2"
1717
agent_id = coder_agent.example.id
1818
folder = "/home/coder"
1919
install_goose = true
@@ -79,7 +79,7 @@ resource "coder_agent" "main" {
7979
module "goose" {
8080
count = data.coder_workspace.me.start_count
8181
source = "registry.coder.com/coder/goose/coder"
82-
version = "2.1.1"
82+
version = "2.1.2"
8383
agent_id = coder_agent.example.id
8484
folder = "/home/coder"
8585
install_goose = true
@@ -123,4 +123,6 @@ Note: The indentation in the heredoc is preserved, so you can write the YAML nat
123123

124124
## Troubleshooting
125125

126+
By default, this module is configured to run the embedded chat interface as a path-based application. In production, we recommend that you configure a [wildcard access URL](https://coder.com/docs/admin/setup#wildcard-access-url) and set `subdomain = true`. See [here](https://coder.com/docs/tutorials/best-practices/security-best-practices#disable-path-based-apps) for more details.
127+
126128
The module will create log files in the workspace's `~/.goose-module` directory. If you run into any issues, look at them for more information.

registry/coder/modules/goose/main.test.ts

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
test,
33
afterEach,
44
describe,
5+
it,
56
setDefaultTimeout,
67
beforeAll,
78
expect,
@@ -253,22 +254,41 @@ describe("goose", async () => {
253254
expect(prompt.stderr).toContain("No such file or directory");
254255
});
255256

256-
test("subdomain-false", async () => {
257-
const { id } = await setup({
258-
agentapiMockScript: await loadTestFile(
259-
import.meta.dir,
260-
"agentapi-mock-print-args.js",
261-
),
262-
moduleVariables: {
263-
subdomain: "false",
264-
},
257+
describe("subdomain", async () => {
258+
it("sets AGENTAPI_CHAT_BASE_PATH when false", async () => {
259+
const { id } = await setup({
260+
agentapiMockScript: await loadTestFile(
261+
import.meta.dir,
262+
"agentapi-mock-print-args.js",
263+
),
264+
moduleVariables: {
265+
subdomain: "false",
266+
},
267+
});
268+
269+
await execModuleScript(id);
270+
271+
const agentapiMockOutput = await readFileContainer(id, agentapiStartLog);
272+
expect(agentapiMockOutput).toContain(
273+
"AGENTAPI_CHAT_BASE_PATH=/@default/default.foo/apps/goose/chat",
274+
);
265275
});
266276

267-
await execModuleScript(id);
277+
it("does not set AGENTAPI_CHAT_BASE_PATH when true", async () => {
278+
const { id } = await setup({
279+
agentapiMockScript: await loadTestFile(
280+
import.meta.dir,
281+
"agentapi-mock-print-args.js",
282+
),
283+
moduleVariables: {
284+
subdomain: "true",
285+
},
286+
});
268287

269-
const agentapiMockOutput = await readFileContainer(id, agentapiStartLog);
270-
expect(agentapiMockOutput).toContain(
271-
"AGENTAPI_CHAT_BASE_PATH=/@default/default.foo/apps/goose/chat",
272-
);
288+
await execModuleScript(id);
289+
290+
const agentapiMockOutput = await readFileContainer(id, agentapiStartLog);
291+
expect(agentapiMockOutput).toMatch(/AGENTAPI_CHAT_BASE_PATH=$/m);
292+
});
273293
});
274294
});

registry/coder/modules/goose/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ variable "agentapi_version" {
6969
variable "subdomain" {
7070
type = bool
7171
description = "Whether to use a subdomain for AgentAPI."
72-
default = true
72+
default = false
7373
}
7474

7575
variable "goose_provider" {

0 commit comments

Comments
 (0)