Skip to content

[codex] Recover ACP runtime errors from snapshots#314

Merged
xintaofei merged 4 commits into
xintaofei:mainfrom
ijry:codex/snapshot-last-error-rebased
Jul 13, 2026
Merged

[codex] Recover ACP runtime errors from snapshots#314
xintaofei merged 4 commits into
xintaofei:mainfrom
ijry:codex/snapshot-last-error-rebased

Conversation

@ijry

@ijry ijry commented Jul 1, 2026

Copy link
Copy Markdown

Replaces #296. This replays the original ACP snapshot error recovery change onto latest xintaofei/codeg main (bbb28ee) and resolves the conflict in src/contexts/acp-connections-context.test.tsx against the newer hoisted snapshot-denormalize mock.

Validation:

  • cargo test --no-default-features --features test-utils --lib snapshot_carries_last_error_and_clears_on_next_prompt
  • pnpm test src/lib/snapshot-denormalize.test.ts src/contexts/acp-connections-context.test.tsx
  • pnpm exec eslint src/lib/snapshot-denormalize.ts src/lib/snapshot-denormalize.test.ts src/contexts/acp-connections-context.tsx src/contexts/acp-connections-context.test.tsx src/lib/types.ts
  • git diff --check codeg/main..HEAD

Local note: pnpm install initially needed CI=true and a longer fetch timeout because this non-TTY Windows shell hit dependency purge/download timeouts; the code validation passed after dependencies were restored.

jry and others added 3 commits July 13, 2026 17:48
HYDRATE_FROM_SNAPSHOT's stale (event_seq <= lastAppliedSeq) path folded a
snapshot's lastError back via `current.error ?? patch.lastError`. Since
`error` is a current-state field cleared on a new prompt (STATUS_CHANGED ->
prompting), a late stale snapshot generated between an error and the next
prompt could resurrect an error the current turn already cleared, leaving a
stale banner until the following prompt. Recover the snapshot error only on
the fresh path, matching how status / configStale / backgroundOutstanding
are already treated (current-state fields, fresh-path only).
…rection

Lock in HYDRATE_FROM_SNAPSHOT error behavior: a fresh snapshot recovers a
last_error the client missed live, and a stale snapshot must not resurrect an
error the current turn already cleared. The stale case fails against the
pre-fix reducer. Fixtures also set backgroundOutstanding for completeness.
@xintaofei xintaofei force-pushed the codex/snapshot-last-error-rebased branch from 581b8be to a394661 Compare July 13, 2026 10:27
The pi and kimi skill_storage_spec tests read the process-global $HOME while computing both the spec and the expected paths; a concurrent temp_env HOME-mutating test could flip $HOME between the two reads and fail the assertion. Wrap both in temp_env::with_vars to pin $HOME (and clear the PI_CODING_AGENT_DIR / KIMI_CODE_HOME overrides) so they serialize with those tests and read one consistent home. Expected paths stay derived from the production helpers, keeping them correct on Windows where dirs::home_dir ignores HOME.
@xintaofei

Copy link
Copy Markdown
Owner

感谢PR

@xintaofei xintaofei merged commit d2da2da into xintaofei:main Jul 13, 2026
7 checks passed
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.

2 participants