mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-03 06:47:03 +00:00
fix(codex): restore shared sessions after heartbeat and archive
This commit is contained in:
+2
-13
@@ -1493,19 +1493,8 @@ export async function startRunner(options: { workspaceRoots?: string[] } = {}):
|
||||
// Heartbeat
|
||||
try {
|
||||
const updatedState: RunnerLocallyPersistedState = {
|
||||
pid: process.pid,
|
||||
httpPort: controlPort,
|
||||
startTime: fileState.startTime,
|
||||
startedWithCliVersion: packageJson.version,
|
||||
startedWithCliMtimeMs,
|
||||
startedWithApiUrl: fileState.startedWithApiUrl,
|
||||
startedWithMachineId: fileState.startedWithMachineId,
|
||||
startedWithCliApiTokenHash: fileState.startedWithCliApiTokenHash,
|
||||
startedWithExtraHeadersHash: fileState.startedWithExtraHeadersHash,
|
||||
startedWithArgv,
|
||||
startedWithVersionHandoffDisabled,
|
||||
lastHeartbeat: new Date().toLocaleString(),
|
||||
runnerLogPath: fileState.runnerLogPath
|
||||
...fileState,
|
||||
lastHeartbeat: new Date().toLocaleString()
|
||||
};
|
||||
writeRunnerState(updatedState);
|
||||
if (process.env.DEBUG) {
|
||||
|
||||
@@ -174,6 +174,17 @@ describe.skipIf(!await isServerHealthy())('Runner Integration Tests', { timeout:
|
||||
expect(sessions).toEqual([]);
|
||||
});
|
||||
|
||||
it('preserves shared Codex support after a runner heartbeat', async () => {
|
||||
const initial = await readRunnerState();
|
||||
expect(initial?.sharedCodexRuntime).toBe(true);
|
||||
|
||||
await waitFor(async () => Boolean((await readRunnerState())?.lastHeartbeat), 35_000);
|
||||
|
||||
const afterHeartbeat = await readRunnerState();
|
||||
expect(afterHeartbeat?.pid).toBe(initial?.pid);
|
||||
expect(afterHeartbeat?.sharedCodexRuntime).toBe(true);
|
||||
}, 40_000);
|
||||
|
||||
it('should track session-started webhook from terminal session', async () => {
|
||||
// Simulate a terminal-started session reporting to runner
|
||||
const mockMetadata: Metadata = {
|
||||
|
||||
Reference in New Issue
Block a user