Skip to content

cmd acp silently ignores --mod / --mod-option (verified 1.82.1) #1017

Open

Description

@ApexYash11

Summary

cmd acp --mod ./x.ts exits 0 but never loads the mod. The flags are silently
dropped: no error, no warning, no [mods] entry in the debug log — including
for a nonexistent path, which normally warns "mod path not found". This also
breaks --mod-option, and leaves agent clients driving Chat over ACP with no
per-session system-prompt channel.

Expected Behavior

cmd acp --mod ./x.ts loads the mod exactly as the TUI does today
(cmd --mod ./x.ts), including appendSystemPrompt hooks and --mod-option
values for mod-declared flags. projectMods stays disabled under ACP.

Actual Behavior

The mod is never discovered or loaded. The debug log shows the args: line
then a bare subcommand: acp — no parsed options: line, no [mods] entry.
A bad path produces no warning. (User-scope ~/.commandcode/mods/ still loads
under ACP, so the engine supports mods here — only the flag forward is missing.)

Steps to reproduce

  1. Create a sentinel mod at a temp path:
    export default function (cmd) {
      cmd.hooks({ appendSystemPrompt: () => 'REPRO-SENTINEL-1234' })
    }
  2. Run A (valid mod), piping empty stdin so the process exits:
    DEBUG=true cmd acp --mod <sentinel> --skip-onboarding --no-auto-update --trust
  3. Run B (bad path):
    DEBUG=true cmd acp --mod <tmp>/does-not-exist-xyz.ts --skip-onboarding --no-auto-update --trust
  4. Read ~/.commandcode/logs/command.log, newest entries only.

Surface / entry path

ACP (cmd acp). TUI (cmd --mod) works — only ACP drops the flags.

Exact command

cmd acp --mod C:\Users\ACER\AppData\Local\Temp\opencode\cc-sandbox\sentinel-mod.ts --skip-onboarding --no-auto-update --trust

Debug log excerpt (1.82.1, DEBUG=true)

Run A — valid mod, never loaded:

02:29:53.024  > [Startup]  args: acp --mod ...\cc-sandbox\sentinel-mod.ts --skip-onboarding --no-auto-update --trust
02:29:53.368  - [cmd]      subcommand: acp
(nothing follows: no options: line, no [mods] entry for sentinel-mod.ts)

Run B — nonexistent path, no warning:

02:29:58.278  > [Startup]  args: acp --mod ...\cc-sandbox\does-not-exist-xyz.ts --skip-onboarding --no-auto-update --trust
02:29:58.618  - [cmd]      subcommand: acp
(nothing follows: no "mod path not found" warning)

Root cause (from shipped dist/cli.mjs)

  1. createAcpCommand() declares no options — acp --help shows only --help,
    while the root command declares --mod <path> / --mod-option <name=value>.
  2. runAcp() calls loadCommandModHost({ projectMods: !1 }) without ever
    calling setModPathsOverride() / setModOptionsOverride().
  3. The only call site of those two setters is interactiveModeAction
    (n.mod && ... && setModPathsOverride(n.mod), n.modOption && ... && ...).

Suggested fix

In the ACP entry path, declare both flags (repeatable, same help text as the
root command) and forward them via setModPathsOverride() /
setModOptionsOverride() before loadCommandModHost() runs — mirroring
interactiveModeAction. Keep projectMods: !1. No-flag invocations must
behave byte-identically.

Environment

  • Command Code version: 1.82.1 (also reproduced on 1.79.2)
  • Operating system: Windows
  • Shell: PowerShell 5.1

Additional context

session/new over ACP reads only cwd + mcpServers, ignoring _meta, so there
is currently no alternate per-session channel for what --mod provides.
Happy to verify candidate builds against the sentinel repro above.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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