Skip to content

fix(agent): fallback profile table validation と ADR-0018 の課金上限記述を修正する(#149 後続) #152

Closed

Description

@rebuildup

Follow-up to #149 / PR #150 (merged as 90eacfa). Two review findings were merged
unresolved because neither opens a paid path for the three committed
global_max_spend = 0 profiles; both are correctness gaps worth closing.

1. agent check does not validate a profile whose value is not a table

listFallbackProfiles enumerates every key under [fallback_profile], but
parseFallbackProfile returns null when the value is not an object, and
cmdCheck only validates profiles it can count. A non-table profile is
therefore counted as valid and never inspected.

Reproduction (confirmed on main):

[fallback_profile]
good = "this-should-be-a-table"
$ AGENT_CONFIG=non_table.toml agent check
config OK: ... (1 providers, 1 harnesses, 1 routes, 1 fallback profiles)   # exit 0
$ AGENT_CONFIG=non_table.toml agent fallback good
agent: fallback profile not found: good                                    # exit 2

agent check says OK for a profile that agent fallback cannot even find.
A malformed profile (bad primary_route, non-table candidates entry, etc.)
must fail validation here, not be silently ignored.

Acceptance

  • agent check exits non-zero and names the profile when its value is not a
    table, with a message distinguishing "profile is not a table" from
    "profile not found".
  • A present profile that is a table but fails parseFallbackProfile continues
    to fail validation (already covered).
  • Tests cover: non-table profile value, non-array candidates, non-table
    candidate entry, and a valid config still passing.
  • agent check's reported profile count reflects profiles that were actually
    validated, not merely present keys.

2. ADR-0018 overstates what a positive max_spend guarantees

ADR-0018 (and docs/agent-launcher.md) describe max_spend / the budget as
bounding spend. In practice, for a positive budget, max_spend is a
pre-execution admission estimate, not an enforced billing ceiling:

  • the launcher never observes actual provider spend;
  • it cannot attribute cost after a candidate is handed to a harness;
  • provider-side price changes or a model repriced mid-run are invisible.

The global_max_spend = 0 rule IS a real stop (only non-billable candidates
are admitted). The positive-budget case is not.

Acceptance

  • ADR-0018 and docs/agent-launcher.md state plainly that a positive
    max_spend/budget is an admission-time check, does not bound actual spend,
    and that an account-side hard stop (spend limit, or pay-as-you-go off) remains
    the only guaranteed ceiling.
  • global_max_spend = 0 keeps its current, stronger meaning and is described
    as the only value that is a hard stop.
  • No behavior change required.

Out of scope

ModelScope / SenseNova / SiliconFlow recovery stays separate and blocked on
account-owner authentication (see
docs/research/blocked-provider-investigation-2026-11-13.md).

Activity

  1. added a commit that references this issue on Nov 23, 2026
  2. rebuildup commented on Nov 23, 2026

    @rebuildup
    OwnerAuthor

    Fixed on release/rex-remote by #235 (merge commit pending verification below). parseFallbackProfile/listFallbackProfiles now reject present non-table fallback_profile entries, agent check fails closed on malformed config, and ADR-0018/agent-launcher wording now states declared spend caps are admission ceilings rather than measured spend guarantees. Supersedes stale PR #153.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions