Skip to content

Browse tasks can follow links to other sites, and an unreported run frees the queue - #265

Merged
senamakel merged 41 commits into
mainfrom
task-offsite-links
Nov 15, 2026
Merged

senamakel merged 41 commits into
mainfrom
task-offsite-links

Conversation

@senamakel

@senamakel senamakel commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why browse tasks that follow a link never finished

After #253 the picture sink works (the box has a PNG from every operator run). But task 5 (browse from Hacker News) was claimed with no notes, and every operator run since 00:00 UTC ended "I stopped this turn early because I don't have permission for a step this needs":

  • A browser session is bound to the start page's host tree (vendor/openhuman/crates/openhuman-core/src/modules/browser.rs, open_session_for_url / explicit_origin_for_mode). A click from news.ycombinator.com to spacex.com lands off-origin. TinyComputer leaves the page and answers BlockedByPolicy: the page reached, <url>, is not permitted by this session's allowed origins; the session left it (tinycomputer-browser/src/error/mod.rs, LeftRefusedPage).
  • The breaker's keyword classifier reads "is not permitted" as MissingPermission, which is budget 0 (agent/tinyagents/middleware/failure_policy.rs, classified_recovery_policy). That stops the turn before the agent writes task-done.json.
  • With no report, the desk re-offers the same claim every run until STALE_CLAIM_SECONDS (2 h) runs out, twice, so one task held the queue for up to 4 h. _captured never ran.

Fix

  • openhuman (fix(browser): a click that leads to another site is a result, not a turn-ending permission failure tinyhumansai/openhuman#8732, merged as d3196223; vendor pinned there):
    • An action or redirect that leads to another site returns {ran, left_for_another_site: <normalized url>, next} instead of failing the turn. The next text is neutral: it says the page is on another site and that going there is a decision under the task's rules. It no longer tells the agent to call open.
    • The operator's deny list is now enforced by the core, not only by prompt and hands/tasks. bin/spine sets OPENHUMAN_BROWSER_DENY_FILE=$TEENY_ROOT/deploy/browser-deny.txt. BrowserEgressHost::authorize refuses every browser connection to a listed host (and its subdomains) before the request is sent. That covers clicks, redirects, and task navigation, including tasks without a url. Matching uses canonical (IDNA, lower-case) hosts. Fail closed: an unreadable list refuses every page.
    • Behaviour change to know about: a page on an allowed site that loads a subresource from a listed host (for example an embedded post from x.com) now fails to load that resource.
  • Desk: a rejected report keeps the claim (hands/lib/teeny_hands/desk.py, tasks/queue.py). desk.run now passes turned_away to the claim callback. When the desk just refused a report, the run did report, so the claim is resumed, not released. Before this, round 2 failed with the false note "ended without a report, twice". build/jobs.py takes the same callback signature and ignores the flag.
  • Storage read outside the write transaction in next_task.
  • Faster failure on outages (intentional): a run that ends without a report now fails its task at the next desk run (about 20 minutes) instead of after the 2 h stale cutoff. During an outage where every operator run ends early, tasks therefore fail after two desk runs. The 2 h cutoff still applies when storage cannot be read.
  • Docs: docs/hands.md (cross-site paragraph and the next row, including the screenshot overwrite behaviour: a run that ended earlier leaves its pictures to be replaced, not merged), docs/developers.md, docs/architecture.md, and bin/spine comments now describe the code enforcement that exists. deploy/browser-deny.txt is unchanged (operator-owned, frozen).
  • Operator prompt brain/agents/operator.toml: step 3 explains left_for_another_site and says a refused page does not end the task.
  • Pin and build: vendor/openhuman is d3196223 (openhuman main's merge of #8732; it contains eae632d4). The root Cargo.toml is main's, unchanged, and Cargo.lock gains one line (tinyagents-harness for the openhuman crate at that pin). cargo build --release -p teeny-spine --locked passes on the pushed head.

Tests

  • hands/tests/tasks/test_queue.py UnreportedRunTest: 5 tests. test_a_report_the_desk_turned_away_keeps_the_claim_open_and_resumed was run first against the unfixed code and failed (resumed False). The others pin release-then-fail, pictures kept, and that runs from before the claim, still running, or from another job do not count, and that with no storage the cutoff applies.
  • openhuman, run locally on the branch before merge: never_open unit tests (IDNA entries, trailing dot, empty list, unreadable list fails closed), the offsite tests, and the modules::browser tests (62) passed. The openhuman PR's own CI was still finishing (rust-cov, rust-lint) when it was merged on the coordinator's instruction; the spine build here is the gate for this PR.
  • python3 -m unittest discover -s hands/tests -t hands/tests on the merged tree: 2448 run, OK.
  • cargo build --release -p teeny-spine --locked: passes. CI on 1866f8ee: scripts, spine and web all pass.
  • Against the box's real storage.db, read-only: _unreported_run for task 5's claim returns that run's "I stopped this turn early..." line (checked in the first round).

Deploy needs an image rebuild, because the spine binary changes.

senamakel and others added 30 commits November 15, 2026 03:09
Update the vendored openhuman submodule to the latest commit.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add tests for the queue releasing a claim when an operator run ends without a report, so the task returns to pending once and then fails with the run's output instead of holding the queue until the stale cutoff. Also cover that screenshots from such runs are kept, that only finished operator runs since the claim count, and that a missing storage.db leaves the claim to the stale cutoff.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The queue now checks the core's cron run history for the operator job and
returns a claim to pending, or fails it after two attempts, as soon as its
run has finished without reporting, rather than waiting out the two-hour
stale cutoff. Reclaimed and failed tasks keep the screenshots their runs
captured, and the failure note quotes what the ended run last said.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The failure note for a task abandoned twice now reads more naturally, stating that the operator's runs ended without a report twice before quoting the last message.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…r task

The operator prompt now explains that a click leading to another site answers left_for_another_site with that page's URL, and that a page the browser refuses to open does not end the task, so the agent carries on and still writes its report.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The hands reference now explains that a browser session stays on its
original site and that a cross-site click, key press or redirect answers
`left_for_another_site` so the operator can open it deliberately. The
`next` entry also describes claims returning to `pending` when an
operator run ends without a report, alongside the existing two-hour
timeout.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a test asserting that when a run's report is turned away by the desk and the run has ended, the claim stays with the operator as resumed with the rejection reason recorded, rather than being treated as an unreported run and released.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The claim callback now receives a boolean indicating whether the pass refused the report left by the run, so callers can tell that the agent did report and its claim remains resumable. The docstring was updated to describe the new argument.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The claim callback now receives whether the report was rejected so it can
adjust the offer accordingly.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The desk runner now passes a turned-away flag to the next-job callback, so wrap next_job in a lambda that ignores it and keeps the existing no-argument behaviour.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
next_task now takes a turned_away flag so that a claim whose operator run did report, but whose report the desk rejected, is resumed instead of being released back to pending. The claimed rows are also read before the write transaction opens, and the unreported-run lookup is skipped entirely when a report was just turned away.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Abandoned browser tasks now capture screenshots using the task id and claim timestamp instead of the row's claimed_at value, and the retry check reads the attempts variable directly. This keeps the requeue and failure paths consistent with the rest of the loop.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The assertion checking that the notes field lacks an "ended without a report" entry was removed because it duplicated coverage already provided by the surrounding status and attempts checks.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored openhuman submodule to the latest commit.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored openhuman submodule to the latest upstream commit.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The comment now explains that the core enforces the deny list on every navigation regardless of allow-all, and that an unreadable list refuses every page. The deny file path is also exported so OpenHuman picks it up from the environment.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
bin/spine now sets OPENHUMAN_BROWSER_DENY_FILE so the core enforces the deny list on every navigation regardless of ALLOW_ALL, and refuses all pages if the list is unreadable. The hands docs and a config test were updated to describe and cover this behaviour.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ed site

The sentence restated the deny-list behaviour already described in the preceding lines, so it was dropped to keep the section from repeating itself.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The architecture and developer docs now state that OpenHuman enforces `browser-deny.txt` on every navigation via `OPENHUMAN_BROWSER_DENY_FILE`, set by `bin/spine`, and that an unreadable list refuses every page. This replaces the earlier claim that only hands/tasks and the operator prompt guarded against denied hosts.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The deny file variable was exported twice in a row, so the second assignment is removed and the explanatory comment with it. The hands documentation now also notes that a task keeps only the pictures from its last run, since earlier ones are replaced rather than merged.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the browser documentation to state that the deny list is enforced on every connection the browser makes, including clicks and redirects, rather than only on navigations. This matches how the core actually enforces the list.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored openhuman submodule to the latest commit.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored openhuman submodule to the latest upstream commit.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Redirect git-named dependencies for tinytools, tinybus, tinystoragedrivers, and tinyinference to the vendored checkouts so the dependency graph holds one copy of each package and one shared trait/type identity. Also add missing patch entries for tinystoragedrivers-testkit, tinyagents-live, and tinychannels, and document the release profile's DWARF settings.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 11 commits November 15, 2026 05:06
Add tinyagents-harness to the dependency graph and record several unused patch entries in Cargo.lock.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Regenerates Cargo.lock so the unused patch entries are sorted, moving the tinystoragedrivers-testkit entry into its correct position. No dependency versions changed.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
… submodule change

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed patch entries for tinystoragedrivers-testkit, tinyagents-live, and tinychannels that were no longer referenced, along with the corresponding unused patch records in the lockfile. This clears stale overrides so the dependency graph only patches crates the workspace actually uses.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…human pointer

Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the vendored openhuman submodule to the latest commit to pick up its upstream changes.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Record the new tinyagents-harness dependency in Cargo.lock so the resolved dependency graph stays in sync with the manifest.

Auto-committed-on: cuttlefish
Co-authored-by: Medulla <medulla@tinyhumans.ai>
… pointer

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit ed8957e into main Nov 15, 2026
senamakel added a commit that referenced this pull request Nov 15, 2026
chore(vendor): pin openhuman to d3196223 so #265's off-site and deny-list half ships
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant