Skip to content

feat(agents-server): port pull-wake to routing refactor#4308

Merged
icehaunter merged 13 commits into
mainfrom
codex/port-pull-wake-routing-refactor
May 13, 2026
Merged

feat(agents-server): port pull-wake to routing refactor#4308
icehaunter merged 13 commits into
mainfrom
codex/port-pull-wake-routing-refactor

Conversation

@icehaunter
Copy link
Copy Markdown
Contributor

@icehaunter icehaunter commented May 12, 2026

Summary

  • Ports the pull-wake runner work onto the tenant-aware agents-server routing refactor.
  • Uses the current Durable Streams v1/stream-meta/subscriptions/* pull-wake API instead of restoring donor /consumers minting or monolithic server routing.
  • Keeps the routing-refactor branch as the source of truth for package organization, tenancy, and Durable Streams path mapping.
  • Adds follow-up fixes for Electron logging, desktop multi-instance dev startup, env override handling, and pull-wake/dev-auth test coverage.

Work Done

  • Adds tenant-scoped pull-wake control-plane schema for runner registration, dispatch policy state, wake notifications, claims, offsets, and related public fields.
  • Extends server/runtime types with authenticated users, dispatch policies, runner rows, wake rows, claim rows, and public entity/type dispatch fields.
  • Adds focused /_electric/runners routes for registration, listing, heartbeat offset persistence, enable/disable, and claim handling with authenticated owner checks.
  • Implements dispatch-policy parsing and effective policy resolution for spawns, parent inheritance, and entity-type defaults.
  • Links entity main streams into Durable Streams runner/webhook subscriptions after spawn/fork and unlinks them on kill, using the routing adapter for all backend stream paths.
  • Extends StreamClient and the Durable Streams router to map subscription wake_stream, patterns, explicit streams, claim responses, ack requests, release requests, and response stream paths through the adapter.
  • Ports the runtime pull-wake runner loop for compact DS wake events, server-side claim enrichment, claim headers, claim-scoped write tokens, runner heartbeats, and done/ack transport.
  • Hardens callback-forward behavior for pull and webhook claims, including local claim responses, DS ack forwarding, entity running/idle state, stale conflict handling, and write-token lifecycle cleanup.
  • Ports the remaining UI/CLI integration needed for local asserted identity, auth-aware fetches, runner-backed local sessions, new session spawning, entity observe paths, sidebar session display, and the compose smoke stack.
  • Adds ELECTRIC_DESKTOP_USER_DATA_DIR and env-selected desktop server startup for multi-desktop local testing.
  • Makes the agents-server start script respect externally supplied dev env vars.
  • Adds tests for dev asserted auth, dispatch policy schema validation, entrypoint env parsing, and a mocked Horton pull-wake e2e.

Verification

  • pnpm -C packages/agents-runtime build
  • pnpm --filter @electric-ax/agents-server typecheck
  • pnpm --filter @electric-ax/agents-desktop typecheck
  • cd packages/agents-server && pnpm exec vitest run test/dev-asserted-auth.test.ts test/dispatch-policy-schema.test.ts test/entrypoint.test.ts test/horton-pull-wake-e2e.test.ts --reporter=dot

Stack

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 64.44569% with 635 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.75%. Comparing base (08e85a0) to head (60dc256).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/agents-server/src/stream-client.ts 68.86% 52 Missing ⚠️
packages/electric-ax/src/start.ts 33.33% 50 Missing ⚠️
packages/agents-runtime/src/pull-wake-runner.ts 77.50% 45 Missing ⚠️
...gents-server-ui/src/lib/ElectricAgentsProvider.tsx 0.00% 44 Missing ⚠️
packages/agents/src/server.ts 61.60% 43 Missing ⚠️
...ckages/agents-server/src/routing/runners-router.ts 67.96% 39 Missing and 2 partials ⚠️
...s/agents-server-ui/src/components/ServerPicker.tsx 0.00% 36 Missing ⚠️
...agents-server-ui/src/hooks/useServerConnection.tsx 0.00% 32 Missing ⚠️
...kages/agents-server/src/routing/dispatch-policy.ts 67.04% 29 Missing ⚠️
packages/agents-server/src/entity-registry.ts 72.16% 26 Missing and 1 partial ⚠️
... and 30 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4308       +/-   ##
===========================================
+ Coverage   49.51%   60.75%   +11.24%     
===========================================
  Files         230      284       +54     
  Lines       16524    26633    +10109     
  Branches     4872     7010     +2138     
===========================================
+ Hits         8182    16182     +8000     
- Misses       8333    10437     +2104     
- Partials        9       14        +5     
Flag Coverage Δ
packages/agents 70.99% <69.62%> (+3.19%) ⬆️
packages/agents-mcp 76.87% <56.25%> (-0.33%) ⬇️
packages/agents-runtime 80.33% <82.79%> (?)
packages/agents-server 73.80% <68.21%> (-0.51%) ⬇️
packages/agents-server-ui 7.46% <37.10%> (+2.14%) ⬆️
packages/electric-ax 37.00% <33.60%> (-1.04%) ⬇️
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/start 82.83% <ø> (ø)
packages/typescript-client 94.32% <ø> (-0.06%) ⬇️
packages/y-electric 56.05% <ø> (ø)
typescript 60.75% <64.44%> (+11.24%) ⬆️
unit-tests 60.75% <64.44%> (+11.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@icehaunter icehaunter force-pushed the codex/agents-server-routing-refactor-squashed branch from be04d7d to 7943cfc Compare May 12, 2026 06:41
@icehaunter icehaunter force-pushed the codex/port-pull-wake-routing-refactor branch from 1fb27b1 to 39b4957 Compare May 12, 2026 06:47
@icehaunter icehaunter force-pushed the codex/agents-server-routing-refactor-squashed branch from 7943cfc to 2d05944 Compare May 12, 2026 13:33
@icehaunter icehaunter force-pushed the codex/port-pull-wake-routing-refactor branch 2 times, most recently from 30f7c14 to ad615e8 Compare May 12, 2026 13:43
@icehaunter icehaunter force-pushed the codex/agents-server-routing-refactor-squashed branch 2 times, most recently from bd8d8a8 to f012030 Compare May 12, 2026 14:00
@icehaunter icehaunter force-pushed the codex/port-pull-wake-routing-refactor branch from ad615e8 to a5b82e0 Compare May 12, 2026 14:00
@icehaunter icehaunter force-pushed the codex/agents-server-routing-refactor-squashed branch from f012030 to 8e8f2b1 Compare May 12, 2026 14:02
@icehaunter icehaunter force-pushed the codex/port-pull-wake-routing-refactor branch from a5b82e0 to f2ae84e Compare May 12, 2026 14:04
Base automatically changed from codex/agents-server-routing-refactor-squashed to main May 12, 2026 14:04
@icehaunter icehaunter force-pushed the codex/port-pull-wake-routing-refactor branch from 3524a29 to b47cd90 Compare May 12, 2026 14:25
@icehaunter icehaunter merged commit dec65ae into main May 13, 2026
58 checks passed
@icehaunter icehaunter deleted the codex/port-pull-wake-routing-refactor branch May 13, 2026 07:36
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