@ouro.bot/cli 0.1.0-alpha.1174 → 0.1.0-alpha.1175

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1175",
6
+ "changes": [
7
+ "The daemon survives a vault outage at startup instead of crash-looping. When the vault does not answer (timeout, refused or reset connection, DNS failure), provider readiness no longer aborts startup: the agent is marked degraded as `vault:<agent>` in daemon health and the vault is retried with capped backoff until it answers. Rejections from a reachable vault (locked, wrong password, missing credential) still fail startup, and `ouro mail sweep-orphans` still requires a fresh vault read. No credentials are cached on disk. The Unraid template follows the release version."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1174",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1174",
2
+ "runtimeVersion": "0.1.0-alpha.1175",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1174</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1175</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.isTransientVaultError = isTransientVaultError;
36
37
  exports.vaultUnlockOrRecoverFix = vaultUnlockOrRecoverFix;
37
38
  exports.checkAgentConfig = checkAgentConfig;
38
39
  exports.checkAgentConfigWithProviderHealth = checkAgentConfigWithProviderHealth;
@@ -209,6 +210,10 @@ function isTransientVaultError(error) {
209
210
  const normalized = error.toLowerCase();
210
211
  return (normalized.includes("timed out") ||
211
212
  normalized.includes("econnrefused") ||
213
+ normalized.includes("econnreset") ||
214
+ normalized.includes("enotfound") ||
215
+ normalized.includes("eai_again") ||
216
+ normalized.includes("ehostunreach") ||
212
217
  normalized.includes("socket hang up") ||
213
218
  normalized.includes("etimedout"));
214
219
  }
@@ -241,6 +246,7 @@ function invalidPoolResult(agentName, lane, provider, model, pool) {
241
246
  ok: false,
242
247
  error: `${lane} provider ${provider} model ${model} cannot read provider credentials from ${agentName}'s vault: ${pool.error}`,
243
248
  fix: `Vault read timed out -- this usually resolves on retry. Run 'ouro up' again.`,
249
+ vaultUnreachable: true,
244
250
  };
245
251
  }
246
252
  if (pool.reason === "unavailable" && isVaultLockedError(pool.error)) {
@@ -79,6 +79,7 @@ const context_loss_sentinel_1 = require("../context-loss-sentinel");
79
79
  const provider_credentials_1 = require("../provider-credentials");
80
80
  const runtime_credentials_1 = require("../runtime-credentials");
81
81
  const machine_identity_1 = require("../machine-identity");
82
+ const vault_outage_1 = require("./vault-outage");
82
83
  const container_credential_bootstrap_1 = require("./container-credential-bootstrap");
83
84
  const daemon_bootstrap_startup_1 = require("./daemon-bootstrap-startup");
84
85
  const sanctuary_package_management_1 = require("./sanctuary-package-management");
@@ -713,42 +714,48 @@ function writeStopCommandHealthState() {
713
714
  // Health writes are best-effort during shutdown.
714
715
  }
715
716
  }
717
+ /* v8 ignore start -- degraded-component bookkeeping wiring; retry/backoff logic is tested in vault-outage.test.ts @preserve */
718
+ function setVaultDegraded(agent, reason) {
719
+ const component = `vault:${agent}`;
720
+ const fullReason = `${reason}. Fix: the agent's vault is unreachable; the daemon stays up and retries. Run 'ouro doctor' if this persists.`;
721
+ const existing = degradedComponents.find((entry) => entry.component === component);
722
+ if (existing)
723
+ existing.reason = fullReason;
724
+ else
725
+ degradedComponents.push({ component, reason: fullReason, since: new Date().toISOString() });
726
+ }
727
+ function clearVaultDegraded(agent) {
728
+ const index = degradedComponents.findIndex((entry) => entry.component === `vault:${agent}`);
729
+ if (index >= 0)
730
+ degradedComponents.splice(index, 1);
731
+ }
732
+ /* v8 ignore stop */
733
+ async function checkProviderRuntime(agent) {
734
+ try {
735
+ await (0, runtime_credentials_1.refreshRuntimeCredentialConfig)(agent, { preserveCachedOnFailure: true });
736
+ // Read from the same vault listing: whether this machine has config or not, the
737
+ // daemon then knows, and its bootstrap spares each worker and sense a vault CLI run.
738
+ await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(agent, daemonMachineId, { preserveCachedOnFailure: true });
739
+ // The ping runs in a child process, so the provider SDK it loads doesn't stay in the daemon.
740
+ return await (0, agent_config_check_1.checkAgentConfigWithProviderHealth)(agent, (0, identity_1.getAgentBundlesRoot)(), { pingProvider: provider_ping_child_1.pingProviderInChild });
741
+ }
742
+ catch {
743
+ (0, runtime_1.emitNervesEvent)({
744
+ level: "warn",
745
+ component: "daemon",
746
+ event: "daemon.provider_readiness_unavailable",
747
+ message: "fresh provider readiness check failed before daemon startup",
748
+ meta: { agent },
749
+ });
750
+ throw new Error("provider runtime preparation failed");
751
+ }
752
+ }
716
753
  async function prepareProviderRuntime() {
717
- const bundlesRoot = (0, identity_1.getAgentBundlesRoot)();
718
- const readiness = await Promise.all(readinessAgents.map(async (agent) => {
719
- try {
720
- await (0, runtime_credentials_1.refreshRuntimeCredentialConfig)(agent, { preserveCachedOnFailure: true });
721
- // Read from the same vault listing: whether this machine has config or not, the
722
- // daemon then knows, and its bootstrap spares each worker and sense a vault CLI run.
723
- await (0, runtime_credentials_1.refreshMachineRuntimeCredentialConfig)(agent, daemonMachineId, { preserveCachedOnFailure: true });
724
- // The ping runs in a child process, so the provider SDK it loads doesn't stay in the daemon.
725
- const result = await (0, agent_config_check_1.checkAgentConfigWithProviderHealth)(agent, bundlesRoot, { pingProvider: provider_ping_child_1.pingProviderInChild });
726
- if (result.ok)
727
- return null;
728
- (0, runtime_1.emitNervesEvent)({
729
- level: "warn",
730
- component: "daemon",
731
- event: "daemon.provider_readiness_unavailable",
732
- message: "fresh provider readiness was unavailable before daemon startup",
733
- meta: { agent },
734
- });
735
- return result.issue ?? {
736
- summary: `${agent}: provider runtime unavailable`,
737
- actions: [{ actor: "agent-runnable", command: "ouro doctor" }],
738
- };
739
- }
740
- catch {
741
- (0, runtime_1.emitNervesEvent)({
742
- level: "warn",
743
- component: "daemon",
744
- event: "daemon.provider_readiness_unavailable",
745
- message: "fresh provider readiness check failed before daemon startup",
746
- meta: { agent },
747
- });
748
- throw new Error("provider runtime preparation failed");
749
- }
750
- }));
751
- const failures = readiness.filter((entry) => entry !== null);
754
+ const failures = await (0, vault_outage_1.prepareProviderRuntimeTolerantOfVaultOutage)(readinessAgents, {
755
+ check: checkProviderRuntime,
756
+ onDegraded: setVaultDegraded,
757
+ onRecovered: clearVaultDegraded,
758
+ });
752
759
  if (failures.length > 0) {
753
760
  throw (0, daemon_bootstrap_startup_1.createProviderReadinessPreparationFailure)(failures);
754
761
  }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareProviderRuntimeTolerantOfVaultOutage = prepareProviderRuntimeTolerantOfVaultOutage;
4
+ const runtime_1 = require("../../nerves/runtime");
5
+ const DEFAULT_INITIAL_DELAY_MS = 5_000;
6
+ const DEFAULT_MAX_DELAY_MS = 5 * 60_000;
7
+ /**
8
+ * Boot-time provider readiness that tolerates an unreachable vault. A vault that
9
+ * answers with a rejection (locked, missing, wrong credentials) is still a failure;
10
+ * one that doesn't answer degrades that agent and retries with backoff instead of
11
+ * taking the whole daemon down.
12
+ */
13
+ async function prepareProviderRuntimeTolerantOfVaultOutage(agents, deps) {
14
+ const results = await Promise.all(agents.map(async (agent) => {
15
+ const result = await deps.check(agent);
16
+ if (result.ok)
17
+ return null;
18
+ if (result.vaultUnreachable) {
19
+ beginVaultOutageRecovery(agent, result.error ?? "vault unreachable", deps);
20
+ return null;
21
+ }
22
+ (0, runtime_1.emitNervesEvent)({
23
+ level: "warn",
24
+ component: "daemon",
25
+ event: "daemon.provider_readiness_unavailable",
26
+ message: "fresh provider readiness was unavailable before daemon startup",
27
+ meta: { agent },
28
+ });
29
+ return result.issue ?? {
30
+ summary: `${agent}: provider runtime unavailable`,
31
+ actions: [{ actor: "agent-runnable", command: "ouro doctor" }],
32
+ };
33
+ }));
34
+ return results.filter((entry) => entry !== null);
35
+ }
36
+ function beginVaultOutageRecovery(agent, reason, deps) {
37
+ const schedule = deps.schedule ?? ((run, delayMs) => setTimeout(run, delayMs));
38
+ const maxDelayMs = deps.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
39
+ let delayMs = deps.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;
40
+ deps.onDegraded(agent, reason);
41
+ (0, runtime_1.emitNervesEvent)({
42
+ level: "warn",
43
+ component: "daemon",
44
+ event: "daemon.vault_unreachable_degraded",
45
+ message: "vault unreachable at startup; daemon stays up in degraded mode and retries with backoff",
46
+ meta: { agent, reason },
47
+ });
48
+ const attempt = () => {
49
+ void deps.check(agent).then((result) => {
50
+ if (result.ok) {
51
+ deps.onRecovered(agent);
52
+ (0, runtime_1.emitNervesEvent)({
53
+ component: "daemon",
54
+ event: "daemon.vault_recovered",
55
+ message: "vault reachable again; agent left degraded mode",
56
+ meta: { agent },
57
+ });
58
+ return;
59
+ }
60
+ // A rejection (not just silence) needs a human; it stays degraded and visible while we keep retrying slowly.
61
+ deps.onDegraded(agent, result.error ?? reason);
62
+ scheduleNext();
63
+ }).catch((error) => {
64
+ deps.onDegraded(agent, error instanceof Error ? error.message : String(error));
65
+ scheduleNext();
66
+ });
67
+ };
68
+ const scheduleNext = () => {
69
+ const handle = schedule(attempt, delayMs);
70
+ handle?.unref?.();
71
+ delayMs = Math.min(delayMs * 2, maxDelayMs);
72
+ };
73
+ scheduleNext();
74
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1174",
3
+ "version": "0.1.0-alpha.1175",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1174",
9
+ "version": "0.1.0-alpha.1175",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1174",
3
+ "version": "0.1.0-alpha.1175",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },