fix(aws): stop guard review round 2

A failed StopTask removes the stop marker it recorded, so a later stop
pushes as configured. The unchecked guard's Stop anyway sends no choice
and records nothing, so the workspace's own shutdown push still runs as
the dialog says. The idle watcher keeps a pushed/discard marker instead
of overwriting it; the remove-resources dialog sends discard only when
there may be saved files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-15 10:30:56 -08:00
1 parent 8441a096c8
commit 08b6d341f2
10 files changed
+110 -10

No files matched your search

@@ -842,6 +842,25 @@ fn idle_watch_signals_the_entrypoint_with_reason_idle() {
assert_eq!(fs::read_to_string(w.tmp.path().join("reason")).unwrap().trim(), "idle");
}
#[test]
fn idle_watch_keeps_a_stop_guard_marker_already_recorded() {
for marker in ["pushed", "discard"] {
let w = Watch::new();
fs::write(w.tmp.path().join("reason"), format!("{marker}\n")).unwrap();
let (url, mut agent) = fake_agent(w.tmp.path(), r#"{"last_activity_unix":1,"active_execs":0,"active_tunnels":0}"#);
let mut target = Command::new("bash")
.arg("-c")
.arg("trap 'exit 0' TERM; while :; do sleep 0.1; done")
.spawn()
.unwrap();
let out = w.cmd(&url, target.id()).output().unwrap();
target.wait().unwrap();
agent.kill().ok();
assert!(out.status.success(), "{}", text(&out));
assert_eq!(fs::read_to_string(w.tmp.path().join("reason")).unwrap().trim(), marker);
}
}
// ------------------------------------------------------- stop (SIGTERM) path
#[test]