Add interactive task support for GitHub-hosted task definitions (Ollama + Gradio)#1503
Add interactive task support for GitHub-hosted task definitions (Ollama + Gradio)#1503
Conversation
When an interactive gallery entry specifies a local_task_dir path, the files are copied into the task directory (inside a subdirectory matching the source directory name) on import, mirroring the github_repo_dir clone behavior. The task is marked with file_mounts=True so files are copied to the job at launch.
When a local_task_dir has a task.yaml, its setup, run, parameters, env_vars, and resource fields are now parsed and used to populate the interactive task. This fixes the 'Task is missing a command to run' error since command was previously left empty for local_task_dir entries.
When a gallery template has local_task_dir, the frontend now calls the ImportFromGallery API instead of NewTemplate. This ensures the task gets its command/setup populated from the directory's task.yaml and the files are copied into the task directory. Fixes 'Task is missing a command to run' error for local_task_dir gallery entries.
This reverts commit 16d04bd.
Tasks imported from local_task_dir gallery entries have their command in the copied task.yaml rather than in the gallery JSON. Skip the frontend command-required check when file_mounts is set.
For local_task_dir gallery entries, call ImportFromGallery instead of NewTemplate so the task gets created with command/setup from task.yaml and files copied — matching the regular 'Upload from Local Directory' flow. Revert launch-time and command-check workarounds.
Paragon SummaryThis pull request review identified 6 issues across 3 categories in 16 files. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools. This PR adds support for interactive gallery entries that source their task definitions from GitHub repositories (replacing the previous local filesystem approach), with the first implementation being an Ollama + Gradio chat interface. It extends both frontend and backend to fetch Key changes:
Confidence score: 3/5
16 files reviewed, 6 comments Severity breakdown: High: 3, Medium: 2, Low: 1 Tip: |
| provider_name: providerMeta.name, | ||
| env_vars: Object.keys(envVars).length > 0 ? envVars : undefined, | ||
| }; | ||
| if (template.local_task_dir) { |
There was a problem hiding this comment.
Bug: Tasks
Tasks.tsx checks only local_task_dir, missing github_repo_url. GitHub-sourced interactive tasks silently get empty commands. Add || template.github_repo_url.
View Details
Location: src/renderer/components/Experiment/Tasks/Tasks.tsx (lines 743)
Analysis
Tasks.tsx checks only local_task_dir, missing github_repo_url
| What fails | GitHub-sourced interactive tasks (like ollama_gradio) created from the Tasks tab get routed to the wrong code path, producing tasks with empty setup/command. |
| Result | Task is created via the NewTemplate endpoint with empty command/setup fields instead of going through ImportFromGallery which fetches task.yaml from GitHub. |
| Expected | Tasks.tsx should check `template.local_task_dir |
| Impact | Every GitHub-sourced interactive task created from the Tasks view will fail at runtime with no command to execute. |
How to reproduce
1. Open Tasks tab
2. Create a new interactive task using the ollama_gradio gallery entry (which has github_repo_url but no local_task_dir)
3. Observe the created task has no command/setupPatch Details
- if (template.local_task_dir) {
+ if (template.local_task_dir || template.github_repo_url) {AI Fix Prompt
Fix this issue: Tasks.tsx checks only `local_task_dir`, missing `github_repo_url`. GitHub-sourced interactive tasks silently get empty commands. Add `|| template.github_repo_url`.
Location: src/renderer/components/Experiment/Tasks/Tasks.tsx (lines 743)
Problem: GitHub-sourced interactive tasks (like ollama_gradio) created from the Tasks tab get routed to the wrong code path, producing tasks with empty setup/command.
Current behavior: Task is created via the NewTemplate endpoint with empty command/setup fields instead of going through ImportFromGallery which fetches task.yaml from GitHub.
Expected: Tasks.tsx should check `template.local_task_dir || template.github_repo_url` (matching Interactive.tsx) and route GitHub-sourced entries through ImportFromGallery.
Steps to reproduce: 1. Open Tasks tab
2. Create a new interactive task using the ollama_gradio gallery entry (which has github_repo_url but no local_task_dir)
3. Observe the created task has no command/setup
Provide a code fix.
Tip: Reply with @paragon-run to automatically fix this issue
|
|
||
| venv_bin = venv_path / "bin" | ||
| env = os.environ.copy() | ||
| print(f"[DEBUG LocalProvider] config.env_vars = {config.env_vars}") |
There was a problem hiding this comment.
Bug: Debug print() statements dump env_vars containing secrets to stdout
Debug print() statements dump env_vars containing secrets to stdout. Credentials leak to logs and aggregators. Remove all [DEBUG print statements.
View Details
Location: api/transformerlab/compute_providers/local.py (lines 276)
Analysis
Debug print() statements dump env_vars containing secrets to stdout
| What fails | Debug print statements output full env_vars dicts containing NGROK_AUTH_TOKEN, {{secret.*}} references, and user-supplied values to stdout/logs in production. |
| Result | Secrets and API tokens are written in plaintext to stdout, which is often forwarded to log aggregators, container runtimes, or returned via API log endpoints. |
| Expected | No debug print statements should be present in production code. Secrets should never appear in logs. |
| Impact | Credentials and API tokens exposed in plaintext logs. Violates the project's secret-management pattern where secrets use {{secret.}} placeholders. |
How to reproduce
1. Launch any interactive task with env_vars (e.g. ollama_gradio with MODEL_NAME)
2. Check server stdout/logs
3. Observe full env_vars dicts printed in plaintextAI Fix Prompt
Fix this issue: Debug print() statements dump env_vars containing secrets to stdout. Credentials leak to logs and aggregators. Remove all `[DEBUG` print statements.
Location: api/transformerlab/compute_providers/local.py (lines 276)
Problem: Debug print statements output full env_vars dicts containing NGROK_AUTH_TOKEN, {{secret.*}} references, and user-supplied values to stdout/logs in production.
Current behavior: Secrets and API tokens are written in plaintext to stdout, which is often forwarded to log aggregators, container runtimes, or returned via API log endpoints.
Expected: No debug print statements should be present in production code. Secrets should never appear in logs.
Steps to reproduce: 1. Launch any interactive task with env_vars (e.g. ollama_gradio with MODEL_NAME)
2. Check server stdout/logs
3. Observe full env_vars dicts printed in plaintext
Provide a code fix.
Tip: Reply with @paragon-run to automatically fix this issue
tmp/ollama-gradio-chat/task.yaml
Outdated
| cpus: 2 | ||
| memory: 4 | ||
| setup: | | ||
| echo "=== SETUP DEBUG ===" |
There was a problem hiding this comment.
Bug: task
task.yaml ships debug echo blocks exposing PATH and VIRTUAL_ENV. These pollute user-facing logs. Strip debug echo statements before merge.
View Details
Location: tmp/ollama-gradio-chat/task.yaml (lines 8)
Analysis
task.yaml ships debug echo blocks exposing PATH and VIRTUAL_ENV. These pollute user-facing logs
| What fails | The task.yaml file contains extensive debug echo statements in both setup and run sections that print internal Python paths, sys.path, VIRTUAL_ENV, and PATH to job logs. |
| Result | User-facing job logs are cluttered with internal debug information including Python paths and environment variables. |
| Expected | Task definitions shipped to users should contain only functional commands. Debug echo blocks should be removed before merge. |
| Impact | Noisy logs degrade UX. PATH and VIRTUAL_ENV disclosure is a minor information leak in production logs. |
How to reproduce
1. Create and launch the ollama-gradio-chat interactive task
2. View the job logs
3. Observe debug output like 'which python:', 'sys.path:', 'VIRTUAL_ENV:', 'PATH:' polluting the log streamAI Fix Prompt
Fix this issue: task.yaml ships debug echo blocks exposing PATH and VIRTUAL_ENV. These pollute user-facing logs. Strip debug echo statements before merge.
Location: tmp/ollama-gradio-chat/task.yaml (lines 8)
Problem: The task.yaml file contains extensive debug echo statements in both setup and run sections that print internal Python paths, sys.path, VIRTUAL_ENV, and PATH to job logs.
Current behavior: User-facing job logs are cluttered with internal debug information including Python paths and environment variables.
Expected: Task definitions shipped to users should contain only functional commands. Debug echo blocks should be removed before merge.
Steps to reproduce: 1. Create and launch the ollama-gradio-chat interactive task
2. View the job logs
3. Observe debug output like 'which python:', 'sys.path:', 'VIRTUAL_ENV:', 'PATH:' polluting the log stream
Provide a code fix.
Tip: Reply with @paragon-run to automatically fix this issue
… stdout Debug print() statements dump env_vars containing secrets to stdout. Credentials leak to logs and aggregators. Remove all [DEBUG print statements.
The local_task_dir branch in Tasks.tsx was missing env_vars in the POST body, causing user-provided environment parameters (e.g. MODEL_NAME) to be silently dropped. Matches the Interactive.tsx implementation.
Replace single iframeRef with a ref Map keyed by tab index and track the active tab. handleRefresh() now resolves the correct iframe for the currently selected tab.
Gate the SWR polling URL on isInteractive instead of showActions so WAITING/LAUNCHING jobs no longer trigger 3s polling for tunnel info that doesn't exist yet.
Summary
This PR adds full support for interactive gallery entries that source their task definitions from GitHub repositories, replacing the previous local filesystem approach. The first entry to use this is the Ollama + Gradio interactive task, which launches an Ollama model server with a Gradio chat UI.
What was created
interactive-gallery.json): A new interactive task that starts Ollama, pulls a model, and launches a Gradio chat interface. It sources itstask.yaml(setup/run commands, parameters, etc.) fromtransformerlab-examples/inference-ollama-gradio-chat.url_patternsfield in gallery entries): Allows gallery entries to define regex patterns for extracting URLs from provider logs (e.g., Gradio'sRunning on ...output).Key changes to support GitHub-sourced interactive tasks
Previously, interactive gallery entries could only use inline
setup/commandfields or alocal_task_dirpointing to a directory on the local filesystem. This PR extends the system so interactive entries can usegithub_repo_url+github_repo_dir— the same pattern used by the regular task gallery.Frontend (
Interactive.tsx)ImportFromGalleryAPI now triggers ontemplate.github_repo_urlin addition totemplate.local_task_dir. This routes GitHub-sourced interactive entries through the proper import flow that fetchestask.yamland stores the task with all its metadata.Backend (
task.py)import_task_from_gallerynow handles three source types:github_repo_url+github_repo_dir→ fetchestask.yamlfrom GitHub viafetch_task_yaml_from_github()local_task_dir→ readstask.yamlfrom local filesystem (existing behavior)setup/commanddirectly from the gallery entry (existing behavior)github_repo_url,github_directory,github_branch) is stored on the task so the runner clones the repo files at launch time.task.yamlcontent is saved to the task directory, matching the behavior of regular task imports.Other changes
tunnel_parser.py): Extended to support customurl_patternsfor extracting dynamic URLs from provider logs.is_interactivefield to the import request.idrather thaninteractive_type, supporting multiple entries of the same type.tunnel_infois ready, preventing premature clicks.Gallery entry diff
Testing
url_patternsand displayed in the interactive modal.