feat(agentapi): Add support for running under a subdomain#297
feat(agentapi): Add support for running under a subdomain#297
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for running the agentapi module under a subdomain by introducing a new agentapi_subdomain variable. When subdomain is disabled, the module configures a custom chat base path to ensure proper routing.
Key changes:
- Added
agentapi_subdomainboolean variable with validation to ensure compatibility with agentapi >= v0.3.2 - Updated default agentapi version to v0.3.2 to support the new functionality
- Modified scripts to conditionally set
--chat-base-pathwhen subdomain is false
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| main.tf | Adds subdomain variable, validation logic, and chat base path configuration |
| scripts/main.sh | Exports AGENTAPI_CHAT_BASE_PATH environment variable |
| testdata/agentapi-start.sh | Updates agentapi server command to include --chat-base-path when needed |
| test-util.ts | Enhances container cleanup with debug mode support |
| main.test.ts | Adds comprehensive tests for subdomain functionality and version validation |
Comments suppressed due to low confidence (2)
registry/coder/modules/agentapi/main.test.ts:212
- The test case expects setup() to reject with validation errors, but setup() may not be the function that performs Terraform validation. Consider testing the validation logic more directly or ensuring this test actually triggers the validation failure.
expect(setup({ moduleVariables: moduleVariables as Record<string, string> })).rejects.toThrow(shouldThrow);
registry/coder/modules/agentapi/main.test.ts:214
- The test expects setup() to resolve, but doesn't await the promise. This could lead to unhandled promise rejections or false positive test results. Consider using 'await expect(setup(...)).resolves.toBeDefined()' or properly handling the async expectation.
expect(setup({ moduleVariables: moduleVariables as Record<string, string> })).resolves.toBeDefined();
❌ Version Bump Validation FailedBump Type: Module versions need to be updated but haven't been bumped yet. Required Actions:
Script Output:
|
… AGENTAPI_CHAT_BASE_PATH will land
hugodutka
left a comment
There was a problem hiding this comment.
Other than the comments I left, the PR looks good to me. 👍 Please address them before merging. I'll release agentapi v0.3.3 shortly.
Updates coder/coder#18779 Builds on #297 ## Description Adds support for specifying `subdomain = false` in the agentapi module. Change added in #297 NOTE: `AGENTAPI_CHAT_BASE_PATH` is exported before running `main.sh` in agentapi, so this environment variable is available to calling modules if `var.subdomain = false`. ## Type of Change - [ ] New module - [ ] Bug fix - [X] Feature/enhancement - [ ] Documentation - [ ] Other ## Testing & Validation - [X] Tests pass (`bun test`) - [X] Code formatted (`bun run fmt`) - [X] Changes tested locally ## Related Issues coder/coder#18779
Updates coder/coder#18779
A separate PR will update dependant modules
gooseandaider.Description
subdomainargument toagentapimoduleagentapimodule to setAGENTAPI_CHAT_BASE_PATHto an autogenerated path ifvar.subdomain = falseagentapiversion tov0.3.3to support running without subdomainType of Change
Testing & Validation
bun test)bun run fmt)Related Issues
"user" must be an existing uuid or username.coder#18779