Skip to content

fix: use prt_ prefix for all part IDs (OpenCode v1.2.25+ compat)#1

Merged
kandotrun merged 1 commit intomainfrom
fix/part-id-prefix
Mar 19, 2026
Merged

fix: use prt_ prefix for all part IDs (OpenCode v1.2.25+ compat)#1
kandotrun merged 1 commit intomainfrom
fix/part-id-prefix

Conversation

@kandotrun
Copy link
Owner

@kandotrun kandotrun commented Mar 19, 2026

Problem

OpenCode v1.2.25+ validates that all part IDs must start with prt. The chat.message hook was creating parts with IDs like supermemory-nudge-xxx and supermemory-context-xxx, causing a ZodError crash on every session start.

Changes

  • Extract generatePartId() and generateMessageId() into shared src/services/ids.ts
  • Use generatePartId() in index.ts for nudge and context parts
  • Remove duplicated functions from compaction.ts (now imports from ids.ts)

References

Summary by CodeRabbit

リリースノート

  • リファクタリング
    • システム内のID生成メカニズムを統一し、内部の一貫性を向上させました。

OpenCode v1.2.25+ validates that all part IDs must start with 'prt'.
The chat.message hook was creating parts with IDs like
'supermemory-nudge-xxx' and 'supermemory-context-xxx', causing
ZodError crashes on every session start.

Changes:
- Extract generatePartId/generateMessageId into shared ids.ts
- Use generatePartId() in index.ts for nudge and context parts
- Remove duplicated functions from compaction.ts

Fixes supermemoryai#28
Fixes supermemoryai#29
Fixes supermemoryai#32
@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 719e8e7c-e0a0-4b8a-b849-6e50d62fab68

📥 Commits

Reviewing files that changed from the base of the PR and between 6bca5df and 39a873d.

📒 Files selected for processing (3)
  • src/index.ts
  • src/services/compaction.ts
  • src/services/ids.ts

ウォークスルー

ID生成ロジックをモジュール化するための小規模なリファクタリング。src/index.tssrc/services/compaction.tsの既存の ID生成コードを、新しい共有モジュールsrc/services/ids.tsに統合し、generatePartId()generateMessageId()関数を通じて一元管理する。

変更内容

コホート / ファイル 概要
ID生成モジュール化
src/services/ids.ts
タイムスタンプ(16進数)とランダム文字列を組み合わせてprt_およびmsg_プレフィックス付きIDを生成する新しいエクスポート関数generatePartId()generateMessageId()を追加。
ID生成関数の置き換え
src/index.ts, src/services/compaction.ts
ローカルまたはインラインのID生成コード(テンプレート文字列による生成)を削除し、src/services/ids.jsからインポートした共有関数に置き換え。ロジックや制御フローの変更なし。

推定コードレビュー所要時間

🎯 2 (シンプル) | ⏱️ ~10 分

🐰 ID作成、散らばりていたコードを束ね、

共有モジュールに集約して、

ぴょんぴょん跳ねる効率性!

prt_msg_のプレフィックスで整列し、

リファクタリングの春、到来なり🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、主な変更内容を明確に要約しており、OpenCode v1.2.25+ 互換性のために prt_ プレフィックスを使用するように part ID を修正するという本質的な変更を直接反映しています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/part-id-prefix
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@kandotrun kandotrun self-assigned this Mar 19, 2026
@kandotrun kandotrun merged commit 4efa201 into main Mar 19, 2026
1 check 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.

1 participant