@orchestraworks/worker 0.0.136 → 0.0.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/worker.js +8 -4
- package/docs/REFERENCE.md +24 -24
- package/package.json +6 -6
package/bin/worker.js
CHANGED
|
@@ -53,11 +53,13 @@ function statusFor(code, signal) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function run(binary) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
let child;
|
|
57
|
+
// Listening at all is what stops Node ending the launcher on its own and orphaning the worker
|
|
58
|
+
// mid-shutdown: the launcher outlives the signal and exits on the child's exit instead. The listeners go
|
|
59
|
+
// in before the spawn: the binary runs from the moment spawn returns, and a signal that reached the
|
|
60
|
+
// launcher before its listeners would kill it. Node runs a listener from the event loop, so by then
|
|
61
|
+
// `child` is set.
|
|
58
62
|
for (const signal of FORWARDED_SIGNALS) {
|
|
59
|
-
// Listening at all is what stops Node ending the launcher on its own and orphaning the worker
|
|
60
|
-
// mid-shutdown: the launcher outlives the signal and exits on the child's exit instead.
|
|
61
63
|
process.on(signal, () => {
|
|
62
64
|
if (child.exitCode === null && child.signalCode === null) {
|
|
63
65
|
child.kill(signal);
|
|
@@ -65,6 +67,8 @@ function run(binary) {
|
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
71
|
+
|
|
68
72
|
child.on("error", (failure) => {
|
|
69
73
|
console.error(`worker: ${failure.message}`);
|
|
70
74
|
process.exit(1);
|
package/docs/REFERENCE.md
CHANGED
|
@@ -429,36 +429,36 @@ not an override: the variable never reaches the command, and a job running under
|
|
|
429
429
|
first reference to it. Per-job configuration travels the prompt, the agent's instructions, or a file in the
|
|
430
430
|
image.
|
|
431
431
|
|
|
432
|
+
The worker consumes every `ORCHESTRA_WORKER_<FIELD>` variable itself and drops it from every list,
|
|
433
|
+
`SFDK_EXTRA_PASSENV` included: those are the sign-in and settings the worker places for the harness, from the
|
|
434
|
+
`settings` table of `facts/families.json` (`docs/architecture/agent-runtime-images.md` § *The worker places
|
|
435
|
+
each harness's sign-in and settings*).
|
|
436
|
+
|
|
432
437
|
Every family's harness process also gets `SFDK_SESSION_ID`, which the worker sets from the `sessionId` on
|
|
433
438
|
`session_placement.apply`: the worker adds it itself, so it needs no `passEnv` entry, whatever the worker's
|
|
434
439
|
own environment holds. The `script` family adds only the organization to the command it runs, as
|
|
435
440
|
`ORCHESTRA_ORGANIZATION_ID` and `SFDK_ORGANIZATION_ID`, from its stored conversation metadata; its command inherits
|
|
436
441
|
the session variable from the harness process. Neither grants egress authority.
|
|
437
442
|
|
|
438
|
-
**On Windows
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
`%SystemRoot%` expands from the `SYSTEMROOT` `os/exec` already backfills, `SystemDrive` and `windir` are
|
|
458
|
-
unused by realistic work, and a service's temp directory falls back to `C:\Windows\SystemTemp` without
|
|
459
|
-
`TEMP` or `TMP`. Add a fourth name only with that kind of evidence. Machine plumbing is not configuration
|
|
460
|
-
and must never be pushed into the prompt: a job cannot set `PATHEXT` for a shell that has already refused to
|
|
461
|
-
start its first program.
|
|
443
|
+
**On Windows the operating system's own variables are added to that list.** The list is not a filter over
|
|
444
|
+
the environment: the worker *builds* the child's environment from it, so a name the platform set on the
|
|
445
|
+
service and the family does not declare is simply gone by the time the command runs. Windows programs
|
|
446
|
+
assume their own variables are there, so the worker adds them from its own environment to every harness,
|
|
447
|
+
and so to every hook and command the harness starts, and to the setup script: `WINDIR`, `SYSTEMROOT`,
|
|
448
|
+
`SYSTEMDRIVE`, `COMSPEC`, `PATHEXT`, `TEMP`, `TMP`, `PROGRAMDATA`, `ALLUSERSPROFILE`, `ProgramFiles`,
|
|
449
|
+
`ProgramFiles(x86)`, `ProgramW6432`, `CommonProgramFiles`, `CommonProgramFiles(x86)`, `CommonProgramW6432`,
|
|
450
|
+
`APPDATA`, `LOCALAPPDATA`, `USERNAME`, `USERDOMAIN`, `COMPUTERNAME`, `OS`, `PROCESSOR_ARCHITECTURE`,
|
|
451
|
+
`NUMBER_OF_PROCESSORS`, `PSModulePath` and `DriverData`. None of them carries a credential, and a name the
|
|
452
|
+
family or the launch already declares, in any spelling, is not added twice.
|
|
453
|
+
|
|
454
|
+
Two failures show why. With **`PATHEXT`** unset, PowerShell's list of executable extensions collapses to
|
|
455
|
+
`.CPL`, so a `curl.exe` it resolved on `PATH` is a **document** rather than a program and invoking it throws
|
|
456
|
+
`CantActivateDocumentInPipeline` — before a process starts, before a packet leaves. With **`WINDIR`** unset,
|
|
457
|
+
`Import-Module Storage` looks for its library under `C:\system32` rather than `C:\Windows\system32`, so
|
|
458
|
+
`Mount-DiskImage` and `Get-Volume` fail. On Windows the harness runs as the worker's own account, so the
|
|
459
|
+
per-user names (`TEMP`, `APPDATA`, `USERNAME`) are that account's own. Machine plumbing is not
|
|
460
|
+
configuration and must never be pushed into the prompt: a job cannot set `PATHEXT` for a shell that has
|
|
461
|
+
already refused to start its first program.
|
|
462
462
|
|
|
463
463
|
Three more bounds a job author should know:
|
|
464
464
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestraworks/worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.137",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Orchestra worker.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"docs/REFERENCE.md"
|
|
23
23
|
],
|
|
24
24
|
"optionalDependencies": {
|
|
25
|
-
"@orchestraworks/worker-linux-x64": "0.0.
|
|
26
|
-
"@orchestraworks/worker-linux-arm64": "0.0.
|
|
27
|
-
"@orchestraworks/worker-darwin-x64": "0.0.
|
|
28
|
-
"@orchestraworks/worker-darwin-arm64": "0.0.
|
|
29
|
-
"@orchestraworks/worker-win32-x64": "0.0.
|
|
25
|
+
"@orchestraworks/worker-linux-x64": "0.0.137",
|
|
26
|
+
"@orchestraworks/worker-linux-arm64": "0.0.137",
|
|
27
|
+
"@orchestraworks/worker-darwin-x64": "0.0.137",
|
|
28
|
+
"@orchestraworks/worker-darwin-arm64": "0.0.137",
|
|
29
|
+
"@orchestraworks/worker-win32-x64": "0.0.137"
|
|
30
30
|
}
|
|
31
31
|
}
|