Skip to content

refactor(registry/coder/modules/aider)!: remove agentapi, tasks and start logic - #1178

Merged
35C4n0r merged 4 commits into
mainfrom
35C4n0r/migrate-aider
Oct 27, 2026
Merged

35C4n0r merged 4 commits into
mainfrom
35C4n0r/migrate-aider

Conversation

@35C4n0r

@35C4n0r 35C4n0r commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes REG-80

Refactor coder/aider to install and configure Aider only, matching the claude-code, codex, copilot, cursor-cli, opencode, and kiro-cli migrations. Changes beyond the AgentAPI removal are limited to what the current Aider docs require.

  • Replace the agentapi module with coder-utils; drop Tasks/web-app inputs (order, group, report_tasks, subdomain, cli_app, web_app_display_name, cli_app_display_name, install_agentapi, agentapi_version, ai_prompt, system_prompt), the unused experiment_additional_extensions, and the start script.
  • Install with the documented one-liner installer (https://aider.chat/install.sh) instead of apt-get install pipx + aider-install. With install_aider = false, only check aider is on PATH.
  • api_key and model are exported through coder_env (provider key env var, AIDER_MODEL) instead of being rendered into the start script. ollama now maps to OLLAMA_API_KEY.
  • base_aider_config is written verbatim to ~/.aider.conf.yml, where Aider actually reads it.
  • workdir is optional and created if missing.
  • Add scripts output; README reduced to examples and doc links; rewrite tests. Bump to 3.0.0.
Decision log
Topic Aider reality (current docs, aider --help 0.86.2) Decision
Install Docs one-liner curl -LsSf https://aider.chat/install.sh | sh installs uv and aider-chat@latest into ~/.local/bin; no version argument Official installer, always run when install_aider = true; no version input since the installer cannot pin
Config file Loaded from home, git root, and cwd only; ~/.config/aider/.aider.conf.yml (old target) is ignored Write ~/.aider.conf.yml; drop the old re-indent, which produced invalid YAML for configs with more than one top-level key
Model --model reads AIDER_MODEL; env wins over the config file coder_env AIDER_MODEL; drop the unused --ollama-model local (flag does not exist)
API keys Provider env vars; Ollama uses OLLAMA_API_BASE and OLLAMA_API_KEY, OLLAMA_HOST is not read; Azure also reads AZURE_OPENAI_API_* Keep the provider map, change ollama to OLLAMA_API_KEY; skip the env when custom has no custom_env_var_name
MCP Aider has no MCP support No mcp input
Workdir No trust prompt Optional, created if missing
Validations Existing ai_provider validation guards the env var lookup Kept; none added
system_prompt, experiment_additional_extensions system_prompt only prefixed the Tasks prompt; experiment_additional_extensions was never referenced Removed

Testing

  • terraform test (10 passed), bun test main.test.ts (10 passed, container-based), terraform fmt, terraform validate, prettier, shellcheck on the rendered install script, readmevalidation
  • Local codercom/enterprise-node:latest container running the rendered install script with the real installer: Aider 0.86.2 installed, CODER_SCRIPT_BIN_DIR symlink created, workdir created, ~/.aider.conf.yml loaded by aider --verbose (read, dark-mode), AIDER_MODEL overrides the config model, second run succeeds, real Anthropic call through Coder AI Gateway answered and followed the read conventions file
  • Dogfood workspace from a test template: real install (Aider 0.86.2 in ~/.local/bin), workdir created, ~/.aider.conf.yml matches base_aider_config, script order pre_install, install, post_install, then a downstream coder exp sync script; AIDER_MODEL set; aider --message through Coder AI Gateway answered

Generated with Coder Agents.

@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

REG-80

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Module Scorecard Check

coder/aider: 43 → 60

✅ Score improvement: 43 → 60 (+17).

Theme Before After
Presentation & Onboarding 6 / 17 12 / 17
Integration 10 / 25 10 / 25
Credential Hygiene 16 / 20 16 / 20
Restricted-Environment 0 / 20 7 / 20
Engineering Quality 8 / 10 10 / 10
Overall 43 / 100 60 / 100
Full scorecard for this PR
Presentation & Onboarding Agent Integration Credential Hygiene Restricted-Environment Readiness Engineering Quality Overall
12 / 17 10 / 25 16 / 20 7 / 20 10 / 10 60 / 100
Drilldown

Presentation & Onboarding — 12 / 17

Criterion Max Score Notes
Configuration-mode examples 12 12 README covers multiple major modes: standalone mode with launcher coder_app, custom provider (ai_provider = "custom" + custom_env_var_name), configuration file (base_aider_config), and the scripts output for sync ordering. Each example has sensible defaults.
Visual preview 5 0 No image, GIF, or video anywhere in the README; only an icon reference.

Credential Hygiene — 16 / 20

Criterion Max Score Notes
Secrets marked sensitive 16 16 api_key is declared sensitive = true in main.tf. All README examples reference var.gemini_api_key, var.anthropic_api_key, var.deepseek_api_key — no inline literal or placeholder keys appear.
Non-hardcoded auth path 4 0 No documented ServiceAccount/IAM/OAuth/AI-Gateway alternative to pasting an API key; the only path shown is a Terraform variable holding the raw key.

Restricted-Environment Readiness — 7 / 20

Criterion Max Score Notes
Mirrorable artifact source 5 0 Install script hardcodes https://aider.chat/install.sh in install_with_official_installer(); no module variable overrides this download URL.
Bring-your-own binary 10 5 install_aider = false skips install and validates an existing aider on PATH (tested in main.test.ts), but this mode is only described in the main.tf variable description, not demonstrated or called out in README prose/examples — under-documented.
Egress transparency 3 0 No dedicated network/air-gapped section; the install URL only appears in source code, not in a README endpoints section.
Runs without sudo 2 2 install.sh.tftpl never invokes sudo; installs to ~/.local/bin and writes to user-owned files only.

Engineering Quality — 10 / 10

Criterion Max Score Notes
Input quality 6 6 All variables have clear descriptions and sensible defaults; ai_provider has a validation block constraining allowed values.
Test coverage 4 4 main.tftest.hcl covers business logic (env var selection per provider, workdir trimming, config encoding, scripts output ordering, validation failure). main.test.ts runs end-to-end container tests covering install/skip-install paths, secret leakage checks, config file writes, and PATH/symlink behavior.

Agent Integration — 10 / 25

Criterion Max Score Notes
AI governance 10 0 No mention of Coder AI Gateway or Agent Firewall; the v3 changelog explicitly states AgentAPI support was dropped, which counts as absent per calibration.
Dashboard entry point 5 5 README's "Standalone mode with a launcher app" example explicitly defines a coder_app resource to launch Aider.
Session continuity 5 0 No documented resume/session-ID support or persistent session manager (tmux/screen) for reconnecting to an Aider session.
Managed configuration 5 5 base_aider_config variable is documented with a full example, writing YAML config to ~/.aider.conf.yml.

Overall — 60 / 100

Raw 55 / 92 → round(55 / 92 × 100) = 60

Tip

You can run this locally by telling your agent: "review this module against .github/scorecard/SCORECARD.md".


Scored against SCORECARD.md with solstice-1. Language-model scores are advisory.

@coder

coder Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Automated review requested by @matifali. Please sanity-check before acting on it.

Summary

This PR replaces the agentapi module with coder-utils (install only, no start script). It drops the Tasks/web-app inputs, moves api_key and model to coder_env, switches the install to the official aider.chat/install.sh, writes the config to ~/.aider.conf.yml (the path Aider actually reads), and adds the scripts output. It follows the codex/claude-code pattern closely.

Checks

Area Result
Correctness main.tf is valid and self-consistent. No variable references point at removed inputs. The template vars (ARG_INSTALL, ARG_WORKDIR, ARG_AIDER_CONFIG) match the .tftpl. $$ escaping is correct. The install → workdir → config flow makes sense.
Leftovers None in module code. The only agentapi mentions are the README migration note and the test helper import (main.test.ts:21) plus a negative assertion (main.test.ts:197). No report_tasks, coder_ai_task, CODER_MCP_*, 3284, app_slug, exp mcp, or prompt left.
Breaking change Major bump to 3.0.0. All 5 README examples use 3.0.0. The ! in the PR title and the README [!WARNING] (README.md:24-25) list the removed inputs and behavior changes.
Tests main.tftest.hcl was rewritten (10 runs: defaults, workdir trim, provider→env mapping incl. ollama/custom/missing custom name, invalid provider, config encoding, scripts output). main.test.ts was rewritten (10 container tests: BYO binary, missing binary, installer invocation/env, download failure, symlink, workdir, config verbatim, existing config preserved, API key isolation, pre/post). Tests were rewritten, not just deleted.
CI All green: CI (TS tests 10/10 pass, Terraform tests, validate, shellcheck, set -u), fmt/typos, README validation, golangci-lint, scorecard (43 → 60).
Reviews No reviews or review comments yet. Only bot comments (Linear linkback, scorecard).
Series consistency Matches codex/claude-code: workdir default null + trimsuffix, module_dir_name = .coder-modules/<ns>/<name>, coder-utils 0.0.1, same scripts output description, same README layout (warning, launcher-app example, serialize example, troubleshooting).

Findings

should-fix

  1. Aider is reinstalled on every workspace start. scripts/install.sh.tftpl:94-113: with install_aider = true (the default), the official installer always runs. That installer runs uv tool install --force ... aider-chat@latest (line 1181 of the upstream install.sh), so on persistent homes every start re-resolves and force-reinstalls aider and its heavy deps (scipy etc.). The old install.sh:27-31 skipped the install when aider was already on PATH. This slows startup, adds a network dependency on every boot, and silently upgrades aider. Suggested fix: before calling the installer, short-circuit when $HOME/.local/bin/aider (or command -v aider) already works, e.g. if ensure_aider_in_path 2>/dev/null; then echo "Aider already installed"; return; fi. If an "always upgrade" behavior is intended, document it in the README.
  2. Not merge-ready per the PR's own note. The PR is a draft, and the dogfood workspace install never completed (full Docker host disk). Re-run the dogfood check (at least one real coder-utils pipeline run with the real installer) before marking it ready.

nit
3. scripts/install.sh.tftpl:122-131 / README.md:95: base_aider_config overwrites ~/.aider.conf.yml on every start, which clobbers user edits. The old module did the same at a different path, so it's fine, but say so in the README ("overwritten on each start").
4. README.md:25 migration note: also mention that (a) install moved from apt-get install pipx + aider-install to the official uv-based installer (no sudo/apt needed; leftover ~/.aider-module and ~/.config/aider/.aider.conf.yml from v2 are no longer used), and (b) for Ollama, users still need OLLAMA_API_BASE (set via their own coder_env), since api_key now maps to OLLAMA_API_KEY instead of the old OLLAMA_HOST.
5. main.test.ts:18-21: import from ../agentapi/test-util like claude-code/main.test.ts:18. The ../../../coder/modules/... form is only needed from coder-labs. Separately, the whole series depends on coder/modules/agentapi/test-util.ts. If the agentapi module gets deleted later, move extractCoderEnvVars / writeExecutable into ~test first.
6. main.tf:2: required_version = ">= 1.0", while the merged series modules use >= 1.9 (codex/main.tf:2, claude-code/main.tf:2). Align for consistency.
7. PR body footer says "Generated with Coder Agents." AGENTS.md asks for the model name too.
8. Optional follow-up, not for this PR: codex/claude-code expose enable_ai_gateway. The PR tested through AI Gateway manually, so a README example (or the input) would help parity and would pick up the scorecard's AI-governance points.

Verdict: approve with nits

Approve once #1 is addressed (or explicitly justified and documented) and dogfood is re-run. The rest are nits.

@35C4n0r

35C4n0r commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Re should-fix #1 (Aider is reinstalled on every workspace start): leaving this as is, intentionally.

With install_aider = true the module always runs the official installer, which matches claude-code and codex on main: neither skips the install when the binary is already present. We don't do installed-binary or installed-version checks in the migrated agent modules.

  • There is no version input, so the reinstall cannot conflict with a pinned version; it keeps Aider on the latest release.
  • To avoid the reinstall, set install_aider = false; the module then only checks that a working aider is on PATH.

Generated with Coder Agents.

@35C4n0r
35C4n0r marked this pull request as ready for review October 16, 2026 18:01
Comment thread registry/coder/modules/aider/scripts/install.sh.tftpl
@35C4n0r
35C4n0r requested a review from Edd88-pixel October 27, 2026 15:20
@35C4n0r
35C4n0r enabled auto-merge (squash) October 27, 2026 15:20
@35C4n0r 35C4n0r added the version:major Add to PRs requiring a major version upgrade label Oct 27, 2026
@35C4n0r 35C4n0r self-assigned this Oct 27, 2026
@35C4n0r
35C4n0r merged commit 66c5ac0 into main Oct 27, 2026
5 checks passed
@35C4n0r
35C4n0r deleted the 35C4n0r/migrate-aider branch October 27, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:major Add to PRs requiring a major version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants