Skip to content

Enhance robustness and error handling across backend and frontend - #267

Merged
thomas9120 merged 12 commits into
mainfrom
beta
Jul 29, 2026
Merged

Enhance robustness and error handling across backend and frontend#267
thomas9120 merged 12 commits into
mainfrom
beta

Conversation

@thomas9120

Copy link
Copy Markdown
Owner

No description provided.

Suppress console window for llama.cpp runtime on Windows
Validate incoming HTTP bodies and origins: read_body now returns None for valid JSON that is not an object and get_request_content_length rejects Transfer-Encoding (501). Handlers return a 400 for malformed/invalid JSON. Harden get_request_host_origin against malformed Host ports (avoid ValueError). Use build_http_origin when composing URLs so IPv6 hosts are bracketed across backend services, tunnel args, app messages and the API tab UI. Also read preset files as UTF-8 and add/adjust unit tests and docs to cover these behaviors.
Print real exceptions to stderr and sanitize user-facing error text across several routes and services (hf_download, web_search, tunnel, status, file_picker). Move file-picker initial_dir.mkdir into the protected block so directory creation failures are handled and logged. Preserve existing config keys (e.g. external_chat_target) when rewriting config.json by loading, updating, and saving instead of overwriting. Update unit tests and docs to assert stderr logging and the preserved config behavior. Files touched: backend/routes/*, backend/services/*, tests/backend/*, and docs/code-review-2026-07-29.md.
Set Jinja templates default to enabled and add --no-jinja false_flag; remove unsupported apply_diff tool option. Enforce chat-template XOR so a custom template file wins over a builtin name and add UI handling to display unknown builtin template names in dropdowns. Use Number/Number.isFinite for numeric parsing (preserve exponent notation). Prevent stray empty assistant bubble on empty chat responses. Add console.debug to previously silent catches. Update frontend unit/e2e tests and sync AGENTS/docs to reflect fetchJson behavior and the other fixes.
Add two new docs: a full-repo code-review (code-review-swarm-2026-07-29.md) and its independent verification (code-review-swarm-2026-07-29-verification.md). Update tests/backend/test_services.py to supply an io.BytesIO as the HTTPError body and assert the body is closed after probing — preventing an open stream leak and aligning the test with expected cleanup behavior.
Multiple hardening fixes across backend and frontend:
- backend: sanitize handler exceptions and track Response.started; bench route serializes wikitext2 extraction with .part file and size checks; hf download verifies Content-Length; send_input no longer holds process_lock, writes via bounded thread.
- frontend: avoid clobbering focused flag/quick-launch inputs, pass force on wholesale flag applies, await stream aborts in chat, tolerate transient benchmark output failures.
- Add .gitattributes eol pins and tests verifying the changes.
Multiple fixes across backend and frontend: add guards to proxy streaming to avoid double responses; centralize install-slot claim/release in process_manager and make cleanup/launch respect it; move slow runtime validation outside locks and recheck state; make git invocations non-blocking with timeout and env; detach restart child on POSIX/Windows; install into staged dirs and atomic swap to avoid losing installs; tighten public-hostname checks. Frontend: add quoteArg for command preview, fix hf-download stall logic, avoid caching failed preset loads, handle case-insensitive preset collisions, and expose/save sampler preset API. Tests and release packaging updated accordingly.
@thomas9120
thomas9120 marked this pull request as ready for review July 29, 2026 19:03
@thomas9120 thomas9120 self-assigned this Jul 29, 2026
@thomas9120
thomas9120 merged commit 2abbc1a into main Jul 29, 2026
5 checks passed
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.

1 participant