[OPIK-5205] [SDK] fix: improve error messages for opik connect CLI command#6004
Merged
petrotiurin merged 2 commits intomainfrom Mar 31, 2026
Merged
[OPIK-5205] [SDK] fix: improve error messages for opik connect CLI command#6004petrotiurin merged 2 commits intomainfrom
petrotiurin merged 2 commits intomainfrom
Conversation
…mmand - Fail fast with clear message when no command is provided (before API call) - Validate command exists on PATH and is executable before connecting - Improve OPIK_RUNNER_ID missing error to explain opik connect is required - Warn on first poll failure instead of silently debug-logging - Include timeout value in job timeout warning and error report - Log debug when skipping cancelled jobs - Update tests to supply command argument and mock os.execvpe Implements OPIK-5205: [SDK] improve: better error messages for opik connect with missing or invalid executable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment on lines
24
to
+34
| ) -> None: | ||
| """Connect a local runner to Opik and exec the user command.""" | ||
| if not command: | ||
| click.echo( | ||
| "Error: Missing command.\n\n" | ||
| "Usage: opik connect [OPTIONS] COMMAND [ARGS]...\n\n" | ||
| "Example: opik connect --pair <code> python3 main.py", | ||
| err=True, | ||
| ) | ||
| raise SystemExit(2) | ||
|
|
Contributor
There was a problem hiding this comment.
connect rejects bare opik connect but the onboarding UI still instructs opik connect --pair <code> — should we restore the no-command mode or update the onboarding/docs/UX to require and document a concrete COMMAND?
Finding type: Breaking Changes | Severity: 🔴 High
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents:
Before applying, verify this suggestion against the current code. In
sdks/python/src/opik/cli/connect.py around lines 24-34, the connect function was changed
to reject calls with no COMMAND and exits with SystemExit(2). Restore backward
compatibility by removing the early error/exit for missing command: if command is empty,
do not validate or exec an executable; instead set the env (as already built later),
print a short informational message like "No command specified. Set env vars and
exiting.", call client.end(), and return successfully. Only perform the executable
resolution, access checks, and os.execvpe when command is non-empty; keep other error
handling unchanged.
Contributor
Author
There was a problem hiding this comment.
UI will be updated. There's no reason to run opik connect without the command as it becomes a no-op.
…cript runner loop - Warn on first poll failure (API or network), drop to debug for subsequent retries - Debug log when skipping cancelled jobs - Include timeout value in job timeout warning and error message - Escalate reportJobResult failure from debug to warn Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Langchain issues unrelated. |
awkoy
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Improves the
opik connectCLI command to fail fast with clear, actionable error messages instead of confusing failures deep in the connection flow:OPIK_RUNNER_IDmissing error to tell users to useopik connectinstead of setting env vars manuallyChange checklist
Issues
AI-WATERMARK
AI-WATERMARK: yes
Testing
python -m pytest tests/unit/runner/ -v— all 32 tests passopik connectwith no command, nonexistent command, and non-executable file shows correct errors with exit code 2Documentation
N/A