Skip to content

Handle missing v2 job budgets in non-TTY job list output #39

@antfleet-ops

Description

@antfleet-ops

AntFleet two-model review found a crash in the non-TTY formatter for job list.

Summary

The TTY output path handles active v2 jobs without a budget by printing N/A, but the non-TTY output path unconditionally calls BigInt(j.budget) for every non-legacy job. If a valid active v2 job has no budget, acp job list | cat or any scripted/non-TTY invocation throws instead of printing the job list.

Evidence

  • src/commands/job.ts: TTY branch handles missing budget as N/A
  • src/commands/job.ts: non-TTY branch formats budget with BigInt(j.budget) without checking presence

Impact

Scripted consumers and piped invocations can fail on valid job data that the interactive TTY path already treats as expected.

Reproduction shape

  1. Mock or return an active non-legacy/v2 job with budget missing, null, or undefined.
  2. Force non-TTY output, for example acp job list | cat.
  3. The command attempts BigInt(j.budget) and throws before printing the list.

Suggested fix

Use the same missing-budget handling in the non-TTY branch as the TTY branch. Emit N/A or an empty field unless j.budget is present before calling BigInt.

Suggested regression test

Mock getActiveJobs() to return a non-legacy job without budget, force isTTY() false, run the job list action, and assert it prints a row rather than throwing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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