Skip to content

[sentry:7877309542] Repaired the severed cause chain in runLiteRtHostJson (src/runtime/litert-lm/host-process.ts). The child.on('error') branch now passes { cause: error } to its `Atom - #147

Open
Ooooze wants to merge 1 commit into
mainfrom
codex/sentry-fix/7877309542
Open

Ooooze wants to merge 1 commit into
mainfrom
codex/sentry-fix/7877309542

Conversation

@Ooooze

@Ooooze Ooooze commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Repaired the severed cause chain in runLiteRtHostJson (src/runtime/litert-lm/host-process.ts). The child.on('error') branch now passes { cause: error } to its AtomicCoreError, so the spawn failure's OS code survives. Code, message ${failure.what}: the LiteRT-LM host could not be started. and details (String(error)) are byte-identical, so ErrorBody, toJSON(), the HTTP 500 and the reported event are unchanged. Effect: errorChain now reaches the spawn Error, classifyFailure finds a recognized OS code in the reverse chain (ENOENT -> not_found, EACCES/EPERM -> disk_permission), cause_code becomes that code, and the existing agent observer emits diagnostic_cause_code. Before, the wrapper code ENGINE_INSTALL_FAILED — in neither the EXPECTED nor OPERATIONAL table — produced failure_category=unknown, failure_reason=unknown, cause_code=ENGINE_INSTALL_FAILED and no cause code, i.e. the event's http request: unknown. Added docs/decisions/2026-12-02-preserve-host-spawn-cause-on-litert-lm-probe-errors.md with one INDEX bullet, following the two 2026-11-06 precedents for the same class of loss. This does not explain or fix why the macOS host binary could not be spawned (missing, non-executable or Gatekeeper-quarantined); the next event will name that condition. Platform validation remains limited to this Linux sandbox.

Evidence:
Carried probe src/runtime/litert-lm/host-process-spawn-cause.test.ts fails on base at its diagnostic-tags assertion and passes after the edit: check exited 0, 1/1 tests passed, "keeps the operating-system code of a host spawn failure" passed.
Before the edit, src/runtime/litert-lm/host-process.ts:99-107 built new AtomicCoreError(failure.code, ${failure.what}: the LiteRT-LM host could not be started., String(error)) with no options argument, so Error.cause was unset; after the edit the same call passes { cause: error }.
src/contracts/errors.ts:318 AtomicCoreError accepts AtomicCoreErrorOptions { cause?: unknown } and forwards it via super(message, { cause }); toJSON() still emits only code/message/details, so the wire contract is untouched.
src/telemetry/policy.ts errorCodeOf recognizes ENOENT/EACCES/EPERM/ENOSPC/EIO/etc.; src/telemetry/diagnostics.ts diagnosticTags takes cause_code from the reversed chain's first recognized code, and classifyFailure maps OPERATIONAL reasons from that chain — both previously stopped at ENGINE_INSTALL_FAILED.
src/telemetry/sentry-agent-diagnostics.ts walks cause up to depth 5 and emits diagnostic_cause_code only from its allowlist, which contains ENOENT/EACCES/EPERM — so the preserved cause now reaches the observer without any observer change.
Event 67ff3467e8824407ad4574889f1a4293 facts (release atomic-chat-core@0.24.10, darwin/arm64, gpu_vendor=apple, http_status=500, source=control_route, cause_code=ENGINE_INSTALL_FAILED, failure_category=unknown, failure_reason=unknown) and its exception value 'http request: unknown' match exactly the pre-fix behavior of this path; the stack bottoms out at host-process.ts:99.
Release diff atomic-chat-core@0.24.10#5267d2d03a37 touches src/core/create.ts, src/diffusion/, src/drafters/, src/server/control/* and src/version.ts — not src/runtime/litert-lm/host-process.ts — so the release carries the same defect.
docs/decisions/2026-11-06-preserve-cause-on-staged-engine-install-errors.md and 2026-11-06-preserve-cause-on-llamacpp-engine-install-errors.md record the identical one-line { cause: error } repair for the same symptom.

Regression tests: src/runtime/litert-lm/host-process-spawn-cause.test.ts

Full CI and human review are required.

Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/db170bc8-2d77-48d0-832a-a8d5efbed650

Sentry: https://atomic-chat.sentry.io/issues/7877309542/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant