@juangcarmona/lighthouse-sdlc 0.22.8 → 0.22.10

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/github-actions.md CHANGED
@@ -132,6 +132,12 @@ The [router](workflows/lighthouse-sdlc-router.yml) and [event handler](src/issue
132
132
 
133
133
  The `apply-review` worker is installed with proposal support. It also handles implementation feedback when implementation is installed, preserving its `implement` result. Verified feedback has a stable dispatch identity across repeated events. Approval retains its separate integration route.
134
134
 
135
+ ## GitHub read recovery
136
+
137
+ Bodyless GitHub GET requests can make up to three total HTTP attempts, including the initial attempt, for responses 429, 500, 502, 503 and 504. All attempts and waits share the original thirty-second request budget; `Retry-After` is respected only when its delay fits the remaining budget. This transport retry does not automatically repeat POST/PATCH/PUT/DELETE, permanent refusals, thrown network errors or uncertain publication effects.
138
+
139
+ This reduces transient-read interruptions during unattended observation, but does not establish publication or delivery success. Exhausted HTTP reads retain their terminal diagnostic, including a safe provider message when available. Unknown publication still requires inspecting and reconciling actual effects through [Worker maintenance](#worker-maintenance) and [Worker error reports](#worker-error-reports) before another request.
140
+
135
141
  ## Worker maintenance
136
142
 
137
143
  Install the optional deterministic workflow with `--with-maintenance`. After reviewing its permissions, set `LIGHTHOUSE_MAINTENANCE_ENABLED=true` and the existing `LIGHTHOUSE_AUTOMATION_ENABLED=true` to observe owner issues every 30 minutes, or dispatch a single issue manually. Failed `review` preparation sends an authenticated callback to maintenance when recovery is enabled. The receiver waits for terminal native jobs before considering a retry. Native `workflow_run` completion also wakes this same reconciler; unrelated or uncertain completions select no issue. Observation alone performs no retry. Set `LIGHTHOUSE_RECOVERY_ENABLED=true` separately to permit bounded recovery; removing it also stops admission of already-requested retries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juangcarmona/lighthouse-sdlc",
3
- "version": "0.22.8",
3
+ "version": "0.22.10",
4
4
  "type": "module",
5
5
  "description": "Provider-neutral SDLC skills, commands and route contracts for Lighthouse adopters",
6
6
  "repository": {
@@ -267,7 +267,19 @@ async function writeImplementationPullRequest(api, { snapshot, changes, body, ru
267
267
  const tree = verificationRefresh ? commit.tree : await api('git/trees', 'POST', { base_tree: commit.tree.sha, tree: entries });
268
268
  if (synchronization && tree.sha !== checkedTree) throw Error('Synchronized publication differs from the independently checked tree');
269
269
  const message = verificationRefresh ? `chore: refresh verification for issue #${snapshot.issue}\n\nLighthouse-CI-Base: ${snapshot.baseRevision}` : `feat: implement issue #${snapshot.issue}`;
270
- const created = await api('git/commits', 'POST', { message, tree: tree.sha, parents: synchronization ? [snapshot.sourceRevision, snapshot.baseRevision] : [snapshot.sourceRevision] });
270
+ const commitBody = { message, tree: tree.sha, parents: synchronization ? [snapshot.sourceRevision, snapshot.baseRevision] : [snapshot.sourceRevision] };
271
+ let created;
272
+ for (let attempt = 0; attempt < 3; attempt++) {
273
+ try { created = await api('git/commits', 'POST', commitBody); break; }
274
+ catch (error) {
275
+ // Recover only this explicit refusal, after observing the immutable tree; uncertain writes remain terminal.
276
+ if (attempt === 2 || error.status !== 422 || error.message !== 'GitHub POST git/commits: 422: Tree SHA does not exist' || !/^[a-f0-9]{40}$/.test(tree.sha ?? '')) throw error;
277
+ if ((await api(`git/trees/${tree.sha}`, 'GET', undefined, true))?.sha !== tree.sha) throw error;
278
+ await setTimeout(250 * 2 ** attempt);
279
+ await beforeWrite();
280
+ await checkEpicBase();
281
+ }
282
+ }
271
283
  await beforeWrite();
272
284
  await checkEpicBase();
273
285
  if (snapshot.productAlignment?.parent.pullRequest) {
@@ -153,16 +153,25 @@ async function main() {
153
153
  const phaseStarted = new Map();
154
154
  const recordPhase = async status => { runtimeReceipt.phases[phase] = status; if (status === 'running') phaseStarted.set(phase, Date.now()); telemetry.emit('execution.phase', { phase, status, durationMs: phaseStarted.has(phase) ? Date.now() - phaseStarted.get(phase) : null }); await writeFile(join(runDir, 'runtime.json'), JSON.stringify(runtimeReceipt)); };
155
155
  const docker = args => runOwnedDocker(config, args, { stdio: 'ignore', timeout: 30000 });
156
- let child, timer, heartbeat, slot, baseline, trackedSource, planningBaseline, runtime, codegraph, eventsPath, cancelled = false, stopReason = null;
156
+ let child, timer, heartbeat, controllerWatch, slot, baseline, trackedSource, planningBaseline, runtime, codegraph, eventsPath, cancelled = false, stopReason = null;
157
157
  const preparation = new AbortController();
158
158
  const cancel = (reason = 'cancelled') => { cancelled = true; preparation.abort(); stopReason ??= reason; try { config.resourceOwner?.observe(); } catch {} child?.kill('SIGTERM'); try { if (name) docker(['rm', '-f', name, `${name}-checks`]); } catch {} };
159
159
  const onSignal = () => cancel();
160
+ const controllerPid = env.LIGHTHOUSE_ENGINE_CONTROLLER_PID === undefined ? (process.ppid > 1 ? process.ppid : null) : Number(env.LIGHTHOUSE_ENGINE_CONTROLLER_PID);
161
+ const checkController = () => {
162
+ if (controllerPid === null || process.ppid === controllerPid) return true;
163
+ cancel('controller-exited'); return false;
164
+ };
160
165
  process.once('SIGTERM', onSignal); process.once('SIGINT', onSignal);
161
166
  try {
167
+ if (controllerPid !== null && (!Number.isSafeInteger(controllerPid) || controllerPid < 1)) throw Error('Invalid engine controller identity');
168
+ if (!checkController()) throw Error('Engine controller is no longer active');
169
+ if (controllerPid !== null) controllerWatch = setInterval(checkController, 500).unref();
162
170
  console.log('Waiting for the operator host engine slot');
163
171
  const waitStarted = Date.now(); telemetry.emit('execution.host-wait.started', { status: 'waiting' });
164
172
  const deliveryDeadline = env.LIGHTHOUSE_DELIVERY_DEADLINE === undefined ? undefined : Number(env.LIGHTHOUSE_DELIVERY_DEADLINE);
165
173
  slot = await acquireEngineSlot(config.lock, engineSlotWaitSeconds(config, { deadline: deliveryDeadline }), { signal: preparation.signal });
174
+ if (!checkController()) throw Error('Engine controller is no longer active');
166
175
  telemetry.emit('execution.host-wait.ended', { status: 'acquired', durationMs: Date.now() - waitStarted });
167
176
  const ownershipDirectory = `${config.lock}.resources`;
168
177
  runtimeReceipt.recoveredCleanup = recoverExecutionOwners(ownershipDirectory);
@@ -172,7 +181,7 @@ async function main() {
172
181
  await recordPhase('running');
173
182
  runtime = await startEnvironment({ selected, image: config.image, commands: implementing ? [['git'], ['sh'], ...(request.implementation.policy.checks ?? [])] : [], name: `${name}-agent`, uid: config.uid, run: args => runOwnedDocker(config, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 30000 }) });
174
183
  await recordPhase('passed');
175
- if (cancelled) throw Error('Execution cancelled before agent startup');
184
+ if (cancelled || !checkController()) throw Error('Execution cancelled before agent startup');
176
185
  console.log('Engine slot acquired; starting isolated OpenCode');
177
186
  await snapshotSource(env.GITHUB_WORKSPACE, source);
178
187
  if (request.worker === 'product-change') {
@@ -388,7 +397,7 @@ async function main() {
388
397
  try { await mkdir(join(runDir, 'evidence/host'), { recursive: true }); await copyFile(eventsPath, join(runDir, 'evidence/host/engine-events.jsonl')); }
389
398
  catch { console.error('Engine events could not be retained; inspect the runner diagnostics.'); }
390
399
  }
391
- clearTimeout(timer); clearInterval(heartbeat); process.removeListener('SIGTERM', onSignal); process.removeListener('SIGINT', onSignal);
400
+ clearTimeout(timer); clearInterval(heartbeat); clearInterval(controllerWatch); process.removeListener('SIGTERM', onSignal); process.removeListener('SIGINT', onSignal);
392
401
  try { if (name) docker(['rm', '-f', name, `${name}-checks`]); } catch {}
393
402
  stopCodegraph(codegraph?.sidecar, config);
394
403
  runtime?.cleanup();
@@ -97,7 +97,7 @@ export async function executeUnattendedStage({ env, root, request, source, conte
97
97
  const promptPath = join(step, 'prompt.md'); await writeFile(promptPath, prompt);
98
98
  const childEnv = {};
99
99
  for (const key of ['PATH', 'HOME', 'TMPDIR', 'LIGHTHOUSE_ENGINE_CONFIG', 'GITHUB_RUN_ID', 'GITHUB_RUN_ATTEMPT']) if (env[key]) childEnv[key] = env[key];
100
- Object.assign(childEnv, { RUNNER_TEMP: runnerTemp, GITHUB_WORKSPACE: workspace, GH_AW_PROMPT: promptPath, GH_AW_SAFE_OUTPUTS: join(step, 'safe-outputs.json'), LIGHTHOUSE_WORKER: request.worker ?? request.stage });
100
+ Object.assign(childEnv, { RUNNER_TEMP: runnerTemp, GITHUB_WORKSPACE: workspace, GH_AW_PROMPT: promptPath, GH_AW_SAFE_OUTPUTS: join(step, 'safe-outputs.json'), LIGHTHOUSE_WORKER: request.worker ?? request.stage, LIGHTHOUSE_ENGINE_CONTROLLER_PID: String(process.pid) });
101
101
  if (modelProfile) childEnv.LIGHTHOUSE_MODEL_PROFILE = modelProfile;
102
102
  if (deadline !== undefined) childEnv.LIGHTHOUSE_DELIVERY_DEADLINE = String(deadline);
103
103
  await new Promise((resolve, reject) => {