Skip to content

[sentry:7858737683] Repaired the lost-cause defect behind ATOMIC-CHAT-CORE-DN (IO_ERROR: http request: unknown, release atomic-chat-core@0.24.7#2072fa6f1692). SettingsStore.persist (src/ - #129

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

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

Conversation

@Ooooze

@Ooooze Ooooze commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Repaired the lost-cause defect behind ATOMIC-CHAT-CORE-DN (IO_ERROR: http request: unknown, release atomic-chat-core@0.24.7#2072fa6f1692). SettingsStore.persist (src/settings/store.ts:583 in the release, identical in base) wrapped a failed mkdir/writeFile/rename into new AtomicCoreError('IO_ERROR', ...) with no cause, so errorChain in src/telemetry/diagnostics.ts stopped at the AtomicCoreError: the fs ErrnoException.code (EPERM/EACCES/EBUSY/ENOSPC/EIO) never reached classifyFailure, the event was reported failure_category: unknown, failure_reason: unknown, cause_code: IO_ERROR and surfaced as HTTP 500 IO_ERROR: http request: unknown on Windows x64. The fix passes { cause: e } to that single AtomicCoreError; message, code, details and toJSON()/ErrorBody are unchanged, so the wire contract and write behavior are identical. The carried regression probe src/settings/store-persist-cause.test.ts now passes (it failed on base at expect(errorChain(error)).toEqual([error, locked])) and additionally asserts classification becomes operational/disk_permission with cause_code: EPERM. A new ADR documents the decision and the index links it. The underlying Windows condition that made the write fail (likely a file hold) is not fixed by this repair; the next occurrence will name the real errno instead of unknown, and no retry was added because no event evidence supports a transient hold.

Evidence:
Event facts: component=http, operation=request, source=control_route, error_code/cause_code=IO_ERROR, failure_category=unknown, failure_reason=unknown, http_status=500, os.name=win32, release atomic-chat-core@0.24.7#2072fa6f1692.
Frames persist (src/settings/store.ts:583) and its caller (src/settings/store.ts:552) match the current base exactly; the release diff touches only src/core/create.ts, src/core/strata.ts, src/runtime/strata/* and src/version.ts.
Base persist raised new AtomicCoreError('IO_ERROR', cannot write ${this.path}: ${(e as Error).message}) with no options, so Error.cause was undefined; src/contracts/errors.ts forwards options.cause to super(message, { cause }) and toJSON() still emits only {code, message, details}.
src/telemetry/diagnostics.ts errorChain walks Error.cause; OPERATIONAL maps EPERM/EACCES→disk_permission, EBUSY→disk_file_locked, ENOSPC→disk_full, and diagnosticTags derives cause_code from that chain — impossible with a dropped cause.
Applied fix keeps the same code, message and undefined details and adds { cause: e } as the fourth AtomicCoreError argument in src/settings/store.ts.
Check on the fixed working copy: src/settings/store-persist-cause.test.ts passes (1 test, 2 suites passed, exit 0); the same file failed on base at expect(errorChain(error)).toEqual([error, locked]) with length 1 vs 2.
Precedent ADRs: 2026-11-03-preserve-filesystem-cause-on-instance-lock-io-errors.md, 2026-11-06-preserve-cause-on-staged-engine-install-errors.md, 2026-11-06-preserve-cause-on-llamacpp-engine-install-errors.md made the identical change elsewhere.
Existing test rolls the in-memory document back when the rename fails (src/settings/store.test.ts) only asserts { code: 'IO_ERROR' } and throws a plain Error without a code property, so it never observed the severed cause.

Regression tests: src/settings/store-persist-cause.test.ts

Full CI and human review are required.

Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/44926c2e-e2e6-426a-9dfe-6f228e0a79bf

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

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