Skip to content

refactor(explorer): remove the task runner's embedded-host mode, which never runs outside Scale's hub - #24

Merged
polakamtejas merged 2 commits into
mainfrom
tejas/explorer-ui-remove-embed-mode
Oct 1, 2026
Merged

polakamtejas merged 2 commits into
mainfrom
tejas/explorer-ui-remove-embed-mode

Conversation

@polakamtejas

@polakamtejas polakamtejas commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

The explorer UI was forked from the hosted AgentEnvHub frontend. Its task runner was built to run inside an iframe in a host pipeline, and the parent page owned the task definition. So the runner:

  • created the task from the parent's config (POST /api/v1/tasks)
  • re-created it before Run or grading when the parent's config had drifted
  • rotated it to a new id to "start over"
  • graded attempts the parent handed down
  • reported runs, starred ("preferred") runs and materialized fields back to the parent

None of that runs here. The host hook, lib/external-app, is a stub that always reports "not embedded". The step editor that saved through POST /api/v1/tasks was already unreachable (its own comment said so). And the explorer backend has no POST /api/v1/tasks route.

Removed

  • lib/external-app/ and both uses (task-runner-page.tsx, universes-page.tsx).
  • Every window.parent !== window check:
    • the runner's embed branches
    • the Universes Hub's two-step picker and "Use this universe" bar
    • the instance viewer's hidden Task Run Context tab (and its showRunContext prop)
    • the app shell's hidden sidebar
  • From the runner:
    • createTask and both POST /api/v1/tasks calls
    • the task_config startup branch, applyLatestConfig, the drift hash and banner
    • "Start over", gradeAllAttempts, the preferred-run stars, the model picker, the run cap, runs-per-click and auto_run
    • sendResult/sendResults and the trajectory/step warming that fed them
    • the unreachable step editor

Why behavior doesn't change

  • Every removed branch was gated on something only the host could set: receivedInputs, receivedOutput, window.parent !== window, or editing, which was never set true. Each was evaluated as the standalone value and simplified.
  • The runner still loads the task from /task-runner/<id>, runs it, cancels a pending or running run, polls, and shows each instance. It still initialises once per mount, as before.
  • handleRun loses its count fan-out, which only runs_per_click used. A single run launches, fails and reports exactly as before.

Lines removed: task-runner-page.tsx −1779/+77 (2403 → 701 lines), universes-page.tsx −125/+2, task-instance-viewer.tsx −25/+5, lib/external-app/index.ts −61, [[...slug]].tsx −10 (+89/−99 as shown, because the sidebar block dedents one level).

Testing

  • New ui/src/lib/task-runner-run.smoke.ts (31 checks) covers the run lifecycle, which the second commit moves unchanged from the page component into lib/task-runner-run.ts so the node-only smoke runner can reach it:

    • the run request
    • a launch that starts and returns its workflow id
    • a refused launch surfacing the backend's detail instead of leaving the page on "Starting…"
    • the started run being picked up and selected once it appears in the instance poll
    • polling continuing until it does, and stopping once every run is finished
    • cancel with both ids encoded

    Breaking the "keep polling while a started run hasn't appeared" rule, or dropping the backend detail, each fails it.

  • npx tsc --noEmit, npm run test:smoke (12 passed; the 2 skips need trajectory fixtures) and npm run build:static pass. No useExternalApp, isEmbedded, window.parent, sendResult, parentTaskConfig or api/v1/tasks POST left in src/.

  • Browser, against agent-env up:

    • Opened /task-runner/hello-flat, clicked Run: a new instance appeared, completed at 100%, and was auto-selected.
    • A completed instance renders the same as on main (Verifier Results default, Task Run Context tab present).
    • The task detail page and its instance view match main.
    • The Universes Hub lists universes, and a card click navigates to the detail page.

Not changed here, noted for follow-ups:

  • The runner's evaluator-return flow (handleEvaluatorSaved) and its onEditEvaluator / onRerunFromStep props were already unreachable before this PR.
  • ?projectId= is still forwarded on Run when present in the page URL.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

This PR appears safe to merge; no outstanding issue was identified in its changes.

What we checked:

  • A refused run leaves “Starting…” on screen: A failed launch clears the pending state and shows the server’s reason. The smoke test checks that the reason is preserved.

Summary

The Explorer drops iframe-host task flows that depended on parent-page configuration, while keeping the standalone task-run lifecycle. It also removes iframe-only page controls and moves run-request and polling logic into a helper with smoke coverage.

  • The runner loads a task by URL ID and no longer creates or reports tasks through a host page.
  • A run still starts, gets polled, and appears in the instance viewer; the lifecycle logic now has a smoke test.
  • Universe navigation, the instance context tab, and the app sidebar use the standalone Explorer flow.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Open task runner] --> B[Load task]
  B --> C[Start run]
  C --> D[Poll instances]
  D --> E[Select new instance]
  C --> F[Show launch error]
  D --> G[Cancel run]
Loading

Reviews (4) · Last reviewed commit: "test(explorer): cover the task runner's ..."

@polakamtejas
polakamtejas requested review from a team as code owners September 30, 2026 20:30
Comment thread src/agent_env/explorer/ui/src/components/task-runner-page.tsx Outdated
@polakamtejas
polakamtejas force-pushed the tejas/explorer-ui-remove-embed-mode branch from c277968 to 1c4928c Compare September 30, 2026 21:32
@polakamtejas
polakamtejas requested a review from a team as a code owner September 30, 2026 21:32
polakamtejas and others added 2 commits October 1, 2026 01:54
…h never runs outside Scale's hub

The explorer UI was forked from the hosted AgentEnvHub frontend, whose task
runner ran inside an iframe in a host pipeline. There the parent page owned
the task definition. The runner created the task from the parent's config
(POST /api/v1/tasks), re-created it when that config drifted, rotated it to
"start over", graded attempts the parent handed down, and reported runs,
stars and materialized fields back to the parent.

In this repository the host hook is a stub that always reports "not
embedded", and the step editor that saved through POST /api/v1/tasks was never
reachable. So none of that code runs, and the explorer has no POST
/api/v1/tasks route for it to call.

Removed:
- lib/external-app
- every window.parent check: the runner, the Universes Hub picker, the
  instance viewer's hidden context tab, the app shell's hidden sidebar
- the runner's create-from-config, drift tracking, apply-before-run,
  start-over, grade-attempts, preferred-run, model-picker, run-cap,
  runs-per-click and parent-reporting code
- the unreachable step editor

Every removed branch was gated on a value only the host could set, so a
top-level explorer page renders and behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner's run flow (the request a run sends, a refused launch, picking up
the started run from the instance poll, when polling stops, cancel) lived
inside the page component, where the UI's node-only smoke runner cannot
reach it. It now lives in lib/task-runner-run.ts, unchanged, and
task-runner-run.smoke.ts drives it with a fake fetch: a run starts and
surfaces its workflow id, a refused launch throws the backend's detail
instead of leaving the page on "Starting…", the started run is selected once
it appears, polling continues until it does, and cancel encodes both ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@polakamtejas
polakamtejas force-pushed the tejas/explorer-ui-remove-embed-mode branch from 1c4928c to 6770c09 Compare October 1, 2026 05:55
@polakamtejas
polakamtejas merged commit d93b50e into main Oct 1, 2026
12 of 13 checks passed
@polakamtejas
polakamtejas deleted the tejas/explorer-ui-remove-embed-mode branch October 1, 2026 06:06
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.

2 participants