@chatcode/chatcode-cli-test 1.0.43 → 1.0.45

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.
@@ -72,6 +72,11 @@ function readRotationRequest(controlFile, token) {
72
72
  * allocator high-water pages to the operating system.
73
73
  */
74
74
  export function runSupervised(command, commandArgs) {
75
+ // Mirror the worker opt-in gate. The supervisor must also fail closed so
76
+ // exit code 75 cannot silently replace a desktop host's worker by default.
77
+ const truthy = value => /^(1|true|yes|on)$/i.test(value?.trim() ?? '')
78
+ const rotationEnabled = truthy(process.env.CHATCODE_CLI_ENABLE_PROCESS_GENERATION_ROTATION) &&
79
+ !truthy(process.env.CHATCODE_CLI_DISABLE_PROCESS_GENERATION_ROTATION)
75
80
  const token = randomUUID()
76
81
  const controlFile = join(
77
82
  tmpdir(),
@@ -94,6 +99,11 @@ export function runSupervised(command, commandArgs) {
94
99
  // Never trust an inherited internal-resume value. Only a request whose
95
100
  // one-time control token was validated above can populate this channel.
96
101
  delete env[INTERNAL_RESUME_SESSION_ENV]
102
+ if (!rotationEnabled) {
103
+ delete env[GENERATION_CONTROL_FILE_ENV]
104
+ delete env[GENERATION_CONTROL_TOKEN_ENV]
105
+ delete env[GENERATION_SUPERVISOR_PID_ENV]
106
+ }
97
107
  if (resumeSessionId) {
98
108
  env[INTERNAL_RESUME_SESSION_ENV] = resumeSessionId
99
109
  }
@@ -106,6 +116,7 @@ export function runSupervised(command, commandArgs) {
106
116
  })
107
117
 
108
118
  if (
119
+ !rotationEnabled ||
109
120
  result.error ||
110
121
  result.signal ||
111
122
  result.status !== PROCESS_GENERATION_ROTATE_EXIT_CODE