Skip to content

engine: fleet-run-manifest's bare-string repo entries default maxConcurrentWorktrees from the wrong constant #9324

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

normalizeRepoList in packages/loopover-engine/src/fleet-run-manifest.ts (~lines 90-102) parses
each entry of a fleet-run manifest's repos list, computing a per-repo maxConcurrentWorktrees.

For a bare-string repo entry ("owner/repo"), the default is initialized as:

let maxConcurrentWorktrees = DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees;

— reusing the fleet-wide total worktree default constant for a per-repo value.

For an object-form repo entry ({ repoFullName, maxConcurrentWorktrees }), the same
conceptual default is instead computed via:

maxConcurrentWorktrees = normalizePositiveInteger(record.maxConcurrentWorktrees, "maxConcurrentWorktrees", 1, warnings);

— a hardcoded literal 1, not the same constant reused above.

These two code paths for "what's the default per-repo worktree budget when unspecified" currently
agree only because DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees also happens to be 1
today (confirmed at its definition, ~line 45). If the fleet-wide total default is ever changed to
something other than 1, bare-string repo entries would silently and incorrectly inherit the new
fleet-wide total as their per-repo cap, while object-form entries would keep defaulting to 1
a divergence with no test pinning either path independently.

test/unit/fleet-run-manifest-parser.test.ts has no test asserting the bare-string-entry default
value independently of DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees.

Requirements

  • Introduce a dedicated per-repo default constant (e.g.
    DEFAULT_FLEET_RUN_MANIFEST_REPO_MAX_CONCURRENT_WORKTREES = 1, named clearly to distinguish it
    from the fleet-wide totalConcurrentWorktrees default) and use it as the default for BOTH the
    bare-string branch and the object-form branch's normalizePositiveInteger(...) fallback
    argument, so both paths derive their default from the same single source of truth instead of two
    independently-hardcoded values that only coincidentally agree.
  • Do not change DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees itself or any other field of
    DEFAULT_FLEET_RUN_MANIFEST — this issue only fixes the per-repo default's source.
  • Do not change the parsing/validation behavior for explicitly-specified maxConcurrentWorktrees
    values — only the fallback used when a repo entry doesn't specify one.

Deliverables

  • A new, clearly-named per-repo default constant defined in
    packages/loopover-engine/src/fleet-run-manifest.ts, set to the same value (1) the two
    existing defaults currently coincidentally share.
  • The bare-string branch in normalizeRepoList uses the new constant instead of
    DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees.
  • The object-form branch's normalizePositiveInteger(...) call uses the new constant instead
    of the hardcoded literal 1.
  • A new test in test/unit/fleet-run-manifest-parser.test.ts that changes
    DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees (via whatever the test's existing
    fixture/override mechanism is — inspect the file for how other tests already override
    manifest defaults) to a value other than 1, then asserts a bare-string repo entry's parsed
    maxConcurrentWorktrees is still the new dedicated per-repo constant's value, not the
    changed fleet-wide total — proving the two defaults are now genuinely decoupled.

All four deliverables are required in this single PR.

Test Coverage Requirements

This repo enforces 99%+ Codecov patch coverage, branch-counted, on every changed line/branch in
src/**/workers/** (this applies to packages/loopover-engine/src/** as well — confirm via the
repo's Codecov config). The new constant and both updated branches must be covered by the new test
above plus existing passing tests.

Expected Outcome

A bare-string repo entry's default maxConcurrentWorktrees no longer silently tracks
DEFAULT_FLEET_RUN_MANIFEST.totalConcurrentWorktrees — both the bare-string and object-form entry
paths derive their per-repo default from one dedicated, independently-testable constant, so a
future change to the fleet-wide total default can no longer silently and incorrectly change
per-repo defaults for bare-string entries.

Links & Resources

  • packages/loopover-engine/src/fleet-run-manifest.ts (normalizeRepoList, ~lines 90-102;
    DEFAULT_FLEET_RUN_MANIFEST, ~line 45)
  • test/unit/fleet-run-manifest-parser.test.ts (existing test file to extend)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions