Skip to content

SDK unsupported-action errors use exit code 64 instead of EXIT_CODE.USAGE #745

Closed

Description

@unbraind

Summary

PmClient.run() reports an unknown/unsupported action with new PmCliError(..., 64), while the public SDK contract exports EXIT_CODE.USAGE === 2. Consumers cannot reliably branch on the documented exit-code constants for this expected usage error.

Reproduction

Using @unbraind/pm-cli@2026.7.26:

import { EXIT_CODE, PmClient } from "@unbraind/pm-cli/sdk";

const client = new PmClient({ pmRoot, cwd });
try {
  await client.run("future-command", { options: {} });
} catch (error) {
  // error is a PmCliError
  // error.message: Unsupported native pm action: future-command
  // error.exitCode: 64
  // EXIT_CODE.USAGE: 2
}

The current SDK runtime contains three Unsupported native pm action throws with literal 64.

Expected

All expected SDK usage errors use the exported EXIT_CODE.USAGE constant, or the SDK exports/documentedly names a separate unsupported-action code. Prefer replacing the literals with EXIT_CODE.USAGE and adding a contract test.

Agent UX impact

Adapters that safely fall back for only unsupported actions must currently match message text or a magic number. A stable code/category would reduce integration ambiguity and prevent unsafe retries of real mutation failures.

Found while implementing unbraind/pm-web#65.

Activity

  1. coderabbitai commented on Jul 26, 2026

    @coderabbitai
    🔗 Related PRs

    #36 - [codex] Improve agent UX from manual pm audit [closed]
    #456 - Expose SDK runtime action client [merged]
    #477 - feat(sdk): expand pm primitives and lifecycle aliases [merged]
    #480 - Expose SDK package lifecycle primitives [merged]
    #549 - feat(sdk): ship history time travel, rich reads, and runtime integrity [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. unbraind commented on Jul 26, 2026

    @unbraind
    OwnerAuthor

    Tracked by pm-x4nn3z in the canonical error-contract lineage. The active follow-up replaces all three unsupported-action magic numbers with EXIT_CODE.USAGE and adds branch-level regression assertions.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions