[Feat] Add bounded recovery for stalled browser and desktop tasks - #31
Draft
prettygirlisnotme wants to merge 1 commit into
Draft
prettygirlisnotme wants to merge 1 commit into
prettygirlisnotme wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Browser and desktop policies can repeatedly choose ineffective actions without recovering or explaining how to proceed. This adds bounded replanning for those stalls, following the small repeatable recovery on/off subset agreed in #16.
How
Start with
s1a/recovery.pyfor the cumulative attempt/time budget,s1a/browser/decision_model.pyfor browser triggers and refreshed observations, ands1a/tool/rethink.pyfor desktop integration.A stall spends an attempt, refreshes the observation read-only, and asks the existing chat model for a short plan. The next ordinary decision consumes that plan through the existing tools and permission checks. Progress does not refund attempts or active refresh/planning time. Failed, cancelled or exhausted recovery stops with a reason and a next action.
Failed observations cannot become empty-page DONE results. A partial answer after post-replan BLOCKED remains context and cannot make the task successful. Failed/cancelled calls remain visible in accounting; unknown usage or prices do not become zero cost.
What
--rethink on;--rethink-attemptsand--rethink-timeoutbound recovery. Desktop recovery reusesRethinkRailwhile preserving existing game behavior.Verification
.venv/bin/ruff format --check .,.venv/bin/ruff check .,.venv/bin/ty check..venv/bin/pytest -q: 638 passed, 41 skipped, 98 subtests.S1A=.venv/bin/s1a PY=.venv/bin/python scripts/smoke.sh.uv build --offline: source archive and wheel built successfully.CHANGELOG.mdand feature documentation updated.Opt-in system tests:
S1A_BROWSER_TESTS=1 .venv/bin/pytest -q tests/system/test_recovery_browser.pypassed on the cluster (74.34 s);S1A_DESKTOP_TESTS=1 .venv/bin/pytest -q tests/system/test_recovery_desktop.pypassed against a dedicated Windows fixture. Controlled browser/Windows subsets completed 12/6 trials without execution errors. Their scripted decisions and plans validate mechanics, not neural-model performance.With real Laya 0.3.5 and DeepSeek v4.1 Flash, the original 12-trial matrix verified 0/6 in both arms and never triggered recovery. A separately reported exploratory server-validation variant verified 0/6 off and 2/6 on, with six planner calls. Paired mean overhead was 18.194 s, two decision calls, 0.83 chat calls and one unchanged-page action per task. Locked-form trials still failed despite correct plans. These small synthetic results do not establish a general success-rate improvement.
The final post-replan BLOCKED correction affects terminal reporting and was regression-tested after the frozen experiment; historical outcomes remain unchanged. See the report and eval guide for reproduction settings.
Closes #16.