feat(ai): add Jev decision model and two-stage comment moderation - #2826
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep GitHub App |
| const endpoint = (provider.endpoint || 'https://api.typesafe.ai/v1').replace( | ||
| /\/+$/, | ||
| '', | ||
| ) |
| const response = await fetch(`${endpoint}/systemone`, { | ||
| method: 'POST', | ||
| headers: { | ||
| Authorization: `Bearer ${provider.apiKey}`, | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ model: provider.defaultModel, state, questions }), | ||
| signal, | ||
| redirect: 'error', | ||
| }) |
| const endpoint = (provider.endpoint || 'https://api.typesafe.ai/v1').replace( | ||
| /\/+$/, | ||
| '', | ||
| ) |
| const response = await fetch(`${endpoint}/models`, { | ||
| headers: { Authorization: `Bearer ${provider.apiKey}` }, | ||
| signal: AbortSignal.timeout(10000), | ||
| redirect: 'error', | ||
| }) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8cc8c45ad
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| comment.moderationStatus === 'pending' || | ||
| comment.moderationStatus === 'manual' || | ||
| (requiresAudit && comment.state !== 1) |
There was a problem hiding this comment.
Keep trusted reader submissions published
When commentShouldAudit is enabled, authenticated non-owner readers are passed to initialReview as trusted and receive moderationStatus: 'approved', but their state is still Unread. This condition therefore reports their submissions as pending and public queries hide them; because only moderationStatus: 'pending' rows are queued for review, these trusted comments remain hidden until an administrator manually changes their state, defeating the intended reader exemption.
Useful? React with 👍 / 👎.
| comment.isOwnerReply && published | ||
| ? CommentReplyMailType.Guest | ||
| : CommentReplyMailType.Owner, |
There was a problem hiding this comment.
Notify the parent for authenticated reader replies
When a non-owner authenticated reader replies while auditing is disabled, isOwnerReply is false, so this selects CommentReplyMailType.Owner. The previous reply path selected Guest for every reply with a readerId, and sendEmail uses that type to address parentIdentity.mail; the new condition therefore sends the notification to the site owner instead of the person being replied to.
Useful? React with 👍 / 👎.
| ...(type === 'typesafe' | ||
| ? { endpoint: 'https://api.typesafe.ai/v1' } | ||
| : {}), |
There was a problem hiding this comment.
Reset the endpoint when leaving TypeSafe
When an existing TypeSafe provider is changed to any text provider through this selector, the patch changes its type and model but leaves https://api.typesafe.ai/v1 in endpoint, because an endpoint is only assigned when entering TypeSafe. Model fetching and connection tests then send the new provider protocol to the TypeSafe API and fail until the user notices and manually replaces the stale endpoint.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Map track JSON gains optional segments and a legs index over them; the map node schema is unchanged. The insert dialog accepts multiple GPX files with per-leg title, order and removal, and the preview draws disconnected segments without bridging gaps.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd44f1b817
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| moderationStatus === 'rejected' | ||
| ? CommentState.Junk | ||
| : RequestContext.hasAdminAccess() | ||
| ? CommentState.Read | ||
| : CommentState.Unread, |
There was a problem hiding this comment.
Keep pending comments hidden during rolling deploys
During the normal two-replica rolling deployment, a new replica can insert a low-confidence or failed review with moderationStatus: 'pending', but this branch still assigns the legacy Unread state. An old replica's public thread query accepts both unread and read rows when commentShouldAudit is disabled and does not inspect moderation_status, so it can expose the pending comment until the old replica is drained. Preserve a legacy-hidden state or gate these writes until every instance is upgraded rather than relying on a manual traffic pause.
AGENTS.md reference: AGENTS.md:L87-L89
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
When commentShouldAudit is enabled, an anonymous comment that passes the model has moderationStatus: 'approved' but remains pending until its Unread state is explicitly approved. This condition still invokes markReadOnOpenMutation for that row; the repository translates the resulting Read state into an approved, publicly visible comment. Consequently, merely opening a comment that requires human review publishes it, contrary to the intended manual-approval flow.
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".



Summary
Test plan
Acceptance: https://app.lobehub.com/acceptance/4e4505eb-79d1-499b-86ec-ce3cba9901d8 (4/4 criteria, evidence uploaded).
Database migrations checklist
docs/features/comment-decision-review.md; do not use an ordinary mixed-version rollout.pnpm -C apps/core run lint:migrationspasses; migration applied to isolated PostgreSQL databases.No production configuration or credentials are included. Deploy the backend before the corresponding Yohaku frontend.
Companion frontend: https://github.com/innei-dev/yohaku/pull/192