Skip to content

fix(agent): exclude ssl.SSLError from local validation error check#14434

Closed
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/issue-14367-ssl-error-local-validation
Closed

fix(agent): exclude ssl.SSLError from local validation error check#14434
nftpoetrist wants to merge 1 commit into
NousResearch:mainfrom
nftpoetrist:fix/issue-14367-ssl-error-local-validation

Conversation

@nftpoetrist

Copy link
Copy Markdown
Contributor

What does this PR do?

ssl.SSLCertVerificationError inherits from SSLError → OSError → ValueError. The is_local_validation_error guard in run_agent.py caught it via isinstance(api_error, ValueError) and triggered a non-retryable abort — even though the error classifier already returns retryable=True for all OSError subclasses (transport heuristic, step 7).

The inline isinstance check fires before classified.retryable is consulted, so the classifier's correct verdict is overridden. Fix: add ssl.SSLError to the exclusion tuple alongside the existing UnicodeEncodeError, mirroring the same pattern already in place.

Related Issue

Fixes #14367

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • run_agent.py: add import ssl (stdlib, no new dependency); extend exclusion tuple to (UnicodeEncodeError, ssl.SSLError) with inline comment explaining the MRO
  • tests/run_agent/test_14367_ssl_local_validation.py: new test file covering the reported case (SSLCertVerificationError), the parent class (ssl.SSLError), the MRO prerequisite, the preserved UnicodeEncodeError exclusion, and regression checks that plain ValueError/TypeError remain local errors

How to Test

  1. Confirm the MRO that caused the bug:
    import ssl
    e = ssl.SSLCertVerificationError("cert error")
    print(isinstance(e, ValueError))  # True — this was the root cause
  2. Run the new tests:
    pytest tests/run_agent/test_14367_ssl_local_validation.py -v
  3. All 7 tests should pass.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

ssl.SSLCertVerificationError inherits from SSLError → OSError → ValueError.
The is_local_validation_error guard incorrectly classified certificate errors
as programming bugs and triggered a non-retryable abort, even though the error
classifier already returns retryable=True for all OSError subclasses.

Fix: add ssl.SSLError to the exclusion tuple alongside UnicodeEncodeError.
Add import ssl (stdlib, no new dependency).

Fixes NousResearch#14367
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent loop, run_agent.py, prompt builder labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #14445 and #14374 for same fix to #14367. All three add ssl.SSLError exclusion to is_local_validation_error.

@nftpoetrist

Copy link
Copy Markdown
Contributor Author

Closing in favor of the earlier #14374 which covers the same fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ssl.SSLCertVerificationError misclassified as local validation error

2 participants