Skip to content

ENG-8504: clearer prime train logs message for ended runs - #1208

Open
JannikSt wants to merge 2 commits into
mainfrom
feature/eng-8504-train-logs-ended-6223
Open

JannikSt wants to merge 2 commits into
mainfrom
feature/eng-8504-train-logs-ended-6223

Conversation

@JannikSt

@JannikSt JannikSt commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

prime train logs <id> on a run that has ended used to print the raw 404:

Error: Failed to get Hosted Training run logs: HTTP 404: No logs available for run

It now prints one clear error and exits 1:

Error: Run <id> has ended; use --all to view its full logs.

What the API returns (platform main)

  • Unknown run ID: GET /rft/runs/{id}/logs → 404 Run <id> not found. This is checked before anything else.
  • Ended run, plain fetch: with no filters, rft_service.get_logs only searches the last 15 minutes of Loki. A run that ended earlier finds nothing there. If no log snapshot was saved at teardown either, it raises ValueError("No logs available for run"), which the route returns as 404 No logs available for run.
  • Ended run with --all: --all sends since_seconds=86400 with tail_lines=5000, so the server treats it as a filtered query over the last 24 hours. It returns matching lines or an empty string, never this 404.

The same 404 can also come back for a live run, for example when the environment has no Loki configured. So only the No logs available for run 404 is remapped, and only after a GET /rft/runs/{id} confirms the run is in a terminal state (STOPPED, FAILED, COMPLETED or PAUSED). Every other case prints exactly what it did before:

  • an unknown run ID (Run <id> not found; no extra status lookup is made)
  • the same 404 on a live run
  • a failed status lookup
  • any error while --all is set

Sample output

$ prime train logs ended-run
Error: Run ended-run has ended; use --all to view its full logs.
[exit 1]

$ prime train logs ended-run --all
step 100 | reward 0.91
training complete
[exit 0]

$ prime train logs live-run
Error: Failed to get Hosted Training run logs: HTTP 404: No logs available for run
[exit 1]

$ prime train logs no-such-run
Error: Failed to get Hosted Training run logs: HTTP 404: Run no-such-run not found
[exit 1]

These were captured against a local stub server that returns the platform's responses.

Tests

New tests in tests/test_rl_logs.py:

  • Ended runs (COMPLETED, STOPPED and FAILED; with and without -f): exactly one Error: line with the new message, no 404, exit code 1.
  • Live run with the same 404: the API error is kept.
  • Unknown run: Run <id> not found is kept and no status lookup is made.
  • Status lookup fails: the API error is kept.

The ended-run tests fail without the source change.

Checks run: ruff check, ruff format --check, ty check src/, and the full packages/prime suite (1971 passed).

Open in Web Open in Cursor 

Note

Low Risk
CLI-only error messaging with guards to avoid remapping live-run or unknown-run failures; adds one extra API call only on a specific 404 path.

Reviewed by Cursor Bugbot for commit e7338ac. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: JannikSt <JannikSt@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T04:58:18.239606Z e428d75 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Co-authored-by: JannikSt <JannikSt@users.noreply.github.com>

This branch has not been deployed

No deployments
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