diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts
index 796dc5b..34c2023 100644
--- a/convex/_generated/api.d.ts
+++ b/convex/_generated/api.d.ts
@@ -96,12 +96,15 @@ import type * as providerApiKeys_query from "../providerApiKeys/query.js";
import type * as providerApiKeys_usability from "../providerApiKeys/usability.js";
import type * as providerApiKeys_validation from "../providerApiKeys/validation.js";
import type * as pullRequests_action from "../pullRequests/action.js";
+import type * as pullRequests_catchUp from "../pullRequests/catchUp.js";
+import type * as pullRequests_commands from "../pullRequests/commands.js";
import type * as pullRequests_context from "../pullRequests/context.js";
import type * as pullRequests_errors from "../pullRequests/errors.js";
import type * as pullRequests_github from "../pullRequests/github.js";
import type * as pullRequests_internalAction from "../pullRequests/internalAction.js";
import type * as pullRequests_internalMutation from "../pullRequests/internalMutation.js";
import type * as pullRequests_internalQuery from "../pullRequests/internalQuery.js";
+import type * as pullRequests_records from "../pullRequests/records.js";
import type * as pullRequests_review from "../pullRequests/review.js";
import type * as pullRequests_webhook from "../pullRequests/webhook.js";
import type * as pullRequests_workflow from "../pullRequests/workflow.js";
@@ -265,12 +268,15 @@ declare const fullApi: ApiFromModules<{
"providerApiKeys/usability": typeof providerApiKeys_usability;
"providerApiKeys/validation": typeof providerApiKeys_validation;
"pullRequests/action": typeof pullRequests_action;
+ "pullRequests/catchUp": typeof pullRequests_catchUp;
+ "pullRequests/commands": typeof pullRequests_commands;
"pullRequests/context": typeof pullRequests_context;
"pullRequests/errors": typeof pullRequests_errors;
"pullRequests/github": typeof pullRequests_github;
"pullRequests/internalAction": typeof pullRequests_internalAction;
"pullRequests/internalMutation": typeof pullRequests_internalMutation;
"pullRequests/internalQuery": typeof pullRequests_internalQuery;
+ "pullRequests/records": typeof pullRequests_records;
"pullRequests/review": typeof pullRequests_review;
"pullRequests/webhook": typeof pullRequests_webhook;
"pullRequests/workflow": typeof pullRequests_workflow;
diff --git a/convex/crons.ts b/convex/crons.ts
index e5c6379..d77ac61 100644
--- a/convex/crons.ts
+++ b/convex/crons.ts
@@ -151,6 +151,13 @@ crons.daily(
{},
);
+crons.daily(
+ "trim-review-traces",
+ { hourUTC: 3, minuteUTC: 40 },
+ internal.pullRequests.internalMutation.trimReviewTraces,
+ {},
+);
+
// Push webhooks update immediately; daily synchronization also catches missed events.
crons.daily(
"daily-repository-sync",
diff --git a/convex/pullRequests/internalAction.ts b/convex/pullRequests/internalAction.ts
index 2c4d23a..0bdbcd3 100644
--- a/convex/pullRequests/internalAction.ts
+++ b/convex/pullRequests/internalAction.ts
@@ -14,6 +14,7 @@ import {
UserApiKeyError,
usesUserKey,
} from "../_ai/providerResolution";
+import type { AiProvider } from "../_ai/model";
import {
BATCH_REVIEW_THRESHOLD,
changedSince,
@@ -35,7 +36,8 @@ import {
treePaths,
type PullRequest,
} from "./github";
-import { reviewWithContext } from "./workflow";
+import { reviewWithContext, type ReviewTraceEvent } from "./workflow";
+import { summarizeReviewTrace } from "./records";
import { REVIEW_QUOTA_FAILURES } from "./internalMutation";
import {
isReviewGroupModelFailure,
@@ -329,6 +331,45 @@ export const generate = internalAction({
const group = args.group ?? 0;
let stage = "Source preflight";
let batched = args.page !== undefined;
+ // What this run did, recorded once a model was chosen to measure review
+ // quality. A record that cannot be written never fails the review.
+ const traceEvents: ReviewTraceEvent[] = [];
+ // Read when the record is written: a fallback provider reports the
+ // provider that answered last.
+ let runProvider: AiProvider | undefined;
+ let runOutcome: "proposed" | "refused" | "group_failed" = "proposed";
+ let run:
+ | {
+ kind: "full" | "scoped" | "verification";
+ keySource: "gitdog" | "user";
+ changedFiles: number;
+ inspectedFiles: number;
+ uncoveredFiles: number;
+ discussionEntries: number;
+ findings: number;
+ openRequests: number;
+ }
+ | undefined;
+ const recordRun = async (error?: unknown) => {
+ if (!run || !runProvider) return;
+ await ctx
+ .runMutation(internal.pullRequests.internalMutation.recordReview, {
+ actionId: args.actionId,
+ ...(batched ? { page, group } : {}),
+ ...(error === undefined
+ ? { outcome: runOutcome }
+ : {
+ outcome: isLifecycleChange(error) ? "cancelled" : "failed",
+ failedStage: stage,
+ }),
+ ...run,
+ providerId: runProvider.providerId,
+ modelId: runProvider.modelId,
+ ...summarizeReviewTrace(traceEvents),
+ durationMs: Date.now() - startedAt,
+ })
+ .catch(() => console.warn("Review record was not written"));
+ };
try {
const initial = await ctx.runQuery(
internal.pullRequests.internalQuery.get,
@@ -487,6 +528,17 @@ export const generate = internalAction({
userId: initial.repository.userId,
ticketActionId: args.actionId,
});
+ runProvider = rawAiProvider;
+ run = {
+ kind: verificationOnly ? "verification" : scoped ? "scoped" : "full",
+ keySource: usesUserKey(rawAiProvider) ? "user" : "gitdog",
+ changedFiles: selected.filter((f) => f.status !== "removed").length,
+ inspectedFiles: 0,
+ uncoveredFiles: 0,
+ discussionEntries: 0,
+ findings: 0,
+ openRequests: 0,
+ };
if (batched && !previous && group === 0) {
// Refuse up front instead of spending tokens on early batches and
// stopping at the account limit with nothing published.
@@ -532,6 +584,8 @@ export const generate = internalAction({
: [];
stage = "AI generation and evidence validation";
if (batched && !hasReviewableFiles) {
+ // No model is called for this group, so there is no run to record.
+ run = undefined;
for (const file of selected) excludedPaths.add(file.filename);
// A removed file has no added code to review.
uncoveredFiles += selected.filter((f) => f.status !== "removed").length;
@@ -565,9 +619,11 @@ export const generate = internalAction({
});
let result: Awaited>;
try {
+ if (discussion) run.discussionEntries = discussion.length;
result = await reviewWithContext({
startedAt,
discussion,
+ trace: (event) => traceEvents.push(event),
provider,
batchGroup: batched,
allowSuggestions:
@@ -604,6 +660,7 @@ export const generate = internalAction({
(refused && refusedGroups >= MAX_REFUSED_REVIEW_GROUPS)
)
throw error;
+ runOutcome = refused ? "refused" : "group_failed";
if (refused) {
refusedGroups++;
for (const file of selected) refusedPaths.add(file.filename);
@@ -619,6 +676,8 @@ export const generate = internalAction({
};
}
openRequests = result.openRequests;
+ run.findings = result.findings.length;
+ run.openRequests = result.openRequests.length;
// Each review group decides windowing for its own reads, so the way
// each quoted file was seen travels with the evidence itself.
findings.push(
@@ -638,9 +697,13 @@ export const generate = internalAction({
for (const file of selected) {
if (file.status === "removed") continue;
// A diff dropped for size was not reviewed even if its source was read.
- if (hasReviewablePatch(file) && inspected.has(file.filename))
+ if (hasReviewablePatch(file) && inspected.has(file.filename)) {
inspectedFiles++;
- else uncoveredFiles++;
+ run.inspectedFiles++;
+ } else {
+ uncoveredFiles++;
+ run.uncoveredFiles++;
+ }
}
for (const path of result.excludedPaths) excludedPaths.add(path);
for (const read of result.reads)
@@ -732,7 +795,9 @@ export const generate = internalAction({
uncoveredFiles,
},
});
+ await recordRun();
} catch (error) {
+ await recordRun(error);
// Do not persist provider bodies, source snippets or credentials in errors.
if (batched)
stage = `${stage} (review batch ${page}${group ? `, part ${group + 1}` : ""})`;
diff --git a/convex/pullRequests/internalMutation.ts b/convex/pullRequests/internalMutation.ts
index 07e4c4a..721f12b 100644
--- a/convex/pullRequests/internalMutation.ts
+++ b/convex/pullRequests/internalMutation.ts
@@ -25,6 +25,7 @@ import {
reviewSummary,
} from "./review";
import { isBotPullRequestAuthor, REVIEW_BATCH_TOKEN_ESTIMATE } from "./github";
+import { REVIEW_TRACE_RETENTION_MS, reviewTraceStepValidator } from "./records";
const snapshotValidator = v.object({
headSha: v.string(),
@@ -1467,3 +1468,84 @@ export const recordStatusComment = internalMutation({
return true;
},
});
+
+export const recordReview = internalMutation({
+ args: {
+ actionId: v.id("ticketActions"),
+ page: v.optional(v.number()),
+ group: v.optional(v.number()),
+ kind: v.union(
+ v.literal("full"),
+ v.literal("scoped"),
+ v.literal("verification"),
+ ),
+ // "refused" and "group_failed": the model call failed and the review
+ // went on without this run's files.
+ outcome: v.union(
+ v.literal("proposed"),
+ v.literal("refused"),
+ v.literal("group_failed"),
+ v.literal("failed"),
+ v.literal("cancelled"),
+ ),
+ // The fixed name of the review stage a failed run stopped in.
+ failedStage: v.optional(v.string()),
+ providerId: v.string(),
+ modelId: v.string(),
+ keySource: v.union(v.literal("gitdog"), v.literal("user")),
+ durationMs: v.number(),
+ changedFiles: v.number(),
+ inspectedFiles: v.number(),
+ uncoveredFiles: v.number(),
+ discussionEntries: v.number(),
+ steps: v.number(),
+ candidates: v.number(),
+ discarded: v.number(),
+ findings: v.number(),
+ openRequests: v.number(),
+ trace: v.array(reviewTraceStepValidator),
+ },
+ handler: async (ctx, args) => {
+ const action = await ctx.db.get(args.actionId);
+ if (!action || action.actionType !== "review") return;
+ const ticket = await ctx.db.get(action.ticketId);
+ if (!ticket?.repositoryId) return;
+ const now = Date.now();
+ const { trace, ...counts } = args;
+ await ctx.db.insert("reviewRecords", {
+ ...counts,
+ repositoryId: ticket.repositoryId,
+ ...(trace.length
+ ? { trace, traceExpiresAt: now + REVIEW_TRACE_RETENTION_MS }
+ : {}),
+ createdAt: now,
+ });
+ },
+});
+
+const REVIEW_TRACE_TRIM_BATCH = 20;
+
+// Clears review traces past their retention window; the counts stay.
+export const trimReviewTraces = internalMutation({
+ args: {},
+ handler: async (ctx) => {
+ const expired = await ctx.db
+ .query("reviewRecords")
+ .withIndex("by_trace_expiry", (q) =>
+ q.gt("traceExpiresAt", 0).lte("traceExpiresAt", Date.now()),
+ )
+ .take(REVIEW_TRACE_TRIM_BATCH);
+ for (const record of expired)
+ await ctx.db.patch(record._id, {
+ trace: undefined,
+ traceExpiresAt: undefined,
+ });
+ if (expired.length === REVIEW_TRACE_TRIM_BATCH)
+ await ctx.scheduler.runAfter(
+ 0,
+ internal.pullRequests.internalMutation.trimReviewTraces,
+ {},
+ );
+ return expired.length;
+ },
+});
diff --git a/convex/pullRequests/records.ts b/convex/pullRequests/records.ts
new file mode 100644
index 0000000..6115d59
--- /dev/null
+++ b/convex/pullRequests/records.ts
@@ -0,0 +1,84 @@
+import { v } from "convex/values";
+import type { ReviewTraceEvent } from "./workflow";
+
+// How long a review run's per-step trace is kept for quality checks.
+export const REVIEW_TRACE_RETENTION_MS = 30 * 24 * 60 * 60 * 1_000;
+// Bounds one record to a few hundred KB even for multibyte text, so a trim
+// batch stays well inside a transaction's read limit.
+const MAX_TRACE_STEPS = 16;
+const MAX_STEP_ENTRIES = 15;
+const MAX_TITLE_LENGTH = 160;
+const MAX_PATH_LENGTH = 200;
+
+export const reviewTraceStepValidator = v.object({
+ step: v.string(),
+ proposed: v.optional(
+ v.array(
+ v.object({
+ path: v.string(),
+ priority: v.string(),
+ confidence: v.number(),
+ title: v.string(),
+ }),
+ ),
+ ),
+ kept: v.optional(v.array(v.string())),
+ discarded: v.optional(v.array(v.string())),
+});
+
+export type ReviewTraceStep = typeof reviewTraceStepValidator.type;
+
+// Cut by code point so a surrogate pair is never split.
+const text = (value: unknown, limit: number) =>
+ typeof value === "string" ? Array.from(value).slice(0, limit).join("") : "";
+
+/** A bounded copy of what each review step proposed and kept. */
+export function summarizeReviewTrace(events: ReviewTraceEvent[]): {
+ trace: ReviewTraceStep[];
+ steps: number;
+ candidates: number;
+ discarded: number;
+} {
+ let candidates = 0;
+ let discarded = 0;
+ const trace: ReviewTraceStep[] = [];
+ for (const event of events) {
+ if (event.stage === "proposed") {
+ candidates += event.candidates.length;
+ trace.push({
+ step: text(event.step, MAX_PATH_LENGTH),
+ proposed: event.candidates.slice(0, MAX_STEP_ENTRIES).map((c) => ({
+ path: text(c.path, MAX_PATH_LENGTH),
+ priority: text(c.priority, 8),
+ confidence:
+ typeof c.confidence === "number" && Number.isFinite(c.confidence)
+ ? c.confidence
+ : 0,
+ title: text(c.title, MAX_TITLE_LENGTH),
+ })),
+ });
+ } else {
+ discarded += event.discarded.length;
+ trace.push({
+ step: text(event.step, MAX_PATH_LENGTH),
+ kept: event.kept
+ .slice(0, MAX_STEP_ENTRIES)
+ .map((t) => text(t, MAX_TITLE_LENGTH)),
+ discarded: event.discarded
+ .slice(0, MAX_STEP_ENTRIES)
+ .map((t) => text(t, MAX_TITLE_LENGTH)),
+ });
+ }
+ }
+ const half = MAX_TRACE_STEPS / 2;
+ return {
+ // The first steps and the last, where the final verification is.
+ trace:
+ trace.length > MAX_TRACE_STEPS
+ ? [...trace.slice(0, half), ...trace.slice(-half)]
+ : trace,
+ steps: events.filter((e) => e.stage === "proposed").length,
+ candidates,
+ discarded,
+ };
+}
diff --git a/convex/repositories/mutation.ts b/convex/repositories/mutation.ts
index d903494..e551380 100644
--- a/convex/repositories/mutation.ts
+++ b/convex/repositories/mutation.ts
@@ -578,6 +578,7 @@ type DisconnectCleanupPhase =
| "invitations"
| "api_keys"
| "commands"
+ | "review_records"
| "tickets"
| "history"
| "notifications"
@@ -760,6 +761,7 @@ export const continueRepositoryDisconnectCleanup = internalMutation({
| "repositoryMembers"
| "projectApiKeys"
| "pullRequestCommands"
+ | "reviewRecords"
| "invitations",
nextPhase: DisconnectCleanupPhase,
) => {
@@ -798,7 +800,13 @@ export const continueRepositoryDisconnectCleanup = internalMutation({
return await deleteRepositoryPage("projectApiKeys", "commands");
}
if (phase === "commands") {
- return await deleteRepositoryPage("pullRequestCommands", "tickets");
+ return await deleteRepositoryPage(
+ "pullRequestCommands",
+ "review_records",
+ );
+ }
+ if (phase === "review_records") {
+ return await deleteRepositoryPage("reviewRecords", "tickets");
}
if (phase === "tickets") {
@@ -1159,6 +1167,16 @@ export const continueRepositoryDisconnectCleanup = internalMutation({
await advanceDisconnectCleanup(ctx, args.repositoryId, "commands");
return { completed: false, processed: 0 };
}
+ const remainingRecord = await ctx.db
+ .query("reviewRecords")
+ .withIndex("by_repository", (q) =>
+ q.eq("repositoryId", args.repositoryId),
+ )
+ .first();
+ if (remainingRecord) {
+ await advanceDisconnectCleanup(ctx, args.repositoryId, "review_records");
+ return { completed: false, processed: 0 };
+ }
// embeddingUsageReservations deliberately retain the immutable repository
// ID after disconnect. Pending/ambiguous provider attempts must remain
// reconcilable for billing; they never grant repository access.
diff --git a/convex/schema.ts b/convex/schema.ts
index 1e12179..991db42 100644
--- a/convex/schema.ts
+++ b/convex/schema.ts
@@ -3,6 +3,7 @@ import { v } from "convex/values";
import { authTables } from "@convex-dev/auth/server";
import { chatRecoveryTargetValidator } from "./_ai/chatRecovery";
import { reviewBatchResultValidator } from "./pullRequests/review";
+import { reviewTraceStepValidator } from "./pullRequests/records";
const applicationTables = {
projectApiKeys: defineTable({
@@ -771,6 +772,7 @@ const applicationTables = {
v.literal("invitations"),
v.literal("api_keys"),
v.literal("commands"),
+ v.literal("review_records"),
v.literal("tickets"),
v.literal("history"),
v.literal("notifications"),
@@ -1728,6 +1730,54 @@ const applicationTables = {
.index("by_comment", ["repositoryId", "commentId"])
.index("by_repository_user", ["repositoryId", "githubUserId", "createdAt"]),
+ // One row per model run of a pull request review, kept to measure review
+ // quality: what the run covered, what it proposed and what verification
+ // dropped. The per-step trace holds model-written titles, so it is cleared
+ // after a retention window; the counts stay while the repository is
+ // connected.
+ reviewRecords: defineTable({
+ repositoryId: v.id("repositories"),
+ actionId: v.id("ticketActions"),
+ page: v.optional(v.number()),
+ group: v.optional(v.number()),
+ kind: v.union(
+ v.literal("full"),
+ v.literal("scoped"),
+ v.literal("verification"),
+ ),
+ // "refused" and "group_failed": the model call failed and the review
+ // went on without this run's files.
+ outcome: v.union(
+ v.literal("proposed"),
+ v.literal("refused"),
+ v.literal("group_failed"),
+ v.literal("failed"),
+ v.literal("cancelled"),
+ ),
+ // The fixed name of the review stage a failed run stopped in.
+ failedStage: v.optional(v.string()),
+ providerId: v.string(),
+ modelId: v.string(),
+ keySource: v.union(v.literal("gitdog"), v.literal("user")),
+ durationMs: v.number(),
+ changedFiles: v.number(),
+ inspectedFiles: v.number(),
+ uncoveredFiles: v.number(),
+ discussionEntries: v.number(),
+ steps: v.number(),
+ // Summed over steps; a retried step proposes its findings again.
+ candidates: v.number(),
+ discarded: v.number(),
+ findings: v.number(),
+ openRequests: v.number(),
+ trace: v.optional(v.array(reviewTraceStepValidator)),
+ traceExpiresAt: v.optional(v.number()),
+ createdAt: v.number(),
+ })
+ .index("by_repository", ["repositoryId"])
+ .index("by_action", ["actionId"])
+ .index("by_trace_expiry", ["traceExpiresAt"]),
+
// ============================================
// INVITATIONS (Team invitations)
// ============================================
diff --git a/packages/cli/README.md b/packages/cli/README.md
index a55321a..85568e9 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -20,7 +20,7 @@
-
+
Connect repositories, configure issue, discussion and PR automation, review
@@ -69,7 +69,7 @@ Use `npx gitdog@latest --help` to explore commands. Add `--json` for scripts.
```sh
npx gitdog@latest keys create --name ci
-npx --yes gitdog@0.4.1 --key-file /path/to/key.json projects list --json
+npx --yes gitdog@0.4.2 --key-file /path/to/key.json projects list --json
npx gitdog@latest keys revoke KEY_ID --yes
```
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 051fa99..255618c 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "gitdog",
- "version": "0.4.1",
+ "version": "0.4.2",
"description": "Manage Gitdog projects, GitHub automation and API keys from your terminal",
"type": "module",
"bin": {
diff --git a/packages/cli/src/ui.ts b/packages/cli/src/ui.ts
index d880327..063fd92 100644
--- a/packages/cli/src/ui.ts
+++ b/packages/cli/src/ui.ts
@@ -1,7 +1,7 @@
import { createInterface } from "node:readline/promises";
import { stripVTControlCharacters } from "node:util";
-export const VERSION = "0.4.1";
+export const VERSION = "0.4.2";
export const DOG = String.raw`
▗██▄▄ ▄▄██▖
██▀▜██▙▄ ▙▄ ▄▟██▛▀██
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 2eb1962..0cf23a5 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -1072,6 +1072,7 @@
"Provide, maintain, and improve our service",
"Authenticate and manage user accounts",
"Process AI requests and generate responses",
+ "Measure and improve the quality of pull request reviews",
"Calculate and track token usage for billing",
"Offer customer support",
"Ensure platform security",
@@ -1141,6 +1142,7 @@
"items": [
"Account data for as long as your account is active",
"Repository index data while repositories are connected",
+ "Pull request review records while the repository is connected: the model and key type used, how long each review run took, how many files it read, and how many findings it proposed and how many passed verification. The file paths and titles of the candidate findings each review step considered are kept for 30 days, then deleted",
"Action history for 12 months for your reference",
"Normalized payment transaction, entitlement-change, and refund/audit records are ordinarily retained for 5 years, then deleted unless a longer legal, security, accounting, or unresolved manual-review hold applies",
"A non-content, non-reversible settlement fingerprint may be retained indefinitely to prevent duplicate credits or charges; it contains no raw payload, card, or contact data",
@@ -1189,7 +1191,7 @@
"description": "Terms of Service for Gitdog - AI-powered GitHub assistant",
"heading": "Terms of Service",
"companyInfo": "Hyo Dev",
- "lastUpdated": "Last updated: November 13, 2026",
+ "lastUpdated": "Last updated: November 18, 2026",
"intro": "Welcome to Gitdog, an AI-powered GitHub assistant platform provided by Hyo Dev (\"we\", \"our\", \"us\"). By using our service, you agree to these Terms of Service.",
"section1": {
"title": "1. Acceptance of Terms",
@@ -1251,7 +1253,7 @@
},
"yourContent": {
"title": "6.2. Your Content",
- "description": "You retain ownership of your code and repository content. By using Gitdog, you grant us a limited, non-exclusive license to process and disclose your content to the providers identified in our Privacy Policy as needed to provide the service under their applicable terms."
+ "description": "You retain ownership of your code and repository content. By using Gitdog, you grant us a limited, non-exclusive license to process and disclose your content to the providers identified in our Privacy Policy as needed to provide the service under their applicable terms. This includes keeping the pull request review records described in our Privacy Policy to measure and improve review quality; we do not sell your content or use it to train Gitdog's own models."
}
},
"section7": {
diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json
index 6d4e7ab..783d905 100644
--- a/src/i18n/locales/ja.json
+++ b/src/i18n/locales/ja.json
@@ -1071,6 +1071,7 @@
"サービスの提供、維持、改善",
"ユーザーアカウントの認証と管理",
"AIリクエストの処理と応答の生成",
+ "プルリクエストレビューの品質の測定と改善",
"課金のためのトークン使用量の計算と追跡",
"カスタマーサポートの提供",
"プラットフォームのセキュリティ確保",
@@ -1133,6 +1134,7 @@
"items": [
"アカウントがアクティブな間はアカウントデータ",
"リポジトリが接続されている間はリポジトリインデックスデータ",
+ "リポジトリが接続されている間はプルリクエストのレビュー記録(使用したモデルとキーの種類、レビューの実行時間、読んだファイル数、提案した指摘の数と検証で残った数)。各レビュー段階で検討した指摘候補のファイルパスとタイトルは30日間保持した後に削除",
"参照用に12ヶ月間アクション履歴",
"正規化された決済取引、利用権限の変更、返金・監査記録は原則として5年間保持した後に削除します。ただし、法務、セキュリティ、会計、または未解決の手動審査のためにより長い保持が必要な場合を除き、従来のWebhook生データ項目は安全な移行と適用される保持措置の終了後に削除または非識別化します",
"重複したクレジット付与や請求を防ぐため、コンテンツを含まない不可逆の決済照合フィンガープリントを無期限に保持する場合があり、このフィンガープリントにはWebhookの生データ、カード情報、連絡先情報は含まれない",
@@ -1181,7 +1183,7 @@
"description": "Gitdogの利用規約 - AI駆動のGitHubアシスタント",
"heading": "利用規約",
"companyInfo": "Hyo Dev",
- "lastUpdated": "最終更新日:2026年11月13日",
+ "lastUpdated": "最終更新日:2026年11月18日",
"intro": "Hyo Dev(以下「当社」)が提供するAI駆動のGitHubアシスタントプラットフォームであるGitdogへようこそ。サービスを使用することにより、この利用規約に同意したものとみなされます。",
"section1": {
"title": "1. 規約の承諾",
@@ -1243,7 +1245,7 @@
},
"yourContent": {
"title": "6.2. お客様のコンテンツ",
- "description": "お客様のコードとリポジトリコンテンツの所有権はお客様にあります。Gitdogを使用することにより、サービス提供に必要な範囲で、プライバシーポリシーに記載されたプロバイダーが適用規約に従って処理できるよう、当社がお客様のコンテンツを処理および開示するための限定的かつ非独占的なライセンスを付与したものとみなされます。"
+ "description": "お客様のコードとリポジトリコンテンツの所有権はお客様にあります。Gitdogを使用することにより、サービス提供に必要な範囲で、プライバシーポリシーに記載されたプロバイダーが適用規約に従って処理できるよう、当社がお客様のコンテンツを処理および開示するための限定的かつ非独占的なライセンスを付与したものとみなされます。これには、レビュー品質の測定と改善のために、プライバシーポリシーに記載されたプルリクエストのレビュー記録を保持することが含まれます。当社はお客様のコンテンツを販売したり、Gitdog独自のモデルの学習に使用したりしません。"
}
},
"section7": {
diff --git a/src/i18n/locales/ko.json b/src/i18n/locales/ko.json
index bcfdbb3..efc1698 100644
--- a/src/i18n/locales/ko.json
+++ b/src/i18n/locales/ko.json
@@ -1067,6 +1067,7 @@
"서비스 제공, 유지 및 개선",
"사용자 계정 인증 및 관리",
"AI 요청 처리 및 응답 생성",
+ "풀 리퀘스트 리뷰 품질 측정 및 개선",
"청구를 위한 토큰 사용량 계산 및 추적",
"고객 지원 제공",
"플랫폼 보안 보장",
@@ -1125,6 +1126,7 @@
"items": [
"계정이 활성 상태인 동안 계정 데이터",
"저장소가 연결되어 있는 동안 저장소 인덱스 데이터",
+ "저장소가 연결되어 있는 동안 풀 리퀘스트 리뷰 기록: 사용한 모델과 키 종류, 리뷰 실행 시간, 읽은 파일 수, 제안한 지적 사항 수와 검증을 통과한 수. 각 리뷰 단계에서 검토한 후보 지적 사항의 파일 경로와 제목은 30일간 보관한 후 삭제",
"참조를 위해 12개월 동안 작업 기록",
"정규화된 결제 거래, 이용 권한 변경 및 환불·감사 기록은 원칙적으로 5년간 보존한 후 삭제하되, 법률·보안·회계 또는 미해결 수동 검토를 위해 더 긴 보존이 필요한 경우는 예외이며, 기존 웹훅 원문 필드는 안전한 마이그레이션과 적용되는 보존 조치가 끝난 뒤 삭제하거나 비식별화",
"중복 크레딧 지급 또는 청구를 방지하기 위해 콘텐츠를 포함하지 않는 비가역적 결제 정산 지문을 무기한 보존할 수 있으며, 이 지문에는 웹훅 원문, 카드 정보 또는 연락처 정보가 포함되지 않음",
@@ -1173,7 +1175,7 @@
"description": "Gitdog 이용약관 - AI 기반 GitHub 어시스턴트",
"heading": "이용약관",
"companyInfo": "Hyo Dev",
- "lastUpdated": "최종 수정일: 2026년 11월 13일",
+ "lastUpdated": "최종 수정일: 2026년 11월 18일",
"intro": "Hyo Dev(이하 \"회사\", \"우리\")가 제공하는 AI 기반 GitHub 어시스턴트 플랫폼인 Gitdog에 오신 것을 환영합니다. 서비스를 사용함으로써 귀하는 이 이용약관에 동의하게 됩니다.",
"section1": {
"title": "1. 약관 수락",
@@ -1235,7 +1237,7 @@
},
"yourContent": {
"title": "6.2. 귀하의 콘텐츠",
- "description": "귀하의 코드와 저장소 콘텐츠의 소유권은 귀하에게 있습니다. Gitdog을 사용함으로써 서비스 제공에 필요한 범위에서 개인정보 처리방침에 명시된 제공업체가 해당 약관에 따라 콘텐츠를 처리하도록 당사가 콘텐츠를 처리하고 공개할 수 있는 제한적이고 비독점적인 라이선스를 부여합니다."
+ "description": "귀하의 코드와 저장소 콘텐츠의 소유권은 귀하에게 있습니다. Gitdog을 사용함으로써 서비스 제공에 필요한 범위에서 개인정보 처리방침에 명시된 제공업체가 해당 약관에 따라 콘텐츠를 처리하도록 당사가 콘텐츠를 처리하고 공개할 수 있는 제한적이고 비독점적인 라이선스를 부여합니다. 여기에는 리뷰 품질을 측정하고 개선하기 위해 개인정보 처리방침에 설명된 풀 리퀘스트 리뷰 기록을 보관하는 것이 포함되며, 당사는 귀하의 콘텐츠를 판매하거나 Gitdog 자체 모델 학습에 사용하지 않습니다."
}
},
"section7": {
diff --git a/test/convex/pullRequests/lifecycle.test.ts b/test/convex/pullRequests/lifecycle.test.ts
index a72dcb2..e44f803 100644
--- a/test/convex/pullRequests/lifecycle.test.ts
+++ b/test/convex/pullRequests/lifecycle.test.ts
@@ -3,6 +3,7 @@ import { join } from "node:path";
import { convexTest } from "convex-test";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import schema from "../../../convex/schema";
+import type { Doc } from "../../../convex/_generated/dataModel";
import { internal, api } from "../../../convex/_generated/api";
import * as helpers from "../../../convex/github/helpers";
import * as repositoryIdentity from "../../../convex/github/repositoryIdentity";
@@ -1022,8 +1023,10 @@ describe("PR review durable lifecycle", () => {
await f.t.action(internal.pullRequests.internalAction.generate, {
actionId,
});
+ records = await f.t.run((ctx) => ctx.db.query("reviewRecords").collect());
return await f.t.run((ctx) => ctx.db.get(actionId));
}
+ let records: Doc<"reviewRecords">[] = [];
it("records the failed pinned source request on the review ticket", async () => {
const filename = "src/pages/[id].tsx";
const tree = {
@@ -1051,6 +1054,16 @@ describe("PR review durable lifecycle", () => {
"Reason · GitHub could not find the requested resource (HTTP 404).",
].join("\n"),
});
+ // A run that failed after a model was chosen is recorded with the
+ // stage it stopped in.
+ expect(records).toMatchObject([
+ {
+ kind: "full",
+ outcome: "failed",
+ failedStage: "AI generation and evidence validation",
+ changedFiles: 1,
+ },
+ ]);
});
it("explains that a PR has too many changed files", async () => {
expect(
@@ -3208,6 +3221,50 @@ describe("batched PR reviews", () => {
await f.generate(2);
expect(f.statusComments.add).toHaveBeenCalledTimes(1);
});
+ it("records what each review run covered, proposed and kept", async () => {
+ const f = await batchFixture();
+ await f.generate();
+ const records = () =>
+ f.t.run((ctx) =>
+ ctx.db
+ .query("reviewRecords")
+ .withIndex("by_action", (q) => q.eq("actionId", f.actionId))
+ .collect(),
+ );
+ const [record] = await records();
+ expect(record).toMatchObject({
+ kind: "full",
+ outcome: "proposed",
+ providerId: "anthropic",
+ modelId: "claude-opus-5-5",
+ page: 1,
+ group: 0,
+ keySource: "gitdog",
+ changedFiles: 16,
+ inspectedFiles: 16,
+ uncoveredFiles: 0,
+ steps: 2,
+ candidates: 2,
+ discarded: 0,
+ findings: 1,
+ openRequests: 0,
+ });
+ expect(record.trace?.at(-1)).toEqual({
+ step: "pr-review/critique",
+ kept: ["Keep the requested key"],
+ discarded: [],
+ });
+ // The trace is cleared after its retention window; the counts stay.
+ vi.setSystemTime(record.traceExpiresAt! + 1);
+ await f.t.mutation(
+ internal.pullRequests.internalMutation.trimReviewTraces,
+ {},
+ );
+ const [trimmed] = await records();
+ expect(trimmed).not.toHaveProperty("trace");
+ expect(trimmed).not.toHaveProperty("traceExpiresAt");
+ expect(trimmed).toMatchObject({ findings: 1, candidates: 2 });
+ });
it("combines findings from a 61-file PR into one review body after all batches finish", async () => {
const f = await batchFixture();
await f.generate();
diff --git a/test/convex/pullRequests/records.test.ts b/test/convex/pullRequests/records.test.ts
new file mode 100644
index 0000000..c0714e0
--- /dev/null
+++ b/test/convex/pullRequests/records.test.ts
@@ -0,0 +1,61 @@
+import { describe, expect, it } from "vitest";
+import { summarizeReviewTrace } from "../../../convex/pullRequests/records";
+import type { ReviewTraceEvent } from "../../../convex/pullRequests/workflow";
+
+const proposed = (step: string, count = 1): ReviewTraceEvent => ({
+ stage: "proposed",
+ step,
+ candidates: Array.from({ length: count }, (_, i) => ({
+ path: `src/${i}.ts`,
+ priority: "P2",
+ confidence: 0.9,
+ title: `Finding ${i}`,
+ })),
+});
+
+describe("review trace summary", () => {
+ it("counts every step and keeps the first and last of a long trace", () => {
+ const events = [
+ ...Array.from({ length: 20 }, (_, i) => proposed(`main/${i}`, 2)),
+ {
+ stage: "verified",
+ step: "pr-review/critique",
+ kept: ["Finding 0"],
+ discarded: ["Finding 1"],
+ } as const,
+ ];
+ const summary = summarizeReviewTrace(events);
+ expect(summary).toMatchObject({ steps: 20, candidates: 40, discarded: 1 });
+ expect(summary.trace).toHaveLength(16);
+ expect(summary.trace[0].step).toBe("main/0");
+ expect(summary.trace.at(-1)).toEqual({
+ step: "pr-review/critique",
+ kept: ["Finding 0"],
+ discarded: ["Finding 1"],
+ });
+ });
+
+ it("bounds entries and text, and never stores non-text values", () => {
+ const [step] = summarizeReviewTrace([
+ {
+ stage: "proposed",
+ step: "main/0",
+ candidates: [
+ ...Array.from({ length: 30 }, () => ({
+ path: { nested: true },
+ priority: "P1-and-much-more",
+ confidence: Number.NaN,
+ title: `${"x".repeat(159)}😀tail`,
+ })),
+ ],
+ },
+ ]).trace;
+ expect(step.proposed).toHaveLength(15);
+ expect(step.proposed?.[0]).toEqual({
+ path: "",
+ priority: "P1-and-m",
+ confidence: 0,
+ title: `${"x".repeat(159)}😀`,
+ });
+ });
+});
diff --git a/test/convex/repositories/disconnectLifecycle.test.ts b/test/convex/repositories/disconnectLifecycle.test.ts
index 7015175..b5967db 100644
--- a/test/convex/repositories/disconnectLifecycle.test.ts
+++ b/test/convex/repositories/disconnectLifecycle.test.ts
@@ -445,6 +445,28 @@ describe("repository lifecycle fencing", () => {
status: "pending_approval",
createdAt: now,
});
+ await ctx.db.insert("reviewRecords", {
+ repositoryId,
+ actionId: referencedActionId,
+ kind: "full",
+ outcome: "proposed",
+ providerId: "anthropic",
+ modelId: "claude-opus-5-5",
+ keySource: "gitdog",
+ durationMs: 1,
+ changedFiles: 1,
+ inspectedFiles: 1,
+ uncoveredFiles: 0,
+ discussionEntries: 0,
+ steps: 1,
+ candidates: 1,
+ discarded: 0,
+ findings: 1,
+ openRequests: 0,
+ trace: [{ step: "main/0", kept: ["Finding"] }],
+ traceExpiresAt: now + 1,
+ createdAt: now,
+ });
for (let index = 1; index < 55; index++) {
await ctx.db.insert("ticketActions", {
ticketId,
@@ -595,6 +617,10 @@ describe("repository lifecycle fencing", () => {
.query("pullRequestCommands")
.withIndex("by_repository", (q) => q.eq("repositoryId", repositoryId))
.collect(),
+ reviewRecords: await ctx.db
+ .query("reviewRecords")
+ .withIndex("by_repository", (q) => q.eq("repositoryId", repositoryId))
+ .collect(),
repository: await ctx.db.get(repositoryId),
chunks: await ctx.db
.query("repoChunks")
@@ -638,6 +664,7 @@ describe("repository lifecycle fencing", () => {
queueStorageUrl: await ctx.storage.getUrl(seeded.queueStorageId),
}));
expect(final.commands).toHaveLength(0);
+ expect(final.reviewRecords).toHaveLength(0);
expect(final.repository).toBeNull();
expect(final.chunks).toHaveLength(0);
expect(final.maps).toHaveLength(0);