Skip to content

Commit 699a092

Browse files
lseongjooclaude
andcommitted
Wait for approval requests to expire instead of a fixed sleep (#31)
A second helper of the same app may ask again on a later ready signal, so a fixed 0.3 s check could see a fresh request (3 of 4 runs on 31a0a62). Poll up to 2 s until every request has expired; none is ever approved. Test timing only. Agent: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 17c8ec2 commit 699a092

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎Tests/Fixtures/run_local_draft_candidate.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,12 @@ def approved(server, client):
227227
server = start_server(waiting=180)
228228
assert command(server, "pair") == "ok" and command(server, "enable") == "ok"
229229
assert status(a) == "approval_required" and json.loads(command(server, "requests"))
230-
time.sleep(0.3)
231-
assert json.loads(command(server, "requests")) == []
230+
# Each helper of the app may ask once more on a later ready signal; every
231+
# request still expires on its own and none is approved.
232+
deadline = time.monotonic() + 2
233+
while (leftover := json.loads(command(server, "requests"))) and time.monotonic() < deadline:
234+
time.sleep(0.05)
235+
assert leftover == [], leftover
232236
assert status(a) == "approval_required" and not json.loads(command(server, "snapshot"))["paired"]
233237
assert command(server, "end") == "ok"
234238

0 commit comments

Comments
 (0)