Skip to content

Add grok-superimage support, streaming/error handling, image recovery, and config/proxy improvements#53

Merged
lijirou12 merged 2 commits intomainfrom
codex/migrate-imagine-to-grok-superimage-1.0-db29lm
Feb 27, 2026
Merged

Add grok-superimage support, streaming/error handling, image recovery, and config/proxy improvements#53
lijirou12 merged 2 commits intomainfrom
codex/migrate-imagine-to-grok-superimage-1.0-db29lm

Conversation

@lijirou12
Copy link
Copy Markdown
Owner

Motivation

  • Introduce a server-controlled SuperImage model and improve image-generation reliability when upstreams are reviewed/blocked.
  • Harden streaming endpoints so SSE clients receive structured error events instead of transport-level 5xx breaks.
  • Improve retry behavior for transient upstream errors and add recovery attempts for image generation when final images are not produced.
  • Expose and protect configuration bootstrap behavior and add admin UI fields for new image-related settings.

Description

  • Added grok-superimage-1.0 to ModelService and implemented server-side image config ([superimage]) with _superimage_server_image_config() to force n/size/response_format for that model, and adjusted chat/image handlers to use it.
  • Implemented robust SSE helpers: _safe_sse_stream() to wrap async streams and _streaming_error_response() to emit SSE error events for streaming endpoints, and integrated them into chat/image/video flow to avoid transport-level failures.
  • Enhanced image orchestration: default retry.max_retry fallbacks, introduce transient_upstream() to detect transient upstream errors and retry with alternate tokens, add image.blocked_parallel_attempts and image.blocked_parallel_enabled logic to perform parallel recovery attempts using distinct tokens when finals are missing, and ensure chat-format streams only emit final images with a final empty chunk and [DONE] marker.
  • Improved WebSocket imagine reverse: stricter final-image classification by byte-threshold, clearer blocked/retry signaling, and extra logging for suspected review/block scenarios; refactored collection/stream processors to filter final candidates and preserve original image names for grok-superimage-1.0 chat streams.
  • App chat reverse: normalize and handle proxy URLs (including SOCKS variants) and send proxy via appropriate proxy or proxies parameter for curl_cffi, and refine timeout selection logic.
  • Config and admin changes: protect remote bootstrap when remote returned empty and local seed absent, persist only when safe, add new defaults and UI fields for image.blocked_parallel_* and [superimage] in config.defaults.toml and update app/static/admin/js/config.js and README to surface the new settings; minor API rename for admin storage route (get_storage -> get_storage_mode) and import rename for clarity.

Testing

  • Ran the project's automated unit test suite and linters; all checks passed.
  • Executed automated integration/smoke tests for /v1/chat/completions covering conversation, image (streaming and non-streaming), and image-edit flows; streaming error events and final-image recovery flows behaved as expected in CI and passed.
  • Verified automated tests for reverse WebSocket imagine stream and proxy handling under simulated blocked/timeout conditions; recovery retries and SSE error payloads were emitted as designed.

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grok2api Ready Ready Preview, Comment Feb 27, 2026 5:34am

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@lijirou12 lijirou12 merged commit 569a85b into main Feb 27, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant