Skip to content

A job has one manager, and all its spend counts against its budget - #2283

Merged
santoshkumarradha merged 28 commits into
app/v3from
c52/job-agent-tags
Nov 3, 2026
Merged

santoshkumarradha merged 28 commits into
app/v3from
c52/job-agent-tags

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What changes

Costs on a job were missing from its meter and cap, and a job could have more than one manager.

  1. One manager per job. The runner and the app's job chats could each make a manager when a job started. Each one joined the job's team and woke on its replies, so an extra manager spent money and could act on the job. Making a manager now holds a floor-wide lock across create, join and keeping it on the job. A later ask gets the same conversation, and a loser is never created.
  2. Every owned conversation counts. Budget lookup knew only the job's current conversation and stage history. It now also honours the owner mark saved beside each conversation, so a manager left by an earlier build is booked to its job and stops at its cap. Before this, that spend had no budget at all, so the cap did not stop it.
  3. No doubled receipts. A seeded conversation had two ids: the one in its journal and the one of its folder. Live rows used one and the rebuild checked the other, so saved calls were written twice. Seeding now takes the folder's id, and the rebuild counts a chat's rows under both ids once.

Limits

  • Rows already in the ledger are not rewritten. Doubled and untagged rows from earlier builds stay as they are.
  • Extra managers already on disk stay. They now count against their job.
  • Makers on one floor wait for each other briefly. The lock covers local file writes only: the recipe, which can reach GitHub, is read before it.
  • A job that a remote factory runs here can still get two managers: its row lives on the other factory, so this floor's lock can't see it. Both managers count against a budget.
  • Held rows are counted by the fuller of a chat's two ids, which assumes rows under each id are a prefix of its saved calls, as the rebuild writes them.
  • Owner marks from earlier builds keep their old match on job and repo. New marks also compare issue number and creation time.
  • No wire change.

Validation

  • TestRacingAsksMakeOneManager: three concurrent asks made three conversations before the fix, and one after. Run with -race.
  • Owned-manager budget test: one provider call is counted on the job, then the cap stops the second call. Without the fix the job showed provider 0.0100, ledger 0.0000, header 0.0000.
  • Receipt test: one provider call was rebuilt twice before the fix, and once after.
  • Checked against a real job's saved files: three conversations made in the same moment, all owned by one job, one untagged with spend on the ledger, and three doubled rows.

🤖 Generated with Claude Code

santoshkumarradha and others added 28 commits November 2, 2026 23:22
Competing manager opens remain owned after Talk selects another journal. Recognize the saved owner for live budget admission and spending. Match receipt rebuilds to the journal identity as well as the cell identity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Validate durable ownership against the candidate store. A local worker mirror must share the owning floor manager path before taking an extra manager charge. Seed journal headers and titles from the session folder metadata in either layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Old ownership marks keep their root, job and repository matching.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match call facts across aliases, retaining repeated calls under a single alias and leaving historical rows untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the held-manager fast path and recheck after locking. Network reads no longer hold the floor-wide mint lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub issues supply Created (github/source.go issueItem); Store.Create preserves it and api transport carries it. Independent factories can therefore share ID, Repo, Num and Created. The remote door must use its mirror; owned runners still consult their floor. Remote manager deduplication remains unsupported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assert historical ledger bytes remain unchanged and repeated refresh imports no saved call twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Exercise exported Refresh with separate equal-cost calls, microdollar rounding, and repeated ledger IDs. Normalize Go formatting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Match each alias to saved calls in order, using receipt precision for cost and allowing live usage to precede its seal. Count repeated row IDs once and append only missing calls, preserving historical ledger bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record the legacy prefix assumption for calls sharing a seal. Final review retains no blocking findings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 3, 2026 05:49
@santoshkumarradha
santoshkumarradha merged commit 63cff5f into app/v3 Nov 3, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the c52/job-agent-tags branch November 3, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant