Skip to content

fix(workers): wire Service→plugin-API discovery + load user jobs in workers-api (#217)#220

Merged
rickylabs merged 2 commits into
mainfrom
fix/workers-service-plugin-discovery
Jul 1, 2026
Merged

fix(workers): wire Service→plugin-API discovery + load user jobs in workers-api (#217)#220
rickylabs merged 2 commits into
mainfrom
fix/workers-service-plugin-discovery

Conversation

@rickylabs

Copy link
Copy Markdown
Owner

Summary

Fixes the two workers/Aspire wiring gaps from #217:

  • generated services now wire PluginReferences from the plugin resource map after plugin APIs exist, so service code can discover plugin APIs via services__<plugin>__http__0;
  • workers-api now loads generated user job definitions into the service runtime before serving, so user jobs are visible to /api/v1/workers/jobs and trigger lookup.

Scope

  • Archetype / area: CLI Aspire helper generation, config service schema, plugins/workers runtime/service
  • Branch: fix/workers-service-plugin-discovery

Slices

  • S1 Service -> plugin endpoint discovery — d0fd514e
  • S2 Workers API generated user-job loading + job-registry.ts filename convergence — d0fd514e
  • S3 Focused validation and PR — d0fd514e

Validation

  • deno test --allow-all packages/config/tests/schema/service_schema_test.ts packages/cli/src/kernel/templates/aspire/helpers/tests/generators-service-plugin_test.ts packages/cli/src/kernel/templates/aspire/helpers/tests/generators-tools-db-index_test.ts plugins/workers/services/src/generated-jobs_test.ts plugins/workers/tests/cli/registry-compiler-golden_test.ts packages/cli/src/maintainer/features/sync/plugin/copy-official-plugin-copy_test.ts — PASS, 13 tests / 48 BDD steps.
  • deno check --unstable-kv packages/config/mod.ts packages/cli/bin/netscript-dev.ts plugins/workers/services/src/main.ts plugins/workers/bin/runtime.ts plugins/workers/bin/combined.ts plugins/workers/src/adapter/plugin.ts plugins/workers/src/cli/composition/main.ts — PASS.
  • deno task e2e:cli run scaffold.runtime --cleanup --format pretty — attempted; passed preflight, scaffold init, official plugin install/list, database init/generate/seed, and generated plugin registry gates, then failed at generated.deno-check. Cleanup then threw NotFound: Failed to spawn 'docker': failed resolving cwd and damaged the worktree; the branch was recovered by recloning and reapplying the patch. Not rerun to avoid repeating the cleanup hazard.

Harness

  • Run dir: .llm/tmp/run/fix-workers-service-plugin-discovery--217/
  • Phase: implementation; separate PLAN-EVAL/IMPL-EVAL not self-certified in this implementation session.

Drift / Debt

  • No new architecture debt accepted.
  • Drift recorded for the unavailable separate PLAN-EVAL in this turn and for the destructive scaffold.runtime cleanup hazard.

Closes #217

@augmentcode

augmentcode Bot commented Jul 1, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Fixes Aspire wiring gaps so services can discover plugin APIs, and ensures workers-api loads generated user job definitions before serving.

Changes:

  • Adjusted Aspire helper generation to separate service resource creation from a later service-reference wiring phase, allowing service→plugin discovery after plugins exist.
  • Extended the service config contract with optional pluginReferences and added schema test coverage.
  • Standardized the workers generated jobs registry filename to .netscript/generated/plugin-workers/job-registry.ts across docs, scaffolding, and tests.
  • Introduced shared workers runtime helpers for loading the generated job registry + registering static job definitions, and invoked them in workers-api startup.

Technical Notes: The registry loader tolerates missing generated output (NotFound → empty), and both the background runtime and API service now reuse the same generated-registry utilities.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode 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.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

const registry = module.registry instanceof Map ? module.registry : undefined;

return { definitions, registry };
const registryUrl = new URL(`../../${WORKERS_JOB_REGISTRY_PATH}`, import.meta.url);

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

plugins/workers/bin/combined.ts:19: new URL(../../${WORKERS_JOB_REGISTRY_PATH}, import.meta.url) resolves the generated registry relative to the plugin package location rather than the project root. In a typical local layout this can point at plugins/.netscript/... and silently skip loading generated jobs (because loadGeneratedJobRegistry treats NotFound as "no registry").

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

const port = parseInt(ctx.env.PORT ?? Deno.env.get('PORT') ?? '8091');
const runtime = await createWorkersServiceRuntime();
await registerPluginJobs(runtime);
await registerGeneratedJobDefinitions(runtime, projectFileUrl(WORKERS_JOB_REGISTRY_PATH));

@augmentcode augmentcode Bot Jul 1, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

plugins/workers/services/src/main.ts:51: projectFileUrl(WORKERS_JOB_REGISTRY_PATH) is based on Deno.cwd(), so if the workers API service is launched with a non-root working directory (common in Aspire via per-resource Workdir) it may look for .netscript/generated/... under the wrong folder. That would cause registerGeneratedJobDefinitions(...) to no-op and user jobs still won’t appear in /api/v1/workers/jobs.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@rickylabs
rickylabs merged commit 962a7ee into main Jul 1, 2026
6 checks passed
@rickylabs
rickylabs deleted the fix/workers-service-plugin-discovery branch July 1, 2026 23:31
rickylabs added a commit that referenced this pull request Jul 3, 2026
…rences, HTTP/2 opt-in, browser logs (#296)

* docs(aspire): document AppHost restart/regen model, pluginReferences/dependsOn, HTTP/2 opt-in, browser logs

Covers the #264 TypeScript AppHost DX gaps against shipped reality on main:
- Customizing-the-generated-AppHost section + restart/regen semantics table (#264-1)
- hand-edit-vs-regen escape-hatch callout (#264-2)
- native-driver --allow-ffi permission note (#264-3)
- reference-fields table now documents Services carrying pluginReferences + dependsOn (#264-4, #220)
- HTTP/2 opt-in via ServiceTlsOptions/ServeOptions.tls + NETSCRIPT_TLS_* env, with plaintext HTTP/1.1-is-default callout (#234)
- browser-logs-by-default + local-vs-deployed telemetry callout (#218/#231)
- ephemeral-ports (:0) sample fix; Footguns rule-list -> good/bad patterns
- next-steps cross-ref blocks on orchestration-runtime + observability hubs

Docs-only. deno task verify: build + check:links pass; check:caveats passes from worktree root.

Refs #232
Fixes #264
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wKHquACkXnWPDgJYhhFjN

* chore(openhands): record run trace 28624920092-1

* docs(voice): 'genuinely small' -> 'deliberately small' in aspire explainer

Voice-rubric flatten (V1); folded here to keep aspire.md in a single PR.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wKHquACkXnWPDgJYhhFjN

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: OpenHands Bot <openhands@all-hands.dev>
rickylabs added a commit that referenced this pull request Jul 3, 2026
…tics, job-registry discovery (#297)

* docs(workers): document triggerJob/triggerTask typed RPC routes, path-id semantics, and job-registry discovery

Documents shipped-reality workers/SDK surface that had zero doc coverage:
- triggerJob/triggerTask are path-id-authoritative and fail loudly with a typed
  VALIDATION_ERROR on missing id; adds a typed-client trigger example + RPC route table
- documents the /api/rpc/* typed client path to plugin services (RPC twin of the curl path)
- rewrites "where jobs come from": filename-keyed job-registry generation
  (workers/jobs/*.ts -> generated/plugin-workers/job-registry.ts) and the #217/#220
  reality that the API service loads generated jobs at startup (GET /api/v1/workers/jobs)
- corrects a stale plugins/triggers/jobs scan claim to the actual workers/jobs scan

Docs-only. deno task verify: build + check:links pass; check:caveats passes from worktree root.

Refs #232 #279 #217 #220
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012wKHquACkXnWPDgJYhhFjN

* chore(openhands): record run trace 28625538238-1

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: OpenHands Bot <openhands@all-hands.dev>
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.

workers: service->plugin-API discovery + workers-api not loading user jobs (Aspire wiring gaps)

1 participant