Skip to content

afx cleanup -p rejects a project number with leading zeros (0466) that afx send accepts #2002

Backlog

Description

@waleedkadous

Problem

afx cleanup -p 0466 fails with Builder not found for project: 0466, while afx cleanup -p 466 finds the builder. afx send 0466 "…" works, because afx send ignores leading zeros. The same number has to be typed two different ways depending on the command.

Root cause

findProjectBuilder in packages/codev/src/agent-farm/commands/cleanup.ts compares the typed id as a string: an exact match on the builder id, then (for a task-… name) the task builder id, then builder.name.includes(projectId). A builder for project 466 is builder-spir-466, and that name does not contain 0466, so none of the three steps matches.

(Before the cleanup fix for all-digit task builders, PR #1994, the same three comparisons sat inline in cleanup(); the gap is older than that PR and was left out of it on purpose.)

Fix

Normalise an all-digit project id by stripping leading zeros before the lookup in findProjectBuilder, the same way afx send resolves a bare number. Leave ids that are not all digits unchanged (task-0042 is a task short id, not a number).

Check afx cleanup --issue for the same gap while there. Two neighbouring lookups have their own issues and are not this one: the -i / -p bugfix-<n> lookup against Tower-canonical ids (issue #1799) and the missing name fallback for -i (issue #1445).

Testing

A unit test on findProjectBuilder: 0466 and 466 both return the builder named builder-spir-466; 0466 does not return a builder for project 4660; task-0042 still resolves as a task. No load is needed to reproduce: the function is pure.

Activity

  1. added
    area/tower
    on Nov 27, 2026
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

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions