Skip to content

app: process actions wait for an opening crew owner instead of saying it is not held - #2156

Closed
santoshkumarradha wants to merge 5 commits into
app/v3from
c34/crew-owner
Closed

santoshkumarradha wants to merge 5 commits into
app/v3from
c34/crew-owner

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

What changes

Process actions (stop, restart, and the other per-process controls) no longer report "not held" while the light crew owner is still opening. Before, a person could press an action at that moment and get a false refusal, or a fallback branch for a process the app was about to own.

findCrewOwner now waits for an open that is in progress, through a new liveAfterOpen that waits on the app's open gate. Earlier it skipped the kept-live owner while it was opening, so ProcessActions read liveOf() == nil and went into the not-held branch. held() is unchanged.

Evidence

  • New test TestProcessActionsWhileALightCrewOwnerIsStillOpening uses an open that takes 300 ms. It failed 3 of 3 runs before the fix. After the fix it passes under -race -count=20, together with TestProcessActionsOpensALightCrewOwnerOnce.
  • The ProcessActions tests pass under -race. The lock-guard law reports nothing for applazy.go.

Limits

  • This fixes only the window while the owner is opening. When an open fails, the not-held branch still runs, as it did before.

🤖 Generated with Claude Code

…s not held

findCrewOwner opens a light crew owner once and lets other callers through
while that open runs. ProcessActions then read the owner's live conversation,
found none yet, and answered from the saved record: Rerun not held and Stop
ended for a job whose owner was being opened. It now waits for an open in
progress (the open holds the agent's gate until it is live or has failed)
before it reads. held() and every other reader are unchanged.
@santoshkumarradha

Copy link
Copy Markdown
Member Author

Parked, for the owner to decide. This PR stays open and does not ride.

Why: #2264 landed after this PR and set the opposite behaviour. Reads of process actions during an owner's open answer at once from saved history, and TestProcessActionsOpensALightCrewOwnerOnce requires that. This PR makes those reads wait for the open, so that test times out at its 2-second limit. Both cannot hold, and #2264's behaviour holds for now.

The decision: prompt reads (#2264), where Rerun can read as unavailable for a moment during an open, or accurate reads that wait for the open (this PR). How often the moment occurs and how fast the desktop app refreshes have not been measured.

🤖 Generated with Claude Code

@AbirAbbas

Copy link
Copy Markdown
Collaborator

Closing, because dev solved the same problem a different way and that design is what ships now.

What this PR did: a process-actions read made while a crew owner is still opening waits for the open to finish.

What dev does instead: #2264 and #2313 let action reads answer straight away ("not held") while the owner opens. When the open finishes, agent.changed is published, and the view refreshes and shows the real actions. The open itself happens once, and processes.stop, processes.rerun and processes.stop_all wait for it, with a time limit.

Why porting this one would hurt: it takes the owner's gate with no deadline. That breaks TestProcessActionsOpensALightCrewOwnerOnce, which requires 12 concurrent action reads to answer within 2 s while the open is blocked. It also lets four slow action reads take all four process-read slots, so processes.page and processes.log would answer busy.

The branch stays as it is, so nothing is lost.

@AbirAbbas AbirAbbas closed this Nov 13, 2026
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.

2 participants