Skip to content

feat(den): add saved Code Mode scripts for cloud automations - #3656

Merged
reachjalil merged 11 commits into
devfrom
codex/dynamic-artifacts-codemode
Aug 10, 2026
Merged

reachjalil merged 11 commits into
devfrom
codex/dynamic-artifacts-codemode

Conversation

@reachjalil

@reachjalil reachjalil commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Why

#3645 established versioned Code Mode scripts and their restricted runtime, but Den still lacked a durable save/run contract for turning a successful ad-hoc execution into reusable work. Automations also only dispatched model-backed instructions to desktop runners.

This PR lands the Den contract and storage first. Keeping every desktop and Den-web consumer out of this diff gives the additive API time to deploy before a published client can use it, which follows the repository's protected migration workflow.

What changed

  • Adds authenticated saved-Script list, save, and exact-version run APIs.
  • Saves only source matching a recent successful receipt for the same member and code digest.
  • Persists typed input/output schemas and validates manual and scheduled results.
  • Extends Automation revisions with a canonical action:
    • agent + desktop preserves current behavior;
    • saved_script + cloud pins the plugin, config object, immutable version, and JSON input.
  • Executes Cloud Script Automations through the existing Den scheduler, lease, recovery, and receipt lifecycle without starting a model session.
  • Links Code Mode and Automation receipts, encrypts validated snapshots at rest, exposes canonical results in shared history, and preserves the last good result when a refresh fails.
  • Rechecks rollout, membership, grants, connection policy, and tool availability before every provider call.

Protected rollout and compatibility

This is deliberately the server-first PR:

  • there are no apps/app or Den-web consumer changes in the final diff;
  • the unchanged desktop app typechecks against the expanded package contracts;
  • the published CreateAutomation client type remains the legacy agent definition, while Den uses a separately named canonical definition accepted by the additive schema;
  • legacy Automation payloads still normalize to agent + desktop, and revisions without an action still read as agent revisions.

After this PR is merged and Den is deployed, the follow-up can safely add Save, Library, Run now, and Automate controls without shipping a desktop-ahead dependency.

Migration 0059_minor_queen_noir.sql follows current dev and adds Cloud targets, encrypted action/result columns, exact Code Mode version references, and receipt linkage.

Security boundaries

  • Saved scripts are restricted to capabilities proven by the successful source receipt and reauthorized on every run.
  • Unattended Cloud Automations may execute only read-only capabilities implemented by Den. External MCP tools remain available to interactive saved-Script runs and are not trusted for unattended execution in Phase 1.
  • Strict output validation applies to saved-Script manual and Automation execution; existing execute_capability behavior is unchanged.
  • Cloud runs are durable and recoverable, but the scheduler currently awaits them sequentially. A bounded worker pool or isolated adapter remains follow-up hardening.

Verification

  • Den API production build passed.
  • Unchanged app typecheck passed against the server-first package contracts.
  • Automations typecheck and tests: 12 passed.
  • Focused Code Mode/MCP authority tests: 11 passed after restricting unattended runs to first-party Den reads.
  • Saved-Script execution and artifact-state tests: 9 passed with MySQL on the integrated candidate.
  • Den DB migration tests: 13 passed, 3 environment skips.
  • git diff --check passed.

Follow-up after Den deployment

  • add the desktop/web Save as Script interaction to successful Code Mode results;
  • surface Scripts in Library with exact-version Run now and Automate actions;
  • expose shared artifact history and validated result views;
  • add isolated/concurrent Cloud execution workers and broader real-app hardening.

@vercel

vercel Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview Aug 10, 2026 3:50pm
openwork-den Ready Ready Preview Aug 10, 2026 3:50pm
openwork-den-worker-proxy Ready Ready Preview Aug 10, 2026 3:50pm
openwork-landing Ready Ready Preview, v0 Aug 10, 2026 3:50pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Aug 10, 2026 3:50pm

Comment thread apps/app/src/app/lib/den-types.ts Resolved
Comment thread apps/app/src/app/lib/den.ts Resolved
Comment thread ee/apps/den-api/src/app.ts Resolved

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (11b2327482dd67a087e1b6adb551b6d60d63257f). 1 advisory desktop↔den sync note(s) were posted as review comments; they do not affect clearance. Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil merged commit 97cfd0d into dev Aug 10, 2026
23 checks passed

This branch was successfully deployed

4 active and 1 inactive deployments
Preview – openwork-den — 11b23274 Deployed Aug 10, 2026 by vercel[bot]
Preview – openwork-den-worker-proxy — 11b23274 Deployed Aug 10, 2026 by vercel[bot]
Preview – openwork-landing — 11b23274 Deployed Aug 10, 2026 by vercel[bot]
Preview – openwork-app — 11b23274 Deployed Aug 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — 11b23274 Deployed Aug 10, 2026 by vercel[bot]
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