-
Notifications
You must be signed in to change notification settings - Fork 146
feat: provide boundary support for agent modules #780
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
35C4n0r
merged 34 commits into
coder:main
from
shanewhite97:feat/agent-api-boundary-support
Mar 11, 2026
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
c765d9b
Add boundary support to agent api and Codex CLI Module
636ed84
fix: updated agent api logic and amended codex start script to suppro…
7b915e7
fix: resolve merge conflicts
444d387
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 350b0e7
chore: Remove codex changes to separate into another PR
658a90a
fix: bun prettier issue
9323297
Update registry/coder/modules/agentapi/scripts/main.sh
shanewhite97 8daa78a
Update registry/coder/modules/agentapi/scripts/main.sh
shanewhite97 7d7c750
feat: add validation tests for boundary
e24c551
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 3cfd67f
Merge branch 'main' of https://github.com/coder/registry into feat/ag…
6ec905c
Merge branch 'feat/agent-api-boundary-support' of https://github.com/…
18b8d41
fix: swap to using wrapper script, remove redundant variables and cop…
7002c97
docs: Added section for implementation of boundary in the agentapi RE…
7fcc6a1
fix: update tests based on new config file logic. Also ran run formatter
4b3c5aa
docs: add new line for README.md formatting
01155cc
fix: addressed latest comments on the PR. boundary_config_path remove…
43e578f
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 de2e41c
fix: formatting issues
98a3fb2
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 04e50d3
feat: provide boundary support for agent modules
6cbaedd
Merge branch 'feat/agent-api-boundary-support' of https://github.com/…
0f5f04b
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 721c916
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 51952be
feat: centralised boundary install logic into agent api module
d5f5ec9
fix: update boundary_config back to boundary_config_path
d95064c
fi: remove accidental backup submodule
1b080c1
fix: shellcheck errors
077c33d
fix: add boundary subcommand validation
shanewhite97 080b805
fix: add boundary subcommand validation
shanewhite97 963af0b
fix: add boundary sub command validation
32c0d0e
chore: ran minor bump script
dd27fc2
docs: Tidy up variable comment
shanewhite97 ce7ce10
Merge branch 'main' into feat/agent-api-boundary-support
shanewhite97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| #!/bin/bash | ||
| # boundary.sh - Boundary installation and setup for agentapi module. | ||
| # Sourced by main.sh when ENABLE_BOUNDARY=true. | ||
| # Exports AGENTAPI_BOUNDARY_PREFIX for use by module start scripts. | ||
|
|
||
| validate_boundary_subcommand() { | ||
| if command_exists coder; then | ||
| if coder boundary --help > /dev/null 2>&1; then | ||
| return 0 | ||
| else | ||
| echo "Error: 'coder' command found but does not support 'boundary' subcommand. Please enable install_boundary." | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Error: ENABLE_BOUNDARY=true, but 'coder' command not found. Boundary cannot be enabled." >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| # Install boundary binary if needed. | ||
| # Uses one of three strategies: | ||
| # 1. Compile from source (compile_boundary_from_source=true) | ||
| # 2. Install from release (use_boundary_directly=true) | ||
| # 3. Use coder boundary subcommand (default, no installation needed) | ||
| install_boundary() { | ||
| if [ "${COMPILE_BOUNDARY_FROM_SOURCE}" = "true" ]; then | ||
| echo "Compiling boundary from source (version: ${BOUNDARY_VERSION})" | ||
|
|
||
| # Remove existing boundary directory to allow re-running safely | ||
| if [ -d boundary ]; then | ||
| rm -rf boundary | ||
| fi | ||
|
|
||
| echo "Cloning boundary repository" | ||
| git clone https://github.com/coder/boundary.git | ||
| cd boundary || exit 1 | ||
| git checkout "${BOUNDARY_VERSION}" | ||
|
|
||
| make build | ||
|
|
||
| sudo cp boundary /usr/local/bin/ | ||
| sudo chmod +x /usr/local/bin/boundary | ||
| cd - || exit 1 | ||
| elif [ "${USE_BOUNDARY_DIRECTLY}" = "true" ]; then | ||
| echo "Installing boundary using official install script (version: ${BOUNDARY_VERSION})" | ||
| curl -fsSL https://raw.githubusercontent.com/coder/boundary/main/install.sh | bash -s -- --version "${BOUNDARY_VERSION}" | ||
| else | ||
|
shanewhite97 marked this conversation as resolved.
|
||
| validate_boundary_subcommand | ||
| echo "Using coder boundary subcommand (provided by Coder)" | ||
|
shanewhite97 marked this conversation as resolved.
|
||
| fi | ||
| } | ||
|
|
||
| # Set up boundary: install, write config, create wrapper script. | ||
| # Exports AGENTAPI_BOUNDARY_PREFIX pointing to the wrapper script. | ||
| setup_boundary() { | ||
| local module_path="$1" | ||
|
|
||
| echo "Setting up coder boundary..." | ||
|
|
||
| # Install boundary binary if needed | ||
| install_boundary | ||
|
|
||
| # Determine which boundary command to use and create wrapper script | ||
| BOUNDARY_WRAPPER_SCRIPT="$module_path/boundary-wrapper.sh" | ||
|
|
||
| if [ "${COMPILE_BOUNDARY_FROM_SOURCE}" = "true" ] || [ "${USE_BOUNDARY_DIRECTLY}" = "true" ]; then | ||
| # Use boundary binary directly (from compilation or release installation) | ||
| cat > "${BOUNDARY_WRAPPER_SCRIPT}" << 'WRAPPER_EOF' | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| exec boundary -- "$@" | ||
| WRAPPER_EOF | ||
| else | ||
| # Use coder boundary subcommand (default) | ||
| # Copy coder binary to strip CAP_NET_ADMIN capabilities. | ||
| # This is necessary because boundary doesn't work with privileged binaries | ||
| # (you can't launch privileged binaries inside network namespaces unless | ||
| # you have sys_admin). | ||
| CODER_NO_CAPS="$module_path/coder-no-caps" | ||
| if ! cp "$(which coder)" "$CODER_NO_CAPS"; then | ||
| echo "Error: Failed to copy coder binary to ${CODER_NO_CAPS}. Boundary cannot be enabled." >&2 | ||
| exit 1 | ||
| fi | ||
| cat > "${BOUNDARY_WRAPPER_SCRIPT}" << 'WRAPPER_EOF' | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| exec "${SCRIPT_DIR}/coder-no-caps" boundary -- "$@" | ||
| WRAPPER_EOF | ||
| fi | ||
|
|
||
| chmod +x "${BOUNDARY_WRAPPER_SCRIPT}" | ||
| export AGENTAPI_BOUNDARY_PREFIX="${BOUNDARY_WRAPPER_SCRIPT}" | ||
| echo "Boundary wrapper configured: ${AGENTAPI_BOUNDARY_PREFIX}" | ||
| } | ||
|
zedkipp marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.