Skip to content

fix(web_server): handle dangling symlinks in managed files and catch Z.ai image rejections - #97785

Open
ziuus wants to merge 1 commit into
NousResearch:mainfrom
ziuus:fix/web-files-symlink-and-image-rejection
Open

fix(web_server): handle dangling symlinks in managed files and catch Z.ai image rejections#97785
ziuus wants to merge 1 commit into
NousResearch:mainfrom
ziuus:fix/web-files-symlink-and-image-rejection

Conversation

@ziuus

@ziuus ziuus commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Fixes issues in the file browser and provider error-handling loop:

  1. Managed Files Dangling Symlink 500 Error (hermes_cli/web_server.py):

    • list_managed_files crashed with HTTP 500 (Could not stat path: [Errno 2] No such file or directory) when encountering dangling/broken symlinks (such as Steam's standard linux32/steam link).
    • Updated _managed_file_entry to fall back to target.lstat() when target.resolve().stat() fails due to OSError.
    • Added entry-level error isolation so individual unstat'able paths do not crash directory listings.
  2. Z.ai / Zhipu GLM Multimodal Image Rejection (agent/message_sanitization.py):

    • Z.ai's text-only endpoints reject multimodal requests with HTTP 400: messages.content.type is invalid, allowed values: ['text'].
    • Added error phrases to _IMAGE_REJECTION_PHRASES so Hermes recognizes the image rejection, strips images, and safely transitions to text-only mode for the session instead of cascading into unhandled provider retries.
  3. Copilot Fallback Model Alias (hermes_cli/models.py):

    • Mapped speculative gpt-5-mini alias to gpt-4o-mini to prevent Copilot endpoint 400 model_not_supported errors during fallback execution.

Test Plan

  • tests/hermes_cli/test_web_server_files.py: Added test_dangling_symlink_does_not_crash_file_listing to verify dangling symlinks return 200 OK with lstat metadata.
  • tests/run_agent/test_image_rejection_fallback.py: Added test_zai_image_rejection_matches to verify Z.ai 400 rejection body triggers text-only fallback.
  • Ran test suite: pytest tests/hermes_cli/test_web_server_files.py tests/run_agent/test_image_rejection_fallback.py tests/hermes_cli/test_copilot_*.py (81/81 passed).

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) tool/vision Vision analysis and image generation provider/zai ZAI provider provider/copilot GitHub Copilot (ACP + Chat) P2 Medium — degraded but workaround exists labels Aug 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: the dangling-symlink listing repair overlaps #68443, #66923, #47159, #90018, and #92277. This PR additionally bundles Z.ai image-rejection and Copilot fallback fixes, so it is not a duplicate of those focused alternatives.

…Z.ai image rejections

- Return lstat info and prevent HTTP 500 when encountering dangling symlinks in list_managed_files
- Add Z.ai / Zhipu GLM error phrases to _IMAGE_REJECTION_PHRASES so text-only fallback triggers cleanly when image content is rejected
- Map speculative Copilot model alias gpt-5-mini to active endpoint gpt-4o-mini
- Add regression tests for dangling symlink listing and Z.ai image rejection phrase isolation
@ziuus
ziuus force-pushed the fix/web-files-symlink-and-image-rejection branch from 2f086a8 to ef9aa27 Compare August 29, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P2 Medium — degraded but workaround exists provider/copilot GitHub Copilot (ACP + Chat) provider/zai ZAI provider tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants