Skip to content

feat(gateway): image generation offload - job-service routing, sync_id, poll progress, per-device auth - #86

Closed
siddWednesday wants to merge 1 commit into
mainfrom
feat/image-gen-offload
Closed

siddWednesday wants to merge 1 commit into
mainfrom
feat/image-gen-offload

Conversation

@siddWednesday

@siddWednesday siddWednesday commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What this does

Review note - merge order: this branch sits on top of feat/windows-parity (it uses its per-device token infrastructure). Merge that to main first; this PR's diff then collapses to the single offload commit (617e982). Mobile half: off-grid-ai/OGAM#638.

The desktop half of phone->Mac image-generation offload: a paired (or any LAN) phone POSTs the gateway's existing /v1/images/generations in async mode and receives a desktop-quality image; the mobile half is the matching feat/image-gen-offload branch in OGAM.

  • Image routes run through ImageGenerationJobService instead of calling generateImage() directly. That restores the single-job admission for gateway callers (second request = 429), and gives every gateway image a syncId + sidecar - so it appears in this Mac's own gallery and ships to paired devices over the existing mesh share, exactly like a locally started generation.
  • Responses carry sync_id so a paired requester dedupes the mesh copy against the HTTP result (the phone uses it as the local file id).
  • Pending polls report live progress ({stage, step, total}) - the phone maps this into its normal generation card.
  • Opportunistic bearer auth on the image routes: a presented token is verified against the live per-device action tokens from this branch's tool-grant mesh (401 on mismatch); no credentials keeps the gateway's documented open-LAN posture unchanged.

Verification

Unit + integration: 5 pure tests (image-route.test.ts: response shaping, sync_id, poll progress gating) + 4 against the real booted gateway (image-route-auth.integration.test.ts: open posture reaches 501, valid token accepted, invalid = 401 on both routes). Full suite green through the pre-push gate.

Verified live on a dev build (2026-08-26): 501 honest reason with no model; SDXL pulled headlessly via /v1/models/pull; sync generation returned b64 + sync_id with the sidecar landing in generated-images/; async 202 + poll showed step 3/4 -> 4/4 -> completed with the result held at the poll URL; concurrent request 429'd; bad bearer 401'd. End-to-end phone->Mac generation confirmed on a real iPhone against this branch (image generated on the Mac, delivered into the phone chat).

No screenshots: the change is headless (HTTP surface); the live curl transcript above is the visual. The user-facing surface ships in the OGAM PR.

🤖 Generated with Claude Code

…c bearer auth

The three image POST routes now start jobs via ImageGenerationJobService
instead of calling generateImage directly - restoring the single-job
admission (busy = 429), giving gateway images a syncId + sidecar so they
land in this Mac's gallery and ship to paired devices over the mesh like
local generations. Responses carry sync_id so a paired requester can
dedupe the synced copy; pending polls report live stage/step. A presented
bearer is verified against the live per-device action tokens (401 on
mismatch); no credentials keeps the documented open-LAN posture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0b3055a7-ee71-4ba1-8c71-830e3cd7b0e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@siddWednesday
siddWednesday changed the base branch from feat/windows-parity to main August 26, 2026 11:22
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants