fix(mantis): fence lost Telegram leases without a ten-second delay (#128122)

* perf(mantis): fence lost Telegram leases without delay

* test(mantis): enforce prompt lost-lease fencing
This commit is contained in:
Peter Steinberger
2026-08-22 23:16:29 -07:00
committed by GitHub
parent c7de55b423
commit 20336860eb
2 changed files with 6 additions and 11 deletions
+2 -7
View File
@@ -10,7 +10,7 @@ lost_marker_path="$1"
shift 2
# The marker records broker-confirmed loss of the shared-account lease; continuing
# Telegram I/O would violate broker serialization. The <=10s poll window is accepted
# Telegram I/O would violate broker serialization. The <=1s poll window is accepted
# against the 20-minute lease TTL.
# <&0: a backgrounded command's stdin defaults to /dev/null, which silently
# swallowed the piped agent prompt. The explicit redirect keeps the caller's stdin.
@@ -48,10 +48,5 @@ while true; do
exit 97
fi
for _ in {1..10}; do
sleep 1
if ! kill -0 "$command_pid" 2>/dev/null; then
command_exit
fi
done
sleep 1
done
+4 -4
View File
@@ -43,13 +43,13 @@ describe("run-with-lease-fence", () => {
fs.writeFileSync(lostMarker, "lost\n");
try {
await expect(waitForChildClose(child, 12_000)).resolves.toEqual({
await expect(waitForChildClose(child)).resolves.toEqual({
code: 97,
signal: null,
});
const ticksAfterFence = fs.readFileSync(ticksFile, "utf8");
await new Promise((resolve) => setTimeout(resolve, 1_200));
expect(fs.readFileSync(ticksFile, "utf8")).toBe(ticksAfterFence);
expect(() => process.kill(-commandPid, 0)).toThrow(
expect.objectContaining({ code: "ESRCH" }),
);
expect(stderr).toContain("::error::Telegram QA lease lost mid-run; fencing proof");
} finally {
if (child.exitCode === null) {