Skip to content

agentapi: remove boundary logic, lifecycle hooks, and hardcoded /tmp/ script paths #852

@35C4n0r

Description

@35C4n0r

Problem

Boundary installation and wrapper script logic is embedded inside the agentapi module (scripts/boundary.sh, variables in main.tf). Additionally, lifecycle hook variables (pre_install_script, install_script, post_install_script, start_script) are passed through agentapi's Terraform variables and shell script, coupling consumer module concerns into agentapi. Finally, scripts are written to /tmp/ which can conflict with other processes and isn't a stable location.

These issues mean:

  1. Boundary cannot be extracted into a standalone module (REG-2) without first removing it from agentapi.
  2. Lifecycle hooks add unnecessary coupling — consumer modules (e.g. claude-code) should manage their own install and start scripts directly rather than threading them through agentapi variables.
  3. /tmp/ script paths are fragile — multiple module instances or concurrent processes could collide.

Proposal

  • Remove all boundary-related variables and logic from the agentapi module (enable_boundary, boundary_config_path, boundary_version, compile_boundary_from_source, use_boundary_directly, scripts/boundary.sh, coder_env.boundary_config).
  • Remove lifecycle hook variables (pre_install_script, install_script, post_install_script, start_script) and their execution blocks from scripts/main.sh. Consumer modules should place their start script directly at $module_path/scripts/agentapi-start.sh.
  • Add a module_directory variable (default $HOME/.coder-modules/coder/agentapi) and write scripts there instead of /tmp/.
  • Pass the lib script path via ARG_LIB_SCRIPT_PATH instead of hardcoding /tmp/agentapi-lib.sh.
  • Update tests accordingly: remove boundary and lifecycle hook tests, write start scripts directly to the container.

Breaking changes

The following Terraform variables are removed:

  • enable_boundary
  • boundary_config_path
  • boundary_version
  • compile_boundary_from_source
  • use_boundary_directly
  • pre_install_script
  • install_script
  • post_install_script
  • start_script

Consumer modules that pass these variables will need to be updated.

Context

Prerequisite for REG-2 (Decouple boundary into its own standalone module).

🤖 Generated with Coder Agents

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions