Repository navigation
feat(desktop): sign free Auto requests and relay them only for live tasks - #5195
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Deploying openwork with
|
| Latest commit: |
3e210f3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://944354b8.openwork.pages.dev |
| Branch Preview URL: | https://feature-desktop-auto-access.openwork.pages.dev |
…SHA-256 Free credentials and identities were stored as plain SHA-256 digests, which code scanning flags as weak hashing of sensitive data. Den and the Gateway now share one domain-separated helper: identities use a keyed SHA-256 tag and free credentials use a WebCrypto HMAC, matching the Gateway bearer-key store. Free access is off by default and unreleased, so no stored tags need migrating. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BMeBni56bB19LwDFqNsQEw
… OpenAI key Treat signed-out, signed-in and subscribed users as three separate systems: - Signed-out desktops keep dedicated anonymous_inference_* tables with no organization, member, user or key columns. Their allowance is keyed on a machine id carried in the signed proof, so reinstalling does not reset it. - Signed-in members of unsubscribed organizations use their regular OpenWork Models (ow_inf_) key on /api/v1. The proxy serves them only Auto, within a weekly per-person allowance held in inference_free_* tables. The separate ow_auto_ credential and inference_free_keys are removed. - Subscribed organizations keep the existing paid path unchanged. Free requests no longer touch OpenRouter. Both free paths call OpenAI Chat Completions with a single INFERENCE_FREE_OPENAI_API_KEY; revoking that key is the kill switch, and its OpenAI usage shows the running cost. Allowance cost is computed from OpenAI token counts, and requests OpenAI refuses (401, 403, 429) release their hold instead of being charged.
- Derive a deterministic machine id from the OS identifier (IOPlatformUUID, MachineGuid or /etc/machine-id), salted and hashed on the device, and carry it in every signed proof. The guest allowance now follows the machine, so a reinstall or cleared app data does not reset it. The session body is empty. - Signed-in members receive their OpenWork Models (ow_inf_) key and reach Auto on the regular /api/v1 routes. - The engine talks to the local relay through @ai-sdk/openai-compatible instead of the OpenRouter adapter.
Guests may use free Auto only from the newest three stable desktop releases, with every release supported for at least 14 days after it ships. Each stable release derives its own secret from DESKTOP_FREE_RELEASE_KEY at build time and tags its signed proof with it (proof v3); the gateway derives the same secret from the version the proof claims, so a secret lifted from one release cannot be presented as another and expires with its release. Knobs: DESKTOP_FREE_SUPPORTED_RELEASE_COUNT, DESKTOP_FREE_SUPPORTED_RELEASE_MIN_DAYS, DESKTOP_FREE_BLOCKED_RELEASES, DESKTOP_FREE_RELEASE_KEY_PREVIOUS (rotation overlap), DESKTOP_FREE_FIRST_RELEASE_TAG_VERSION (v2 cutover) and a dev-mode DESKTOP_FREE_DEV_RELEASE_SECRET for unversioned developer builds. The release list comes from GitHub and is served stale for up to a day if GitHub fails. Signed-in members are unaffected.
…y from user sends Each stable release derives its free Auto secret from DESKTOP_FREE_RELEASE_KEY in CI (HMAC over the version) and ships it inside the Electron main bundle in a split, masked form; every signed proof now carries a release tag (proof v3) so the gateway can hold guests to its release support window. Developer builds use OPENWORK_DEV_FREE_RELEASE_SECRET in dev mode; untagged builds keep signing v2. The desktop now reports its real app version instead of Electron's in development. The local relay forwards the engine's model calls only while a task the user started from the app with Auto selected is live: a send opens a window that idles out after 15 minutes without completed calls and closes after two hours, on session end, and whenever the engine credential rotates. Engine calls that name a session must name one the user started.
Guests can assert any machine id, so make a fresh one worth little instead of trying to prove it: the weekly device allowance ramps with the machine's age (ANONYMOUS_INSTALL_RAMP, default $0.10 on day 0, $0.25 from day 1, $0.50 from day 3, full from day 7; a bucket's limit only ever rises within its week), each IP may introduce only a few never-seen machines a day (ANONYMOUS_IP_NEW_IDENTITIES_PER_DAY, default 5), and minting a guest session costs a small proof of work bound to the proof's single-use nonce (ANONYMOUS_SESSION_POW_BITS, default 20). First sightings live in the guest-only anonymous_inference_identities table.
The relay picks the proof nonce itself, solves the gateway's proof of work for that nonce (default 20 bits, OPENWORK_FREE_SESSION_POW_BITS for developer builds) and asks the signer to sign with it, so the work is bound to a single-use proof. If the gateway demands more bits than the build assumed, the relay redoes the work once up to the supported maximum. The signer accepts a caller-supplied nonce and refuses malformed ones.
… raise the session proof of work to 23 bits
The relay starts the proof of work on a worker thread as soon as it initialises, so the first message finds it done, and begins the next one right after each mint. Bun (the test runner) falls back to an in-process solve; a cancelled job never falls back. Default work rises to 23 bits.
…and tighten the proof of work The device allowance now ramps on active minutes rather than wall-clock age: every signed guest request is a heartbeat, and the time since the previous one is credited only when the gap is short enough to mean the app stayed open (ANONYMOUS_ACTIVITY_MAX_GAP_MS, default 3 minutes). Default tiers: $0.10, then $0.20 after 10 active minutes, $0.50 after 20, the full $1 after 30. The session proof of work becomes eight 20-bit puzzles instead of one 23-bit puzzle, so the time to solve clusters around one to three seconds instead of occasionally taking many times longer; verification stays eight hashes.
… proof of work While the app is open and signed out, the relay sends a signed status check every minute (OPENWORK_FREE_HEARTBEAT_MS) so the gateway can credit time with the app open toward the guest allowance. The background solver now works the gateway's multi-round puzzle (rounds and bits both honoured on a session_pow_required reply).
…cess # Conflicts: # apps/desktop/package.json
# Conflicts: # ee/packages/den-db/drizzle/meta/0115_snapshot.json # ee/packages/den-db/drizzle/meta/_journal.json # packages/docs/openapi.json
benjaminshafii
previously approved these changes
Sep 30, 2026
reachjalil
dismissed
benjaminshafii’s stale review
September 30, 2026 20:15
The merge-base changed after approval.
benjaminshafii
previously approved these changes
Sep 30, 2026
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
benjaminshafii
approved these changes
Sep 30, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
The desktop signs free Auto requests and relays them while a task the person started is running.
What problem does it solve?
Signing in must use the member allowance, changing accounts must end access for the previous account, and unrelated local callers must not spend it.
What was the situation before?
Guest Auto did not use a member allowance, and its relay accepted callers without a task activation.
How is this implemented?
DESKTOP_FREE_RELEASE_KEY.apps/server/src/free-auto/.auto_not_activated.Retry-Afterto avoid unnecessary proof work.What else changed?
The outbound access manifest and guide include the inference host. Release signing prints a fingerprint, and server build metadata includes the current plugin list.
Release note
Desktop Auto uses your signed-in allowance and only allows requests from an active task.
Evidence
No E2E; relay and signer unit tests prove unrestricted local access → rejection until an Auto send activates the relay.