oficina / equipo Public

Token tests: an attempt's end may already be cleaned up

The ended helper waited for state done, but a cancelled attempt's owed
sign-out can run first and mark it removed; on a busy CI worker it did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev d6c0e12cdd4c82d5951690a8820035f74083f5d9 parent 20963fd
1 file changed, +2 −1
  • internal/runner/thin/token_test.go +2 −1

CI passed — run details

diff --git a/internal/runner/thin/token_test.go b/internal/runner/thin/token_test.go
index 86f6d0ca..123e4231 100644
--- a/internal/runner/thin/token_test.go
+++ b/internal/runner/thin/token_test.go
@@ -204,7 +204,8 @@ func (r *tokenRig) ended(id string) wire.ConnectionReport {
var state string
_ = r.state.db.QueryRow("SELECT state FROM connect_attempts WHERE id=?", id).Scan(&state)
rs := r.reports(id)
- if state != "done" || len(rs) == 0 {
+ // done, or removed once the sign-out it owed has run.
+ if state != "done" && state != "removed" || len(rs) == 0 {
return false
}
last = rs[len(rs)-1]