Skip to content

Conversation

@35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Feb 6, 2026

Description

The Agent Helper module is a building block for modules that need to run multiple scripts in a specific order. It uses coder exp sync for dependency management and is designed for orchestrating pre-install, install, post-install, and start scripts.

Type of Change

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

Module Information

Path: registry/coder/modules/agent-helper
New version: v1.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 6, 2026

wip: do not review

@35C4n0r 35C4n0r self-assigned this Feb 6, 2026
@35C4n0r 35C4n0r marked this pull request as ready for review February 9, 2026 13:43
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: 31b21247ee

ℹ️ 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".

Comment on lines 64 to 67
pre_install_script_name = "${var.agent_name}-pre_install_script"
install_script_name = "${var.agent_name}-install_script"
post_install_script_name = "${var.agent_name}-post_install_script"
start_script_name = "${var.agent_name}-start_script"

Choose a reason for hiding this comment

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

P1 Badge Namespace sync keys per module instance

Deriving all coder exp sync keys solely from agent_name makes different instances of this helper collide when they target the same agent (which the README explicitly recommends when used with agentapi). In that setup, both instances emit names like myagent-install_script, so one instance can satisfy the other instance’s want dependency and allow start_script to run before its own install/post-install sequence has finished. Include a per-instance discriminator (for example module_dir_name or another unique input) in these sync key names to prevent cross-module orchestration races.

Useful? React with 👍 / 👎.

Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

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

LGTM. It should help simplify the individual agent scripts, making them way more ergonomic to maintain. Thanks, Jay.

variable "install_script" {
type = string
description = "Script to install the agent used by AgentAPI."
default = ""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
default = ""
default = null

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

2 participants