Skip to content

feat(agentapi): Add support for running under a subdomain #297

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 16 commits into from
Aug 6, 2025

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Aug 4, 2025

Updates coder/coder#18779

A separate PR will update dependant modules goose and aider.

Description

  • Adds subdomain argument to agentapi module
  • Updates agentapi module to set AGENTAPI_CHAT_BASE_PATH to an autogenerated path if var.subdomain = false
  • Updates default agentapi version to v0.3.3 to support running without subdomain

Type of Change

  • New module
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun run fmt)
  • Changes tested locally

Related Issues

@johnstcn johnstcn self-assigned this Aug 4, 2025
@johnstcn johnstcn requested a review from Copilot August 4, 2025 20:07
Copilot

This comment was marked as outdated.

@johnstcn johnstcn changed the title Cj/agentapi/subpath fix(agentapi): Add support for running under a subdomain Aug 4, 2025
@johnstcn johnstcn changed the title fix(agentapi): Add support for running under a subdomain feat(agentapi): Add support for running under a subdomain Aug 4, 2025
@johnstcn johnstcn requested a review from Copilot August 4, 2025 20:26
Copilot

This comment was marked as outdated.

@johnstcn johnstcn requested a review from Copilot August 4, 2025 20:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_subdomain boolean 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-path when 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();

@johnstcn johnstcn marked this pull request as ready for review August 5, 2025 14:39
@johnstcn johnstcn requested a review from hugodutka August 5, 2025 14:39
@matifali matifali added the version:minor Add to PRs requiring a minor version upgrade label Aug 5, 2025
Copy link

github-actions bot commented Aug 5, 2025

❌ Version Bump Validation Failed

Bump Type: minor

Module versions need to be updated but haven't been bumped yet.

Required Actions:

  1. Run the version bump script locally: ./.github/scripts/version-bump.sh minor
  2. Commit the changes: git add . && git commit -m "chore: bump module versions (minor)"
  3. Push the changes: git push

Script Output:

🔍 Detecting modified modules...
Found modules:
registry/coder/modules/agentapi

📦 Processing: coder/agentapi
Found git tag: release/coder/agentapi/v1.0.2 (v1.0.2)
Current version: 1.0.2
New version: 1.1.0
Updating version references for coder/agentapi in registry/coder/modules/agentapi/README.md

🔧 Running formatter to ensure consistent formatting...

📋 Summary:
Bump Type: minor

Modules Updated:

- coder/agentapi: v1.0.2 → v1.1.0

READMEs Updated:

- coder/agentapi

✅ Version bump completed successfully!
📝 README files have been updated with new versions.

Next steps:
1. Review the changes: git diff
2. Commit the changes: git add . && git commit -m 'chore: bump module versions (minor)'
3. Push the changes: git push

Please update the module versions and push the changes to continue.

Copy link
Contributor

@hugodutka hugodutka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@johnstcn johnstcn merged commit 57c900b into main Aug 6, 2025
4 checks passed
@johnstcn johnstcn deleted the cj/agentapi/subpath branch August 6, 2025 11:38
DevelopmentCats pushed a commit that referenced this pull request Aug 8, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version:minor Add to PRs requiring a minor version upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants