Skip to content

agentctx sync exits 0 when the user declines confirmation, but reset and profile clear exit 1 — inconsistent CLI semantics #102

Description

@Deepam02

Files:

  • packages/agentctx/src/cli/sync.ts:69-72 — declined confirmation returns 0
  • packages/agentctx/src/cli/reset.ts:53-56 — declined confirmation returns 1
  • packages/agentctx/src/cli/profile-cmd.ts:163-166 — declined confirmation returns 1

Problem (one line): Three commands prompt for confirmation before acting; when the user answers "no", sync exits 0 while reset and profile clear exit 1, so the same "user aborted" outcome produces different exit codes.

Details

agentctx sync (after the user declines):

if (!confirmed) {
  env.io.err("aborted: CLAUDE.md unchanged");
  return 0;
}

agentctx reset:

if (!confirmed) {
  env.io.err("aborted: project context kept (pass --force to skip the prompt)");
  return 1;
}

agentctx profile clear:

if (!confirmed) {
  env.io.err("aborted: preference kept (pass --force to skip the prompt)");
  return 1;
}

All three write the "aborted" notice to stderr, but sync returns 0 where the other two return 1. Scripts that branch on the exit code (e.g. wrapping these in automation) get inconsistent signals for an identical user action. reset + profile clear form the established convention (declined = exit 1); sync is the outlier.

What "done" looks like

Pick one convention and align all three. The straightforward fix is to make sync return 1 on decline, matching reset and profile clear. (If exit 0 on decline is intended for sync, document why it differs and leave a comment — but the three should agree or the difference should be deliberate and explained.)

Scope

A one-line change plus a test asserting the chosen exit code. No architectural impact. Good for a first-time contributor; under an hour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions