teapot-coding-agent 0.37.36 → 0.37.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +27 -0
- package/dist/master.js +27 -3
- package/package.json +1 -1
- package/public/assets/{index-CJRLUcnz.js → index-CXHfZOPq.js} +4 -4
- package/public/assets/{index-CJRLUcnz.js.map → index-CXHfZOPq.js.map} +1 -1
- package/public/assets/{shiki-By7PBGqR.js → shiki-CsPs6x4K.js} +2 -2
- package/public/assets/{shiki-By7PBGqR.js.map → shiki-CsPs6x4K.js.map} +1 -1
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -191,6 +191,33 @@ async function main() {
|
|
|
191
191
|
* nothing is orphaned and nothing lingers. `execve` only resolves if it FAILED, and that path
|
|
192
192
|
* throws inside `restartServer`, so nothing is left trusting this branch.
|
|
193
193
|
*/
|
|
194
|
+
/**
|
|
195
|
+
* Ctrl-C during a live update must not cancel the handover half-way.
|
|
196
|
+
*
|
|
197
|
+
* `restartServer()` records what to resume and then execs. A SIGINT in that window ran this
|
|
198
|
+
* shutdown path, which DISPOSES every agent and exits — so the operator saw
|
|
199
|
+
*
|
|
200
|
+
* [teapot] live update: waiting for 1 agent(s)…
|
|
201
|
+
* ^C
|
|
202
|
+
* [teapot] shutting down (SIGINT)...
|
|
203
|
+
* [teapot] live update: 0 session(s) will resume
|
|
204
|
+
*
|
|
205
|
+
* and the work that was running never came back. The flag is set by `restartServer()` for the
|
|
206
|
+
* whole duration of the handover, which is exactly the window where the operator's ^C is
|
|
207
|
+
* ambiguous: it can mean "cancel the update" or "stop the server", and treating it as the latter
|
|
208
|
+
* silently discards the resume set that was just written.
|
|
209
|
+
*
|
|
210
|
+
* A second ^C while an update is in flight is the escape hatch — that is why this checks the
|
|
211
|
+
* signal rather than ignoring it outright.
|
|
212
|
+
*/
|
|
213
|
+
const updating = master.updateInFlight === true;
|
|
214
|
+
if (updating && signal === "SIGINT" && !process.env.TEAPOT_FORCE_SHUTDOWN) {
|
|
215
|
+
console.log("\n[teapot] live update is in progress — press ^C again to abort it and stop");
|
|
216
|
+
process.env.TEAPOT_FORCE_SHUTDOWN = "1";
|
|
217
|
+
// do NOT reset `shuttingDown`: the next signal must get through, so clear it
|
|
218
|
+
shuttingDown = false;
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
194
221
|
console.log(`\n[teapot] shutting down${signal ? ` (${signal})` : ""}...`);
|
|
195
222
|
await Promise.allSettled([...master.agents.values()].map((a) => a.dispose()));
|
|
196
223
|
// During a live update the replacement SIGTERMs us to take the port. Linger
|
package/dist/master.js
CHANGED
|
@@ -2499,6 +2499,14 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
|
|
|
2499
2499
|
* finish. The interrupted case is not lost — the resumed session is told exactly what happened.
|
|
2500
2500
|
*/
|
|
2501
2501
|
updateWindDownMs = 900_000;
|
|
2502
|
+
/**
|
|
2503
|
+
* True from the moment a live update starts until the process is replaced.
|
|
2504
|
+
*
|
|
2505
|
+
* A Ctrl-C during the wind-down used to run the ordinary shutdown path — dispose every agent, then
|
|
2506
|
+
* exit — which discarded the resume set that had just been written and left the operator's work
|
|
2507
|
+
* stopped with no explanation.
|
|
2508
|
+
*/
|
|
2509
|
+
updateInFlight = false;
|
|
2502
2510
|
/**
|
|
2503
2511
|
* Ask every agent to stop at its next turn boundary; returns the ids that did not make it.
|
|
2504
2512
|
*
|
|
@@ -2588,6 +2596,8 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
|
|
|
2588
2596
|
}
|
|
2589
2597
|
async restartServer() {
|
|
2590
2598
|
console.log("[teapot] live update: restarting...");
|
|
2599
|
+
// a Ctrl-C from here until the exec is ambiguous; signal handlers consult this
|
|
2600
|
+
this.updateInFlight = true;
|
|
2591
2601
|
/**
|
|
2592
2602
|
* 1. WIND DOWN — do not abort.
|
|
2593
2603
|
*
|
|
@@ -2596,18 +2606,32 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
|
|
|
2596
2606
|
* and leaves a call whose result never arrives, so the resumed session starts from a state that
|
|
2597
2607
|
* never existed. `windDownForUpdate()` instead lets each agent finish its current round.
|
|
2598
2608
|
*/
|
|
2609
|
+
/**
|
|
2610
|
+
* 2. REMEMBER WHAT TO RESUME — before winding down, not after.
|
|
2611
|
+
*
|
|
2612
|
+
* `takeResumeSet()` asks `isLive()`, and `windDownForUpdate()` SETS `status = "idle"` as its
|
|
2613
|
+
* success condition. Taking the set afterwards therefore collected nothing: MEASURED in a real
|
|
2614
|
+
* update whose log reads
|
|
2615
|
+
*
|
|
2616
|
+
* waiting for 1 agent(s) to reach a turn boundary...
|
|
2617
|
+
* 0 session(s) will resume
|
|
2618
|
+
* resumed 0 session(s)
|
|
2619
|
+
*
|
|
2620
|
+
* — the one agent that was working was recorded as "not working" by the very step that had just
|
|
2621
|
+
* made it stop, so the work never came back.
|
|
2622
|
+
*
|
|
2623
|
+
* Captured first, the set describes what the operator saw when they pressed update.
|
|
2624
|
+
*/
|
|
2625
|
+
this.config.resumeAfterUpdate = this.takeResumeSet();
|
|
2599
2626
|
const interrupted = await this.windDownAllAgents(this.updateWindDownMs);
|
|
2600
2627
|
if (interrupted.length)
|
|
2601
2628
|
console.log(`[teapot] live update: ${interrupted.length} agent(s) did not reach a turn boundary in ` +
|
|
2602
2629
|
`time and were stopped: ${interrupted.join(", ")}`);
|
|
2603
2630
|
/**
|
|
2604
|
-
* 2. REMEMBER WHAT TO RESUME.
|
|
2605
|
-
*
|
|
2606
2631
|
* Written to the config BEFORE the exec, because after it this process no longer exists. Only
|
|
2607
2632
|
* agents that were actually working go in — an idle agent must NOT be started by the new
|
|
2608
2633
|
* process, or a live update would begin doing work the operator never asked for.
|
|
2609
2634
|
*/
|
|
2610
|
-
this.config.resumeAfterUpdate = this.takeResumeSet();
|
|
2611
2635
|
this.saveConfig();
|
|
2612
2636
|
console.log(`[teapot] live update: ${this.config.resumeAfterUpdate.length} session(s) will resume`);
|
|
2613
2637
|
// 3. terminals: closing them is what makes their `detached` spawns safe (see stopAllAgents)
|