PromptReports

Plan: Stop two agents editing the same file

Partly builtopenspec/changes/wf-stop-two-agents-editing-the-same-file

Written for an AI agent to fetch and follow: it says what to connect, which steps to build with which product, what a person must approve, and how to check the result. Steps that depend on a part that is not built say so, and tell the agent to record the gap instead of guessing.

URL pattern: /use-cases/<id>/openspec.md, all plans at /use-cases/index.json. Checkboxes on this page are for reading only.

openspec/changes/wf-stop-two-agents-editing-the-same-file/proposal.md

Why

Two agents on two machines edit the same file on the same afternoon. Nobody finds out until the merge conflict, and one of them does its work again. Conflicting edits stop before they cost a rebase, whichever agent each person uses.

What Changes

  • Turn on the stop-two-agents-editing-the-same-file use case for a team. The agent does it inside its own session through the product's MCP tools; there is no workflow run.
  • RepoOps: Claim the files for this session, scoped to repo and branch (claim_files) (today: Built).
  • RepoOps: Check for another session's claim before editing (check_session_overlap) (today: Built).
  • RepoOps: Warn on or block a commit to a file another session claimed (repoops guard) (today: Built).
  • Count no workflow request: it is not a workflow run.

Impact

  • Products: RepoOps.
  • Outside the family: Git, through a pre-commit hook.
  • State: Partly built. File claims across machines and the commit guard are built and off until switched on: claims and overlap checks go through the team relay, scoped to repo and branch, and repoops guard warns on or blocks a commit to a claimed file (repo-dashboard #7585). Paths are hashed unless the team turns on sharing them. The production check on two machines is still to go.
  • Plan row: none yet (Proposed).
openspec/changes/wf-stop-two-agents-editing-the-same-file/tasks.md

1. Connect and authorize

  • 1.1 Confirm the org has a connection for each of: RepoOps. Stop and tell the user which is missing.
  • 1.2 Get a PromptReports ID agent token for each product the run calls (RFC 8693 exchange). Where a product does not accept ID tokens yet, use its connect key.
  • 1.3 Confirm the team's admin has switched the feature on; each is off by default.

2. Build the steps

  • 2.1 RepoOps: Claim the files for this session, scoped to repo and branch (claim_files).
  • 2.2 RepoOps: Check for another session's claim before editing (check_session_overlap).
  • 2.3 RepoOps: Warn on or block a commit to a file another session claimed (repoops guard).

3. Verify

  • 3.1 Do it once in a real session with the user's inputs: Files to change = src/billing/invoice.ts.
  • 3.2 Measure the outcomes: Merge conflicts between two agent sessions on the same branch; Commits the guard warned on or blocked.
openspec/changes/wf-stop-two-agents-editing-the-same-file/specs/workflow-stop-two-agents-editing-the-same-file/spec.md

ADDED Requirements

Requirement: A claim lapses

A claim SHALL carry a time limit and SHALL lapse when its session ends or stops sending presence.

Scenario: A claim lapses

  • WHEN the session that holds a claim ends
  • THEN the claim lapses and another session can claim the file

Requirement: Paths stay hashed

The relay SHALL store a salted hash of each path unless the team turns on sharing file paths.

Scenario: Paths stay hashed

  • WHEN sharing file paths is off
  • THEN the relay holds no file name

Requirement: Evidence stays honest

Each step SHALL report what it saw as measured, inferred or missing, and SHALL never report missing as measured.

Scenario: A product part is not built

  • WHEN a step depends on a part that is Planned or Proposed
  • THEN the step records missing, names the part, and the approval card shows the gap

Requirement: Nothing is counted

The use case SHALL count no workflow request, because it is not a workflow run.

Scenario: An agent uses it ten times in one session

  • WHEN the agent calls the tools ten times
  • THEN the org's usage does not change