feat(claude-code): add web_app variable to disable the web app#764
feat(claude-code): add web_app variable to disable the web app#764blinkagent[bot] wants to merge 7 commits intomainfrom
web_app variable to disable the web app#764Conversation
Adds a `web_app` variable (default: true) to both the claude-code and agentapi modules. When set to false, AgentAPI still runs but the web UI app icon is not shown in the Coder dashboard. This mirrors the existing `cli_app` toggle pattern.
The claude-code module needs to reference the local agentapi module so that both sets of changes are tested together. This should be reverted to the registry source before merging once agentapi is published with the web_app variable.
The claude-code module must use the published agentapi registry source. The web_app variable is added to claude-code for future use, but the pass-through to agentapi is deferred until agentapi is published with web_app support.
|
While this is technically possible to add. I think we may need a better solution for this since the tasks ui will not work unless the claude-code coder app is available in the workspace. |
|
|
||
| variable "web_app" { | ||
| type = bool | ||
| description = "Whether to create the web workspace app. Note: the web app is required for Coder Tasks (coder_ai_task) — do not disable this if you are using Tasks." |
There was a problem hiding this comment.
Can we just ignore this input in that case?
There was a problem hiding this comment.
Not really — the coder_app "agentapi_web" resource that we need to conditionally create lives in this module (agentapi), so the variable needs to be here to control the count. The claude-code module just passes it through.
That said, as noted in the issue comment, this has a limitation: disabling the web app breaks Tasks (coder_ai_task) since it depends on the task_app_id output from this app. So this is only useful for non-Tasks use cases where someone wants claude-code running via CLI only without the web UI in the dashboard.
There was a problem hiding this comment.
What I am saying is that we ignore the variable value in case it's a task. But I guess we don't know that yet.
There was a problem hiding this comment.
Good call — we actually do know! The agentapi module already has data "coder_task" "me" {}. I've added a local that checks try(data.coder_task.me.enabled, false) and forces the web app on when it's a Task:
locals {
is_task = try(data.coder_task.me.enabled, false)
web_app = var.web_app || local.is_task
}So now web_app = false is safe to use — it'll be ignored when the workspace is a Task.
Uses data.coder_task.me.enabled to detect if the workspace is a Task and forces the web app on regardless of the web_app variable, since coder_ai_task requires the app to function. This makes it safe to set web_app = false without worrying about breaking Tasks.
Adds a
web_appvariable (default:true) to both theclaude-codeandagentapimodules. When set tofalse, AgentAPI still runs but the web UI app icon is not shown in the Coder dashboard.This mirrors the existing
cli_apptoggle pattern.Changes
agentapimoduleweb_appvariable (bool, defaulttrue)coder_app.agentapi_webnow hascount = local.web_app ? 1 : 0local.web_appis computed asvar.web_app || local.is_task, whereis_task = try(data.coder_task.me.enabled, false). This means the web app is always created when the workspace is a Task, regardless of theweb_appvariable.task_app_idoutput returns""whenlocal.web_appisfalseclaude-codemoduleweb_appvariable (bool, defaulttrue) — added for future useTODOcomment to wireweb_appthrough to agentapi once the agentapi module is published withweb_appsupportUsage (once fully wired)
Setting
web_app = falseis safe even in templates that usecoder_ai_task— the module detects Tasks viadata.coder_task.me.enabledand automatically enables the web app.Merge strategy
This needs to land in two steps:
web_appsupport, and adds theweb_appvariable to claude-code (not yet wired through)TODOwithweb_app = var.web_app