Skip to content

feat: audit incomplete historical session repairs - #1912

Open
Rat0323 wants to merge 2 commits into
BigPizzaV3:mainfrom
Rat0323:fix/historical-session-repair-audit
Open

feat: audit incomplete historical session repairs#1912
Rat0323 wants to merge 2 commits into
BigPizzaV3:mainfrom
Rat0323:fix/historical-session-repair-audit

Conversation

@Rat0323

@Rat0323 Rat0323 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a read-only audit layer to historical session provider sync. It identifies catalog-only sessions and reports whether a current rollout or historical provider-sync database is available, without reconstructing missing canonical sessions.

Scope

  • Detect catalog-only user sessions while excluding subagent/internal entries.
  • Report current-rollout, backup-database, and no-recovery-source categories.
  • Surface the audit through the manager command/UI payload.
  • Keep damaged backups from blocking normal provider sync.
  • Add regression coverage for incomplete custom/openai migration-shaped session state.

This PR intentionally does not recreate missing state_5.sqlite rows or guess provider identity; that higher-risk recovery work should be reviewed separately.

Verification

  • cargo test -p codex-plus-data --test provider_sync (40 passed)
  • cargo check -p codex-plus-launcher -p codex-plus-manager
  • git diff --check

@Rat0323
Rat0323 marked this pull request as ready for review August 20, 2026 09:14
@Rat0323
Rat0323 force-pushed the fix/historical-session-repair-audit branch from b1ebcf3 to edda4a3 Compare August 20, 2026 09:30

@BigPizzaV3 BigPizzaV3 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前审计不是 fail-open。 在正式同步前直接 ,而备份扫描中的 /递归错误会向上传播。只要 下存在不可读目录、损坏目录项或循环符号链接,原本可正常执行的 provider sync 就会被只读审计阻断,这与 PR 声明的“damaged backups 不阻塞同步”不一致。建议审计失败时记录诊断并返回默认审计结果,同时递归扫描不要跟随符号链接,并补一个不可读/不可遍历备份不影响同步的回归测试。

@BigPizzaV3 BigPizzaV3 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前审计不是 fail-open。run_provider_sync_with_target 在正式同步前直接传播 audit_provider_sync_state 错误,而备份扫描中的 read_dir 或递归错误会向上传播。只要 backups_state/provider-sync 下存在不可读目录、损坏目录项或循环符号链接,原本可正常执行的 provider sync 就会被只读审计阻断,这与 PR 声明的 damaged backups 不阻塞同步不一致。建议审计失败时记录诊断并返回默认审计结果,同时递归扫描不要跟随符号链接,并补一个不可读或不可遍历备份不影响同步的回归测试。

@BigPizzaV3
BigPizzaV3 dismissed their stale review August 20, 2026 09:55

重复且不完整的审查记录,保留后续完整审查意见。

@Rat0323
Rat0323 force-pushed the fix/historical-session-repair-audit branch from edda4a3 to e8e69ce Compare August 20, 2026 14:29
@Rat0323

Rat0323 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

已按 review 意见更新到 e8e69ce

  • repair audit failure 现在 fail-open,并记录 diagnostic log,不再阻断 provider sync;
  • 备份遍历跳过符号链接,避免循环链接递归;
  • 新增异常备份根路径和循环符号链接回归测试。

验证结果:

  • cargo test -p codex-plus-data --test provider_sync:42 passed
  • cargo check -p codex-plus-launcher -p codex-plus-manager:通过
  • git diff --check:通过
  • Windows、macOS x64、macOS arm64 CI:全部通过

请重新审查更新后的 PR。

@Rat0323
Rat0323 requested a review from BigPizzaV3 August 20, 2026 17:28
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