Lines 129-169javascript
129 " append_upgrade_event install-service-attempt \"attempt=${attempt}\"",
130 ` if ${serviceCommand} install-service; then`,
131 " echo \"$(date -u '+%Y-%m-%dT%H:%M:%SZ') codex-anywhere install-service succeeded\"",
132 " append_upgrade_event install-service-succeeded \"attempt=${attempt}\"",
133 ` ${watchdogCommand}`,
136 " echo \"$(date -u '+%Y-%m-%dT%H:%M:%SZ') codex-anywhere install-service failed\"",
137 " append_upgrade_event install-service-failed \"attempt=${attempt}\"",
140 `echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') codex-anywhere service restart attempts exhausted"`,
141 "append_upgrade_event service-restart-attempts-exhausted",
142 `${watchdogCommand} --skip-wait`,
146function buildUpgradeDiagnosticShellFunction(options) {
147 const script = String.raw `
148const fs = require("fs");
149const path = require("path");
150const args = JSON.parse(process.argv[1]);
151const event = process.argv[2] || "helper-event";
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/upgradeRestart.jsView on unpkg · L149 152const detail = process.argv[3] || null;
154 ts: new Date().toISOString(),
155 attemptId: args.attemptId,
157 source: "upgrade-helper",
160 targetVersionLine: args.targetVersionLine,
161 watchdogMarkerPath: args.watchdogMarkerPath,
162 logPath: args.logPath,
164if (detail) entry.detail = detail;
165fs.mkdirSync(path.dirname(args.journalPath), { recursive: true });
166fs.appendFileSync(args.journalPath, JSON.stringify(entry) + "\n", { mode: 0o600 });
167fs.chmodSync(args.journalPath, 0o600);
168fs.writeFileSync(args.statePath, JSON.stringify({