Skip to content

fix(roles): version local likes file to v2 and align attach budget to 4s - #1706

Merged
iruriQ merged 1 commit into
mainfrom
fix/role-likes-v2-reset-and-budget
Dec 5, 2026
Merged

iruriQ merged 1 commit into
mainfrom
fix/role-likes-v2-reset-and-budget

Conversation

@BytePioneer-AI

Copy link
Copy Markdown
Owner

Summary

  • Version ~/.codexhost/roles/.likes.json to { version: 2, likes: { ... } } so unversioned legacy files burned during the pre-deployment 404 window (v0.34.0) reset cleanly instead of permanently locking the 5-like cap at 5/5.
  • Align LIKES_ATTACH_BUDGET_MS with LIKES_FETCH_TIMEOUT_MS (4_000ms) so slower network paths to ext-stats.chost.dev do not drop remote like counts at 2s.
  • Extend packages/host-runtime/test/role-catalog.test.ts to verify unversioned file reset, v2 persistence, and >2s likes attachment.

Validation

  • npx vitest run --config tests/vitest.config.js packages/host-runtime/test/role-catalog.test.ts (8/8 passed)
  • No visual changes: host-runtime persistence and fetch budget change only.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T07:28:18.086512Z 4d29aea PR opened
🔒 Security Review ✅ Completed 2026-12-05T07:29:22.398251Z 4d29aea PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 功能与行为调整
    • 本地点赞记录改为使用带版本信息的格式保存;旧格式或无效内容会按空记录处理。
    • 点赞请求的等待时间上限由 2 秒延长至 4 秒。
    • 请求失败时不会消耗本地点赞额度,成功重试后会保存点赞记录。

本次变更将本地点赞文件改为带版本字段的对象格式,并将点赞附加等待预算从 2 秒增至 4 秒。测试覆盖旧格式文件的读取、失败请求后的额度处理,以及成功重试后的 v2 文件内容。

Changes: Role 点赞本地存储

Layer / File(s) Summary
版本化点赞存储与验证
packages/host-runtime/src/role-catalog.ts, packages/host-runtime/test/role-catalog.test.ts
本地点赞记录现在存储在包含 version: 2 和 likes 的对象中。读取时,旧格式或其他不符合 schema 的内容返回空记录。测试验证旧格式处理、失败 POST 后的额度状态,以及成功重试后写入 v2 格式;附加等待预算和对应测试等待时长调整为 4 秒。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 4d29a

This change stores the local likes file in a versioned format so stale legacy files reset, and it lets slower networks attach remote like counts. No concrete merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(roles): version local likes file to v2 and align attach budget to 4s”准确描述了两项主要变更:将本地点赞文件版本化为 v2,以及将点赞附加等待预算调整为 4 秒。标题与变更集直接相关,且具体。
Description check Passed 描述说明了本地点赞文件改为 version: 2 格式、LIKES_ATTACH_BUDGET_MS 与 LIKES_FETCH_TIMEOUT_MS 对齐为 4 秒,并列出了对 role-catalog.test.ts 的测试扩展及验证命令。描述与变更内容相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4667d2f and 4d29aea.

Files selected for processing: 2

  • packages/host-runtime/src/role-catalog.ts
  • packages/host-runtime/test/role-catalog.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Recent review details

Context from checks skipped due to timeout: 4

  • GitHub Check: CodeRabbit
  • GitHub Check: Vitest
  • GitHub Check: Web Host tests
  • GitHub Check: Static checks
Additional context used

Code guidelines: 2

AGENTS.md — auto-discovered
CLAUDE.md — auto-discovered
Path-based instructions: 2

Source excerpt: Host Runtime loads installed plugins through public contracts, not direct imports of concrete Adapter packages.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/host-runtime/src/role-catalog.ts
  • packages/host-runtime/test/role-catalog.test.ts
Source excerpt: `codexhost` runs external Agent Harnesses as independent Threads inside Codex Desktop, preserving the official shell and native Codex path.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/host-runtime/src/role-catalog.ts
  • packages/host-runtime/test/role-catalog.test.ts
Learnings: 5

Learning: 2026-11-28T13:43:09.227Z

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: LESSONS.md:0-0
Timestamp: 2026-11-28T13:43:09.227Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Implementation Principles
- Check [LESSONS.md](LESSONS.md) for known repository pitfalls and compatibility invariants before reviewing or editing risky paths.

Source excerpt:
# Lessons

## Compatibility & Contracts

- **Forward-compatible schemas for published clients**: When adding fields to persisted data or remote catalog entries read by older releases, check the last published tag (`git show <last-tag>:<path>`) and prefer `z.object(...)` over `z.strictObject(...)` unless strict rejection is explicitly required.

Applied to files:

  • packages/host-runtime/src/role-catalog.ts
Learning: 2026-11-28T13:43:17.428Z

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: .agents/skills/codexhost-code-review/SKILL.md:0-0
Timestamp: 2026-11-28T13:43:17.428Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Repository Skills
| Task | Skill |
| --- | --- |
| Reviewing a PR or local diff for correctness and boundaries | [codexhost-code-review](.agents/skills/codexhost-code-review/SKILL.md) |

Source excerpt:
# codexhost 代码审查

## 人工检查

- **持久化与兼容**:触及 `mapping-store`、插件清单、配置格式、共享 RPC 或远端目录字段时,核对旧数据如何读取,并对照上个已发布 tag(`git show <tag>:...`)验证老版本客户端的前向/后向兼容性;涉及硬编码下载链接与 SHA-256 时实测验真。

Applied to files:

  • packages/host-runtime/src/role-catalog.ts
Learning: 2026-11-28T13:43:21.809Z

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-11-28T13:43:21.809Z
Learning: Applies to ** : Source excerpt:
# Repository Guidelines

## Implementation Principles

- Keep changes narrowly scoped. Avoid unrelated refactors, renames, dependency upgrades, or formatting churn.

Applied to files:

  • packages/host-runtime/src/role-catalog.ts
Learning: 2026-10-17T15:17:42.370Z

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: .agents/skills/codexhost-code-review/SKILL.md:0-0
Timestamp: 2026-10-17T15:17:42.370Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Repository Skills
| Task | Skill |
| --- | --- |
| Reviewing a PR or local diff for correctness and boundaries | [codexhost-code-review](.agents/skills/codexhost-code-review/SKILL.md) |

Source excerpt:
# codexhost 代码审查

## 人工检查

- **测试强度**:断言是否会在目标回归出现时失败,是否验证外部状态、事件或释放,而不是复述实现;是否走了真实入口(真实 Loader、插件加载、worker、子进程),而不是手工拼装。

Applied to files:

  • packages/host-runtime/test/role-catalog.test.ts
Learning: 2026-11-17T12:08:43.655Z

Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-17T12:08:43.655Z
Learning: Source excerpt:
# Repository Guidelines

## Testing & Completion

- Writing tests. Every test is code to maintain and CI time to pay; add one only when it earns that.
  - Small, low-risk changes need no new tests. Add focused tests for high-risk or cross-package changes, or when asked.
  - A new test must catch a regression the existing tests would miss. Extend the nearest existing case or `test.each` instead of adding near-duplicates.
  - Assert observable behavior (inputs, outputs, protocol messages, persisted state), not internal call order, private state, or mock call counts.
  - Mock only external boundaries (network, clock, real CLIs, the OS), never the code under test. Avoid large snapshots and long literal expectations that can only be updated mechanically.
  - A bug-fix test must fail before the fix. Never weaken assertions or delete tests just to make a change pass; report the conflict instead.
  - When a change makes existing tests redundant or ties them to removed internals...

Applied to files:

  • packages/host-runtime/test/role-catalog.test.ts

@iruriQ
iruriQ merged commit e6be7a7 into main Dec 5, 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