Skip to content

Conversation

@35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Feb 3, 2026

Description

  • enhance start script and configuration options for AgentAPI server

Type of Change

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

Module Information

Path: registry/coder/modules/agentapi
New version: v3.0.0
Breaking change: [x] Yes [ ] No

Testing & Validation

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

Related Issues

Closes: #696
Closes: #698

@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Feb 3, 2026

wip: do not review

@35C4n0r 35C4n0r self-assigned this Feb 4, 2026
@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Feb 4, 2026

This PR has been tested with claude-code module.

Subject: [PATCH] Changes
---
Index: registry/coder/modules/claude-code/scripts/start.sh
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/registry/coder/modules/claude-code/scripts/start.sh b/registry/coder/modules/claude-code/scripts/start.sh
--- a/registry/coder/modules/claude-code/scripts/start.sh	(revision b580ec2abb8ac74d8cd4f266012abe7f947fe02a)
+++ b/registry/coder/modules/claude-code/scripts/start.sh	(date 1770213130569)
@@ -6,7 +6,6 @@
   command -v "$1" > /dev/null 2>&1
 }
 
-MODULE_PATH="$HOME/.claude-module"
 ARG_RESUME_SESSION_ID=${ARG_RESUME_SESSION_ID:-}
 ARG_CONTINUE=${ARG_CONTINUE:-false}
 ARG_DANGEROUSLY_SKIP_PERMISSIONS=${ARG_DANGEROUSLY_SKIP_PERMISSIONS:-}
@@ -217,7 +216,6 @@
 
   printf "Running claude code with args: %s\n" "$(printf '%q ' "${ARGS[@]}")"
 
-  # Write the agent command to agent-command.sh
   if [ "$ARG_ENABLE_BOUNDARY" = "true" ]; then
     install_boundary
 
@@ -240,28 +238,12 @@
       BOUNDARY_CMD=("$CODER_NO_CAPS" "boundary")
     fi
 
-    # Build properly quoted command arguments
-    boundary_cmd=$(printf '%q ' "${BOUNDARY_CMD[@]}" "${BOUNDARY_ARGS[@]}")
-    claude_args=$(printf '%q ' "${ARGS[@]}")
-
-    # Write command to agent-command.sh with boundary
-    cat > "$MODULE_PATH/agent-command.sh" << EOF
-#!/bin/bash
-${BOUNDARY_CMD[@]} -- claude ${ARGS[@]}
-EOF
+    agentapi server --type claude --term-width 67 --term-height 1190 -- \
+      "${BOUNDARY_CMD[@]}" "${BOUNDARY_ARGS[@]}" -- \
+      claude "${ARGS[@]}"
   else
-    # Build properly quoted command arguments
-    claude_args=$(printf '%q ' "${ARGS[@]}")
-
-    # Write command to agent-command.sh without boundary
-    cat > "$MODULE_PATH/agent-command.sh" << EOF
-#!/bin/bash
-claude ${ARGS[@]}
-EOF
+    agentapi server --type claude --term-width 67 --term-height 1190 -- claude "${ARGS[@]}"
   fi
-
-  chmod +x "$MODULE_PATH/agent-command.sh"
-  printf "Agent command written to %s\n" "$MODULE_PATH/agent-command.sh"
 }
 
 validate_claude_installation
Index: registry/coder/modules/claude-code/main.tf
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf
--- a/registry/coder/modules/claude-code/main.tf	(revision b580ec2abb8ac74d8cd4f266012abe7f947fe02a)
+++ b/registry/coder/modules/claude-code/main.tf	(date 1770213130569)
@@ -362,8 +362,8 @@
 }
 
 module "agentapi" {
-  source = "git::https://github.com/coder/registry.git//registry/coder/modules/agentapi?ref=35C4n0r/feat-agentapi-architecture-improv"
-  # version = "2.0.0"
+  source  = "registry.coder.com/coder/agentapi/coder"
+  version = "2.0.0"
 
   agent_id             = var.agent_id
   web_app_slug         = local.app_slug
@@ -377,7 +377,6 @@
   cli_app_display_name = var.cli_app ? var.cli_app_display_name : null
   agentapi_subdomain   = var.subdomain
   module_dir_name      = local.module_dir_name
-  agentapi_server_type = "claude"
   install_agentapi     = var.install_agentapi
   agentapi_version     = var.agentapi_version
   pre_install_script   = var.pre_install_script
@@ -386,7 +385,6 @@
      #!/bin/bash
      set -o errexit
      set -o pipefail
-
      echo -n '${base64encode(local.start_script)}' | base64 -d > /tmp/start.sh
      chmod +x /tmp/start.sh
 

@35C4n0r 35C4n0r marked this pull request as draft February 6, 2026 18:04
@35C4n0r 35C4n0r force-pushed the 35C4n0r/feat-agentapi-architecture-improv branch from a5f1c17 to 01873e3 Compare February 9, 2026 13:37
@35C4n0r 35C4n0r marked this pull request as ready for review February 10, 2026 02:40
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dddb96b20

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}

module "agent-helper" {
source = "git::https://github.com/coder/registry.git//registry/coder/modules/agent-helper?ref=35C4n0r/feat-agent-helper-module"

Choose a reason for hiding this comment

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

P1 Badge Pin agent-helper source to an immutable module ref

This source points to a mutable feature branch (?ref=35C4n0r/feat-agent-helper-module) on GitHub, so module behavior is not reproducible and can break terraform init if the branch is deleted or rewritten; it also introduces a hard external fetch to GitHub for every consumer. Please use an immutable commit/tag (or a published registry module version) so existing workspaces do not fail unexpectedly.

Useful? React with 👍 / 👎.

ARG_GOOSE_VERSION='${var.goose_version}' \
/tmp/install.sh
EOT
agentapi_server_type = "claude"

Choose a reason for hiding this comment

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

P2 Badge Rename README input to the actual agent_name variable

The usage example now sets agentapi_server_type, but this module does not define that input and instead requires agent_name; users copy-pasting this snippet will get an Unsupported argument error at plan/apply time and cannot configure the module successfully.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move install and start scripts to run within modules via coder_scripts Improve agentapi module abstraction for configuration and flags

1 participant