You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2e98120
Browse filesBrowse the repository at this point in the historyBrowse files
fix(mothership): take over runs whose controller died and re-run their interrupted tool (#9059)
* fix(mothership): take over runs whose controller died and re-run their interrupted tool
A Chat run is driven by the Sim process that admitted it. When that process
stops mid-run (a deploy's old task set is terminated, or a crash) and no
browser is attached, nothing takes the run over: recovery only ran from a
browser reconnect, the in-flight tool's result was never recorded, and the
worker eventually ended the run as detached.
- Every Sim process now looks every 20s for interactive runs whose chat lock
is gone and takes each over through the same recovery a reconnect runs,
acting as the run's user under a delegated principal that re-checks that
user's current access. The chat lock and controller token still admit
exactly one controller, so a racing reconnect or another process loses.
- A user who lost access gets the run settled as an error and the worker is
told to stop it.
- A Sim tool whose owner died before recording a result (its execution lease
lapsed while the call was still running) is claimed again under a new owner
token and run again, by the server for a workflow tool. Each start is
counted; after three, the call fails with a clear message instead.
- A takeover waits while one of the run's Sim tools still holds its lease.
* fix(mothership): import the takeover by absolute path and regenerate the schema mock
* fix(mothership): page past live controllers, stop a scan on shutdown, dispose chat pubsub in tests
* test(mothership): assert the claim admits a first execution or an interrupted re-run
* test(mothership): add execution_attempts to the browser download fixture table
* fix(mothership): bound the takeover scan, stop earlier attempts' commands, decline takeovers on shutdown
- The abandoned-run scan resumes from a durable cursor and examines a bounded
window per round, so runs whose controller is alive cannot hide later runs.
- A re-run's earlier attempts' workbench commands are handed to the
workbench recovery to stop before the re-run may use the workbench; each
recorded command now names the attempt that started it.
- Shutdown aborts a takeover still in flight at its controller claim.
- Only an authorization denial settles a run as revoked; other takeover
failures leave it recoverable, as a failed reconnect does.
- The suite sets REDIS_URL only when a test Redis is configured.
* fix(mothership): keep the takeover stop handler module-private
* fix(mothership): let the server re-claim a workflow call its dead claimant never started
* fix(mothership): harden abandoned-run takeover
- Add the `mothership-abandoned-run-takeover-disabled` AppConfig kill switch,
checked once per scan; off by default, so takeovers run unless it is on.
- Stop a controller whose chat lock lapsed while every renewal threw, so a
controller partitioned from Redis cannot keep driving a run taken over.
- Never revoke another call awaiting its re-run from a sibling's wait or
workbench access; the sibling's workbench access still stops that call's
dead attempt's commands.
- Treat a workspace access loss found inside recovery like an authorization
denial, by error type; other recovery failures stay recoverable.
- Cover organization Assistant takeover for a member and a removed member.
* fix(mothership): negate the re-runnable predicate without an optional SQL operand
* fix(mothership): time the lock lapse from its acquisition, type the re-run predicates as conditions, revoke access mid-recovery in the test
* test(mothership): find the attempt cap inside the typed re-run conjunction
* Sim executions one call may start: the first, and a re-run each time a takeover finds the
14
+
* previous owner died before recording a result. A tool that kills its executor every time
15
+
* ends with {@link EXHAUSTED_SIM_TOOL_MESSAGE} instead of re-running forever.
16
+
*/
17
+
exportconstSIM_TOOL_EXECUTION_MAX_ATTEMPTS=3
18
+
12
19
exportconstINTERRUPTED_SIM_TOOL_MESSAGE=
13
20
'Tool execution lost its owner before a result was recorded. Its outcome is unknown; inspect current state before retrying a mutation.'
14
21
22
+
exportconstEXHAUSTED_SIM_TOOL_MESSAGE=`Tool execution was interrupted ${SIM_TOOL_EXECUTION_MAX_ATTEMPTS} times because the Sim server running it stopped, so it was not run again. Its outcome is unknown; inspect current state before retrying a mutation.`
0 commit comments