Skip to content

Interactive tasks on the CLI#1534

Merged
deep1401 merged 29 commits intomainfrom
add/cli-interactive-tasks-spec
Mar 16, 2026
Merged

Interactive tasks on the CLI#1534
deep1401 merged 29 commits intomainfrom
add/cli-interactive-tasks-spec

Conversation

@aliasaria
Copy link
Copy Markdown
Member

Summary

  • Adds a design spec for lab task interactive CLI command and TUI integration to the job monitor
  • Enables launching interactive sessions (Jupyter, vLLM, Ollama, SSH, VS Code) from the CLI
  • CLI flow: select provider → pick template → configure env params → launch → poll until ready → print connection info
  • TUI flow: new i keybinding in job monitor opens interactive task modal
  • Also includes lab job stop as a prerequisite deliverable (command doesn't exist yet)
  • All backend API endpoints already exist; no new endpoints needed

Test plan

  • Review spec for completeness and accuracy against existing codebase
  • Verify all referenced API endpoints exist and match spec descriptions
  • Confirm spec aligns with frontend behavior in NewInteractiveTaskModal.tsx

Spec covers adding `lab task interactive` CLI command and TUI integration
to the job monitor for launching interactive sessions (Jupyter, vLLM,
Ollama, etc.) from the command line.
@paragon-review
Copy link
Copy Markdown

Paragon Review Skipped

Hi @aliasaria! Your Polarity credit balance is insufficient to complete this review.

Please visit https://home.polarity.cc to add more credits and continue using Paragon reviews.

@aliasaria aliasaria marked this pull request as draft March 12, 2026 17:33
Detailed step-by-step plan covering:
- lab job stop command (prerequisite)
- lab task interactive CLI command
- InteractiveTaskModal for TUI monitor
- Connection info display in JobDetails
Adds `lab task interactive` CLI command that guides users through selecting a compute provider and interactive task template (Jupyter, vLLM, Ollama, etc.), collecting configuration, launching the job, and polling until the service is ready before printing connection info.
@aliasaria aliasaria changed the title Add design spec for CLI interactive tasks Interactive tasks on the CLI Mar 12, 2026
- Fix _dismiss_all to use pop_screen exclusively (avoid screen stack corruption)
- Add minutes_requested to resource collection and launch payload
- Validate required env params (reject empty input)
- Use dedicated widget for connection info instead of appending to artifacts
- Add polling retry for connection info in TUI (up to 60s)
- Set selected_provider before set_options to avoid reactive event race
The /server/info route was removed, causing the CLI status command to
return a 404. Switch to /healthz which is always available.
Instructs agents to run CLI tests after modifying code under cli/src/.
The test was reading real credentials from disk instead of simulating
the not-logged-in state, causing it to exit 0 instead of 1.
Consolidate 9 inline current_experiment checks into a single
reusable function in config.py.
The backend already stores error_msg in job_data when jobs fail, but
neither the CLI nor frontend ever read or displayed it. Now:
- CLI job info shows the error field and renders FAILED in red
- CLI interactive polling shows the error when a job fails mid-wait
- Frontend JobProgress shows error_msg for FAILED jobs
- TUI and CLI interactive forms show help_text hints and use
  placeholder as default values
The CLI was reading `run` from the gallery entry's `command` field,
but GitHub-sourced templates (e.g. Ollama+Gradio) have no inline
command — the run command comes from task.yaml fetched during import.
The UI works because it refreshes the task list after import.

Now the CLI and TUI modal fetch the imported task after import and
read `run`/`setup` from the flat task fields, matching the UI behavior.
Also fixes reading task fields as flat dict instead of nested config.
Add validation in the launch endpoint to reject empty commands with a
clear 400 error. Also improve remote_trap to set job status to crashed
with a descriptive message instead of printing a cryptic usage string.
Match the UI behavior where polling only continues for LAUNCHING,
INTERACTIVE, WAITING, and RUNNING states. Also simplify CLI launch
payload to rely on backend command resolution instead of fetching
the imported task client-side.
When the CLI/TUI doesn't send github_repo_url, github_repo_dir, and
github_repo_branch, fall back to the stored task's fields so the repo
is cloned into the workspace before the run command executes.
@sentry
Copy link
Copy Markdown

sentry bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 5.26316% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/transformerlab/routers/compute_provider.py 5.26% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

When the run command falls back to the stored task's fields for
GitHub-sourced interactive tasks, also pick up the setup command
so dependencies are installed before the run command executes.
Show a spinner with elapsed time while no logs are available, remove
it once real log lines arrive. Filter out "No log files found" server
response so it doesn't display as a log line.
@aliasaria aliasaria marked this pull request as ready for review March 13, 2026 18:34
@deep1401 deep1401 merged commit 543db71 into main Mar 16, 2026
11 of 12 checks passed
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