Skip to content

Commit fe8aeb4

Browse files
SiddarthAAclaude
andcommitted
[failproofai-feat-failproofai-cloud-login] Fix a race in the E2E, check a session can't renew itself, and correct the CLI reference
Phase 8 approved the moment the dashboard came back, so the next poll could be the approval and `fp` never said it was waiting again, which the driver was waiting for. It failed one run in three. It now approves only once `fp` is waiting, so the test asks the same question without the race. Phase 12 now checks the Cloud half's refusal end to end: a session claimed from a link can look at another link, can't approve it, and leaves it pending. That needs FailproofAI/agenteye#1277's latest commit in the stack under test. The public reference said the page warns on a different network, with no word about deployments that can't tell. They send the email and show no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f7b7001 commit fe8aeb4

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎__tests__/e2e/layout/fp-login.sh‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ docker start "$DASH_CONTAINER" >/dev/null
452452
DASH_STOPPED=0
453453
for _ in $(seq 1 60); do curl -s -m 2 -o /dev/null "$DASH/login" && break; sleep 0.5; done
454454
ok "the dashboard went away and came back"
455+
# Only once it says it's waiting again, or the very next poll is the approval and it never does.
456+
for _ in $(seq 1 60); do
457+
sed 's/\x1b\[[0-9;?]*[A-Za-z]//g' "$OUT/drop.log" | grep -a -E 'reconnecting|waiting for you' | tail -1 | grep -q 'waiting for you' && break
458+
sleep 0.5
459+
done
455460
person "$ONE_SESSION" approve "{\"link_token\":\"$LINK\"}" >/dev/null
456461
T=$(wait_done drop)
457462
eq "fp finished on the same link" "$(cat "$OUT/drop.rc")" "0"
@@ -626,6 +631,12 @@ EARLY=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DASH/api/auth/cli/claim
626631
eq "no claim before approval" "$EARLY" "409"
627632
LINKCLAIM=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DASH/api/auth/cli/claim" -H 'content-type: application/json' -d "{\"poll_secret\":\"$LINK\"}")
628633
eq "the link cannot claim" "$LINKCLAIM" "404"
634+
# Sessions never slide. One that could approve its own replacement would never end.
635+
person "$CLAIMED_TOKEN" lookup "{\"link_token\":\"$LINK\"}" >/dev/null
636+
eq "a session claimed from a link can look at another link" "$(cat "$OUT/status")" "200"
637+
person "$CLAIMED_TOKEN" approve "{\"link_token\":\"$LINK\"}" >/dev/null
638+
eq "…but can't approve it, or it would renew itself for ever" "$(cat "$OUT/status")" "403"
639+
eq "…which leaves that link pending" "$(request_status "$LINK")" "pending"
629640
person "$ONE_SESSION" approve "{\"link_token\":\"$LINK\"}" >/dev/null
630641
FIRST=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DASH/api/auth/cli/claim" -H 'content-type: application/json' -d "{\"poll_secret\":\"$SECRET\"}")
631642
SECOND=$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DASH/api/auth/cli/claim" -H 'content-type: application/json' -d "{\"poll_secret\":\"$SECRET\"}")

‎docs/reference/cloud-cli.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fp login --email you@example.com --org reliability-team
175175
fp whoami
176176
```
177177

178-
On a terminal, `fp login` asks how you want to sign in. **browser** opens a link (over SSH or with no display it prints it, and it works from any device); authorize it and the terminal finishes on its own. That terminal gets your access in all your organizations until the session expires, so only authorize a link you just asked for. If the login started on a different network, the page warns you and you get an email once the session exists. **email** sends a 6-digit code to paste back, and is what `--email`, `--json` and anything without a terminal use.
178+
On a terminal, `fp login` asks how you want to sign in. **browser** opens a link (over SSH or with no display it prints it, and it works from any device); authorize it and the terminal finishes on its own. That terminal gets your access in all your organizations until the session expires, so only authorize a link you just asked for. If the login started on a different network, you get an email once the session exists, and the page warns you where the deployment can tell. **email** sends a 6-digit code to paste back, and is what `--email`, `--json` and anything without a terminal use.
179179

180180
### Events
181181

0 commit comments

Comments
 (0)