Repository navigation
perf(e2e): reuse one authorized Telegram Desktop session per Mantis run - #127835
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Cleanup invoked the internal recorder executable as mantis-sut, which is deliberately kept out of the docker group and cannot read the recorder-owned session file; teardown therefore failed and blocked safe_to_release. The cleanup step already runs as the recorder user, so call the public wrapper whose exec shim cds into the session root.
…ycle The Mantis workflow runs the recorder as the desktop user while the lane reads the authorization-failure fact as mantis-sut; 0600 made that read fail EACCES and silently disabled the two-attempt retry budget. Write the fact 0644 — the 0770 attempt directory bounds visibility. Update the mantis doc's recorder section for the v2 session lifecycle: required --session handle with healthy-session reuse, capture-only stop, and teardown owning authorization termination and lease release.
|
Codex review: found issues before merge. Reviewed August 22, 2026, 6:09 AM ET / 10:09 UTC. ClawSweeper reviewWhat this changesThe PR reuses one authorized Telegram Desktop session across Mantis proof attempts, adds classified authorization-failure budgeting, and separates capture stop from end-of-run teardown. Merge readiness⛔ Blocked by patch quality or review findings - 8 items remain Keep this maintainer-owned PR open: its new authorization-failure budget cannot read the recorder-created fact under the workflow’s separate-user permissions, so the intended fail-fast behavior instead becomes an opaque startup failure. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Mantis Telegram proof workflow starts a lane process as flowchart LR
A[Proof workflow] --> B[Mantis lane]
B --> C[Recorder wrapper]
C --> D[Authorized Telegram Desktop]
D --> E[Capture artifacts]
B --> F[Failure budget]
E --> G[Workflow cleanup]
F --> G
G --> H[QA lease release]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +224, Docs +2, Config +5, Other +297. Total +528 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep classification at the recorder-owned boundary but expose only a safe, lane-readable budget result through the wrapper or a deliberately shared run fact, then prove one authorization, sequential captures, and final teardown in a real Mantis run. Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence reproduction: run the recorder as the workflow’s recorder user, trigger authorization failure, then let Is this the best way to solve the issue? No—the run-scoped lifecycle is a sound direction, but the budget consumer cannot read the producer-owned fact in the actual workflow; use an intentional shared result or wrapper-mediated result instead. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 39cff92880f5. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…un (openclaw#127835) * refactor(mantis): reuse authorized desktop captures * fix(mantis): budget desktop authorization failures * chore(mantis): bound desktop proof retries * fix(e2e): drop unused recorder failure fact type export * fix(ci): route Mantis desktop teardown through the recorder wrapper Cleanup invoked the internal recorder executable as mantis-sut, which is deliberately kept out of the docker group and cannot read the recorder-owned session file; teardown therefore failed and blocked safe_to_release. The cleanup step already runs as the recorder user, so call the public wrapper whose exec shim cds into the session root. * fix(e2e): make recorder failure fact lane-readable; document v2 lifecycle The Mantis workflow runs the recorder as the desktop user while the lane reads the authorization-failure fact as mantis-sut; 0600 made that read fail EACCES and silently disabled the two-attempt retry budget. Write the fact 0644 — the 0770 attempt directory bounds visibility. Update the mantis doc's recorder section for the v2 session lifecycle: required --session handle with healthy-session reuse, capture-only stop, and teardown owning authorization termination and lease release.
What Problem This Solves
Mantis proof run 32560938818 on #127770 spent its 72-minute agent step in a QR-login retry storm: every lane
startprovisioned a fresh Telegram Desktop Docker container AND performed a full QR login (up to 6 token confirmations against the shared QA account). The run recorded baseline attempt 18 and candidate attempt 11 — roughly 29 provision+login cycles at 1–2 minutes each, dozens of Telegram session authorizations in one hour, until late attempts died with "Telegram Desktop did not leave the login screen after 6 attempts" and zbarimg unable to read any QR — consistent with Telegram throttling QR login after rapid session churn. The prompt's "Iterate as needed" licensed unbounded retries of a failure the retries themselves plausibly caused, and the recorder even hid a second silent reprovision inside a failed start.Why This Change Was Made
Desktop authorization becomes a run-scoped resource with one lifecycle owner:
start --session <run-scoped handle>reuses an existing healthy session (container inspected, Telegram main window proven) and only starts a fresh capture in the new output dir; full provision+login happens only when no healthy session exists. The hidden second fresh-container retry is deleted. Recorder session file is an internal v2 cutover (no legacy reader; also drops--keep-box, whose "keep the box alive" behavior is now the defaultstopsemantic).stopends the capture and exports artifacts but preserves the authorized container; a newteardownverb owns end-of-run destruction, invoked by the workflow's always-run cleanup step before lease release.qr-unreadable,main-window-timeout,token-accepted-no-transition) in both the thrown error and a per-attempt JSON fact, keeping the login-screen screenshot evidence.desktop-recorder.json), shared across both lanes and all attempts (both view the same QA account/group; lanes are already serialized). After 2 provision+authorization failures it writes a run-scoped budget fact and every laterstartfails fast withdesktop-unavailable: stop retrying…citing classification, count, and screenshot.desktop-unavailablemeans record +block, never retry; two non-advancing repeats mean classify and stop.User Impact
Mantis runs stop wasting 30–45 minutes re-provisioning and re-authorizing per attempt — attempts after the first reuse the authorized desktop in seconds — directly serving the "blazing fast" requirement. The shared QA Telegram account stops being hammered with dozens of session authorizations per run, removing the plausible cause of the QR-throttle failures. When the desktop genuinely is unavailable, the agent gets one classified, actionable fact and blocks immediately instead of burning the run.
Evidence
TMPDIR=/var/tmp node scripts/run-vitest.mjson the three touched test files — 89/89 pass (rerun independently after review).starts perform exactly one warmup and one QR confirmation but two recordings; pre-fix this provisioned twice.startfails fast citing the recorded fact without invoking the recorder; pre-fix no budget existed.safe_to_release=true;node --import tsx scripts/check-workflows.mts(zizmor + interpolation guard) passes.TMPDIR=/var/tmp node scripts/check-changed.mjs -- <8 changed files>green (format, typecheck, lint, guards).gpt-5.6-sol, high): clean,patch is correct (0.99), no findings.ClawSweeper review dispositions:
mantis-sut, which is deliberately kept out of the docker group and cannot read the recorder-owned session file. Fixed in7f111b4563a: cleanup calls the public wrapper — the step already runs as the recorder user, and the exec shimcds into the session root — with a workflow-test assertion pinning the wrapper route and rejecting the direct invocation.mantis-sut) hit EACCES and the two-attempt budget never engaged. Fixed inc142a9d0e7e: the fact is written 0644 with an inline invariant comment (the 0770 attempt dir bounds visibility) and a mode regression test. A genuine two-OS-user regression test is infeasible in vitest (single test uid); the mode assertion pins the contract and the post-land dispatch proves the cross-identity path.docs/concepts/mantis.mdnow documents the v2 lifecycle (required--sessionwith healthy-session reuse, capture-onlystop,teardownowning authorization termination and lease release). The compat portion is declined per repo doctrine: the recorder is internal QA harness tooling, not a shipped public contract, and v1 session files are transient run state of ephemeral CI desktops — cutover without migration is the mandated default ("cache/transient state gets no compat migration"); a stray pre-cutover lease is released directly withcrabbox stop.