fix(workers): wire Service→plugin-API discovery + load user jobs in workers-api (#217)#220
Conversation
…quire-await) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🤖 Augment PR SummarySummary: Fixes Aspire wiring gaps so services can discover plugin APIs, and ensures workers-api loads generated user job definitions before serving. Changes:
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 👎 |
| const registry = module.registry instanceof Map ? module.registry : undefined; | ||
|
|
||
| return { definitions, registry }; | ||
| const registryUrl = new URL(`../../${WORKERS_JOB_REGISTRY_PATH}`, import.meta.url); |
There was a problem hiding this comment.
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
🤖 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)); |
There was a problem hiding this comment.
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
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
…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>
…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>
Summary
Fixes the two workers/Aspire wiring gaps from #217:
PluginReferencesfrom the plugin resource map after plugin APIs exist, so service code can discover plugin APIs viaservices__<plugin>__http__0;/api/v1/workers/jobsand trigger lookup.Scope
fix/workers-service-plugin-discoverySlices
d0fd514ejob-registry.tsfilename convergence —d0fd514ed0fd514eValidation
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 atgenerated.deno-check. Cleanup then threwNotFound: Failed to spawn 'docker': failed resolving cwdand damaged the worktree; the branch was recovered by recloning and reapplying the patch. Not rerun to avoid repeating the cleanup hazard.Harness
.llm/tmp/run/fix-workers-service-plugin-discovery--217/Drift / Debt
Closes #217