mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
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:
committed by
GitHub
parent
c7de55b423
commit
20336860eb
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user