Skip to content

Commit a34c3f3

Browse files
authored
Merge branch 'main' into bump/matplotlib-3.11.0
2 parents 4aac0e2 + b338eee commit a34c3f3

15 files changed

Lines changed: 42 additions & 107 deletions

File tree

.agents/skills/transformerlab-cli/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ Also note that secrets passed inside `--config` (e.g. `api_token`, `azure_client
762762
9. **`job task-logs --follow`** streams continuously and blocks until the job finishes — use when the user wants real-time monitoring
763763
10. **Never use the deprecated `lab job logs`** — see the "Job logs: three real commands" section below.
764764
11. **Before queuing a task, CONFIRM the experiment with the user.** Run `lab config` to read the current default and `lab --format json experiment list` to verify it exists, then ask: "I'm about to queue this under experiment `<name>` (your current default). OK, or pick another?" Show 2–3 alternatives from `experiment list` if the current one looks stale or missing. Skip the confirmation only when the user has already named the experiment in this turn.
765-
12. **After queuing a task, ASK the user if they'd like you to watch the logs.** Don't start streaming or polling automatically — jobs can take minutes to hours, and `--follow` blocks. Report the Job ID and ask: "Want me to watch the logs and report back?"
765+
12. **After queuing a task, ASK the user if they'd like you to watch the logs.** Don't start streaming or polling automatically — jobs can take minutes to hours, and `--follow` blocks. Report the Job ID and ask: "Want me to watch the logs and report back?" If they say yes and your harness can self-schedule (e.g. Claude Code's `ScheduleWakeup`), watch by checking once per turn and scheduling the next check — not a blocking `--follow` or a `while`/`sleep`/background poll loop, which can strand the session with a finished job (see workflows.md "Polling Pattern for Agents").
766766
13. **Never create API keys programmatically** — if auth fails, ask the user to provide an API key from the web UI
767767
14. **Always pass `--description/-m` when queuing a task. Generate it yourself — never ask the user.** See "Always write a run description" below.
768768

.agents/skills/transformerlab-cli/references/autoresearch.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ The agent loops autonomously. Never ask "should I continue?" — keep going unti
250250
6. **Advance.** What this means depends on parallelism:
251251
- **N = 1 (sequential):** wait for the just-queued job to finish, then go to step 7. Poll with `lab --format json job list --running`.
252252
- **N ≥ 2 (parallel / fire-and-advance):** **do not wait.** Return to step 0 and pick the next idea immediately, until `RUNNING >= N`. Only block when the queue is full. This is what enables grid-style search; waiting after every queue collapses parallelism back to 1.
253+
- **How to "wait" / "block" without stranding the session:** don't hold the turn open with a `while`/`sleep` or `run_in_background` poll loop — on remote providers the harness can't track the job, so a loop that ends before the job finishes leaves the session idle until a manual nudge. If your harness can self-schedule (e.g. Claude Code's `ScheduleWakeup`), do **one** `lab job list --running` / `job info` check, then schedule the next check and end the turn, repeating until a job is terminal. The bare poll loop is the fallback for scripts/cron and agents without self-scheduling.
253254
7. **Score → keep or discard** any *completed* jobs whose results haven't been processed yet. In parallel mode, this means scanning recently-finished jobs at the start of each cycle, not just the one you queued last.
254255
```bash
255256
# Find COMPLETE jobs we haven't acted on yet (no discard flag set, not the current best).

.agents/skills/transformerlab-cli/references/workflows.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ lab --format json job info JOB_ID
188188

189189
### Polling Pattern for Agents
190190

191+
> **Interactive agents: prefer your harness's scheduler over this loop.** The `while`/`sleep`
192+
> loop below blocks a whole turn, and run in the background it can be orphaned by a user
193+
> message — either way it can leave the session idle with a finished job unnoticed. If your
194+
> harness can self-schedule a wake (e.g. Claude Code's `ScheduleWakeup`), do **one** `lab job
195+
> info` check per turn, then schedule the next check and end the turn, repeating until terminal.
196+
> The blocking loop below is the fallback for scripts, cron, and agents without self-scheduling.
197+
191198
When monitoring a job programmatically, use this pattern:
192199

193200
```bash

.agents/skills/transformerlab-cli/templates/queue-and-monitor.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Template: Queue a task and monitor until completion
33
# Queues a task non-interactively, polls for job completion, and downloads results.
44
#
5+
# NOTE: this blocking poll loop is for scripts/cron. An interactive agent should NOT run it
6+
# in-session — a self-scheduling harness (e.g. Claude Code's ScheduleWakeup) should check once
7+
# per turn and reschedule instead, so a finished job can't strand the session.
8+
#
59
# Usage: ./queue-and-monitor.sh <task_id> [output_dir]
610
#
711
# Arguments:

.github/workflows/prettier.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ jobs:
2323
with:
2424
node-version: "22"
2525

26+
# Must match the prettier version in package.json devDependencies,
27+
# or local `npm run format` and this check will disagree.
2628
- name: Install Prettier
27-
run: npm install -g prettier@3.8.3
29+
run: npm install -g prettier@3.9.4
2830

2931
- name: Check Prettier formatting
3032
run: npm run format:check

api/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ async def lifespan(app: FastAPI):
217217
integrations=[FastApiIntegration()],
218218
# Enable sending logs to Sentry
219219
enable_logs=True,
220-
# Set traces_sample_rate to 1.0 to capture 100%
221-
# of transactions for tracing.
222-
traces_sample_rate=1.0,
223-
# Set profile_session_sample_rate to 1.0 to profile 100%
224-
# of profile sessions.
225-
profile_session_sample_rate=1.0,
220+
traces_sample_rate=float(os.getenv("SENTRY_TRACES_SAMPLE_RATE", "1.0")),
221+
# The profiler samples frames across threads, which can segfault the
222+
# interpreter on Python 3.11 (frame_getback race, e.g.
223+
# https://github.com/getsentry/sentry-python/issues/2386), so it is
224+
# off unless explicitly enabled.
225+
profile_session_sample_rate=float(os.getenv("SENTRY_PROFILE_SESSION_SAMPLE_RATE", "0.0")),
226226
# Set profile_lifecycle to "trace" to automatically
227227
# run the profiler on when there is an active transaction
228228
profile_lifecycle="trace",

api/run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ fi
127127
# Temporary: Turn off python buffering or debug output made by print() may not show up in logs
128128
export PYTHONUNBUFFERED=1
129129

130+
# Print the Python traceback of the crashing thread if the interpreter dies on a
131+
# fatal signal (e.g. segfault), so crashes are diagnosable from the service logs
132+
export PYTHONFAULTHANDLER=1
133+
130134
UVICORN_WORKERS=${TFL_UVICORN_WORKERS:-1}
131135

132136
echo "▶️ Running one-time startup tasks before workers"

api/transformerlab/services/job_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ async def get_artifacts_from_sdk(job_id: str, experiment_id: str) -> Optional[Li
842842
return None
843843

844844
sdk_job = Job(job_id, experiment_id)
845-
artifact_paths = sdk_job.get_artifact_paths()
845+
artifact_paths = await sdk_job.get_artifact_paths()
846846

847847
if not artifact_paths:
848848
return None

cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "transformerlab-cli"
7-
version = "0.0.67"
7+
version = "0.0.68"
88
description = "Transformer Lab CLI"
99
requires-python = ">=3.10"
1010
authors = [{ name = "Transformer Lab", email = "hello@transformerlab.ai" }]

cli/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)