Skip to content

factory services' model spend bypasses the organization's model door, spend table and cap #2941

Backlog

Description

@AbirAbbas

What is wrong

SWE-AF, PR-AF and the runner call the model provider directly, each with its own copy of the key. They do not go through the organization's model door, so:

  • their spend is not in the organization spend table or in anyone's My space;
  • no person's or chat's limit counts it, and no limit can stop it;
  • a factory job's own view can disagree with the bill. In one production-style run the job view said the job cost 0.00027 while the provider billed about $0.56 for it.

A hosted chat's model calls are metered and capped by the door. Factory work started from the same organization is not, so the organization's cap does not bound what the organization can spend. Today the only guard is a credit limit on the key at the provider, which the docs now say in "Known limits".

What to do

Route the factory services through the door the chats already use:

  • give SWE-AF, PR-AF and the runner a factory bearer, minted by the server and held as a hash like a chat's, instead of a copy of the provider key;
  • point their model base URL at the organization server's model door, so the key stays on the server;
  • attribute their spend to the person who started the job where there is one, and to an organization line ("factory") where there is not, so the table adds up and the cap applies;
  • keep the job's own cost display reading from the same metered figure, so it cannot disagree with the table.

The default for an existing install should not change silently: a stack that has no factory bearer configured keeps calling the provider as it does now.

Acceptance

On the compose stack with the stub model, a SWE-AF job's model calls appear as rows in the organization spend table under the person who started it, the job view's cost equals the sum of those rows, and with the organization cap set below the job's cost the job is refused with the cap's sentence instead of running on. The "factory spend bypasses the door" limit is removed from docs/organizations.md, the operator README and the manual page in the same change.

On the org/main feature line (#2903).

Activity

  1. added
    bug
    sev:serious
    area:provider
    needs grooming
    on Nov 25, 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:providerbugneeds groomingsev:serious

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions