Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions __tests__/runtime-control.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ describe('runtime identity and readiness', () => {
},
);

it.each(['oldServersStopped', 'legacyQuiescent'] as const)(
'preserves a legacy daemon by default, then stops it only after %s is set', async (option) => {
it('preserves a legacy daemon by default, then stops it only after oldServersStopped is set', async () => {
const actor = spawn(process.execPath, [path.resolve(__dirname, 'fixtures/runtime-control-daemon.cjs'),
root, getDaemonSocketPath(root), 'legacy', path.resolve(__dirname, '../dist/mcp/writer-lock.js')],
{ stdio: ['ignore', 'ignore', 'pipe', 'ipc'] });
Expand All @@ -276,7 +275,7 @@ describe('runtime identity and readiness', () => {
expect(actor.exitCode).toBeNull();
expect(fs.readFileSync(getDaemonPidPath(root), 'utf8')).toBe(before);
const exited = once(actor, 'exit');
expect(await stopRuntime(root, { [option]: true })).toMatchObject({ pid: actor.pid, outcome: 'term' });
expect(await stopRuntime(root, { oldServersStopped: true })).toMatchObject({ pid: actor.pid, outcome: 'term' });
await exited;
const lease = reserveRuntimeWriter(root, process.pid);
expect(lease).not.toBeNull();
Expand Down
3 changes: 1 addition & 2 deletions site/src/content/docs/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ By default, stop preserves a live daemon without writer coordination protocol
old-version MCP session and every direct or fallback writer for that project is
stopped. The daemon serving the project is excluded because `stopRuntime` stops
it. Daemon death alone does not establish that. A restored old-version daemon needs the
same explicit confirmation before another promotion. `{legacyQuiescent: true}`
is the earlier spelling of the same option.
same explicit confirmation before another promotion.

Keep the reservation value unchanged. Its generation distinguishes successive
reservations held by one PID. Claim it in the daemon bootstrap, then run the
Expand Down
5 changes: 2 additions & 3 deletions src/runtime-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ export async function getRuntimeIdentity(projectRoot: string, options: { timeout
* Refuse live writers that predate the coordination protocol unless the caller
* confirms every other old-version server for the project has been stopped. The
* daemon this call stops is not part of that confirmation.
* `legacyQuiescent` is the earlier name for `oldServersStopped`.
*/
export async function stopRuntime(
projectRoot: string,
options: { oldServersStopped?: boolean; legacyQuiescent?: boolean } = {},
options: { oldServersStopped?: boolean } = {},
): Promise<StopResult> {
projectRoot = canonicalProjectRoot(projectRoot);
return stopDaemonAt(projectRoot, {
preserveUnverified: true,
requireWriterProtocol: !(options.oldServersStopped ?? options.legacyQuiescent),
requireWriterProtocol: !options.oldServersStopped,
});
}

Expand Down
Loading