Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(issue): include harness and model metadata (#3460)
Lizi04900fcbc676
diff --git a/apps/desktop/src/main/github-issue/__tests__/githubIssueSubmitService.test.ts b/apps/desktop/src/main/github-issue/__tests__/githubIssueSubmitService.test.tsindex f0065c03b6..7b213747ee 100644--- a/apps/desktop/src/main/github-issue/__tests__/githubIssueSubmitService.test.ts+++ b/apps/desktop/src/main/github-issue/__tests__/githubIssueSubmitService.test.ts@@ -13,6 +13,7 @@ import type { IssueConfirmDecision } from '../issueConfirmBridge';const REQ = {sessionId: 'sess-1',+ agentKind: 'codex' as const,workingDir: '/repo',title: 'agent 整理的标题标题标题',body: '## 现象\nagent 整理的正文,长度足够覆盖最小要求。',@@ -40,6 +41,7 @@ function makeDeps(over: Partial<GithubIssueSubmitServiceDeps> = {}) {postIssue,getAppVersion: () => '0.0.112',getOsInfo: () => ({ platform: 'darwin', arch: 'arm64', osVersion: '25.5.0' }),+ getTurnModelId: async () => 'gpt-5.6',getRegion: () => 'cn',getFallbackLocale: () => 'en',getSubmitterName: () => 'Carol',@@ -84,6 +86,8 @@ describe('submitGithubIssueWithConfirm', () => {platform: 'darwin',arch: 'arm64',osVersion: '25.5.0',+ harness: 'Codex',+ modelId: 'gpt-5.6',region: 'cn',},{ platform: PLATFORM_IDENTITY },@@ -99,6 +103,8 @@ describe('submitGithubIssueWithConfirm', () => {expect(posted.description).toContain('用户改过的正文');expect(posted.description).toContain('**版本区域**: CN');expect(posted.description).toContain('**OS**: darwin arm64 (25.5.0)');+ expect(posted.description).toContain('**Harness**: Codex');+ expect(posted.description).toContain('**Model ID**: ` gpt-5.6 `');expect(posted.description).toContain('**界面语言**: ja');expect(res).toEqual({ok: true,@@ -110,17 +116,85 @@ describe('submitGithubIssueWithConfirm', () => {});});- it('agent 初稿中的常见敏感信息在确认前自动脱敏,并标记隐私处理', async () => {+ it('把三种 agentKind 映射为公开 Harness 全名', async () => {+ for (const [agentKind, harness] of [+ ['claude-code', 'Claude Code'],+ ['codex', 'Codex'],+ ['pi', 'Pi'],+ ] as const) {+ const { deps, confirm, postIssue } = makeDeps();+ await expect(+ submitGithubIssueWithConfirm(deps, { ...REQ, agentKind }),+ ).resolves.toMatchObject({ ok: true });+ expect(confirm.mock.calls[0]![2]).toMatchObject({ harness });+ expect(postIssue.mock.calls[0]![1]().description).toContain(`**Harness**: ${harness}`);+ }+ });++ it('在确认卡出现前锁定本轮模型 ID,之后切换 session 模型不会改写提交值', async () => {+ let selectedModel = 'claude-sonnet-4-5';+ const getTurnModelId = vi.fn(async () => selectedModel);const confirm = vi.fn<GithubIssueSubmitServiceDeps['confirm']>(- async (_sessionId, draft) => ({- confirmed: true,- title: draft.title,- body: draft.body,- type: draft.type,- publicName: 'Carol',- uiLanguage: 'zh-CN',- }),+ async (_sessionId, draft, env) => {+ expect(env.modelId).toBe('claude-sonnet-4-5');+ selectedModel = 'gpt-5.6';+ return {+ confirmed: true,+ title: draft.title,+ body: draft.body,+ type: draft.type,+ publicName: 'Carol',+ uiLanguage: 'zh-CN',+ };+ },+ );+ const { deps, postIssue } = makeDeps({ getTurnModelId, confirm });++ await expect(submitGithubIssueWithConfirm(deps, REQ)).resolves.toMatchObject({ ok: true });++ expect(getTurnModelId).toHaveBeenCalledWith('sess-1');+ expect(postIssue.mock.calls[0]![1]().description).toContain(+ '**Model ID**: ` claude-sonnet-4-5 `',+ );+ expect(postIssue.mock.calls[0]![1]().description).not.toContain(+ '**Model ID**: ` gpt-5.6 `',);+ });++ it('把自定义模型 ID 规范为有界单行值,查找失败时使用 unknown 且不阻断提交', async () => {+ const injected = `custom-model\n**Injected**: @maintainers \`value\` ${'x'.repeat(300)}`;+ const { deps, confirm, postIssue } = makeDeps({+ getTurnModelId: async () => injected,+ });+ await expect(submitGithubIssueWithConfirm(deps, REQ)).resolves.toMatchObject({ ok: true });+ const confirmedModelId = confirm.mock.calls[0]![2].modelId;+ expect(confirmedModelId).toHaveLength(200);+ expect(confirmedModelId).not.toMatch(/[\r\n]/);+ expect(postIssue.mock.calls[0]![1]().description).toContain(+ '**Model ID**: `` ' + confirmedModelId + ' ``',+ );+ expect(postIssue.mock.calls[0]![1]().description).not.toContain('\n**Injected**:');++ const fallback = makeDeps({+ getTurnModelId: async () => {+ throw new Error('database unavailable');+ },+ });+ await expect(submitGithubIssueWithConfirm(fallback.deps, REQ)).resolves.toMatchObject({+ ok: true,+ });+ expect(fallback.confirm.mock.calls[0]![2]).toMatchObject({ modelId: 'unknown' });+ });++ it('agent 初稿中的常见敏感信息在确认前自动脱敏,并标记隐私处理', async () => {+ const confirm = vi.fn<GithubIssueSubmitServiceDeps['confirm']>(async (_sessionId, draft) => ({+ confirmed: true,+ title: draft.title,+ body: draft.body,+ type: draft.type,+ publicName: 'Carol',+ uiLanguage: 'zh-CN',+ }));const postIssue = vi.fn<GithubIssueSubmitServiceDeps['postIssue']>(async () => ({githubIssue: { number: 81, url: 'https://github.com/makecindy/cindy/issues/81' },}));@@ -307,7 +381,10 @@ describe('submitGithubIssueWithConfirm', () => {expect(confirm.mock.calls[0]![3]).toEqual(submissionChoices);expect(confirm.mock.calls[0]![4]).toBe('Carol');expect(postIssue.mock.calls[0]![0]).toEqual(identity);- expect(postIssue.mock.calls[0]![1]()).not.toHaveProperty('userName');+ const directBody = postIssue.mock.calls[0]![1]();+ expect(directBody).not.toHaveProperty('userName');+ expect(directBody.description).toContain('**Harness**: Codex');+ expect(directBody.description).toContain('**Model ID**: ` gpt-5.6 `');});it('身份选项解析意外失败时不弹确认卡、不提交', async () => {diff --git a/apps/desktop/src/main/github-issue/__tests__/issueConfirmBridge.test.ts b/apps/desktop/src/main/github-issue/__tests__/issueConfirmBridge.test.tsindex 0f6a09e351..b813e544d0 100644--- a/apps/desktop/src/main/github-issue/__tests__/issueConfirmBridge.test.ts+++ b/apps/desktop/src/main/github-issue/__tests__/issueConfirmBridge.test.ts@@ -14,6 +14,8 @@ const ENV = {platform: 'darwin',arch: 'arm64',osVersion: '25.5.0',+ harness: 'Claude Code' as const,+ modelId: 'claude-opus-4-1',region: 'cn' as const,};const PLATFORM_IDENTITY = { kind: 'platform', login: 'cindy-issue' } as const;@@ -289,7 +291,15 @@ describe('onDesktopOnlyConfirmPending(#926)', () => {const p = bridge.request('feishu_bot_ou_1',{ title: 't', body: 'b', type: 'bug' },- { appVersion: '0.0.0', platform: 'darwin', arch: 'arm64', osVersion: '1', region: 'cn' },+ {+ appVersion: '0.0.0',+ platform: 'darwin',+ arch: 'arm64',+ osVersion: '1',+ harness: 'Codex',+ modelId: 'gpt-5.6',+ region: 'cn',+ },{ platform: { kind: 'platform', login: 'cindy' } },);expect(onPending).toHaveBeenCalledWith('feishu_bot_ou_1');@@ -301,7 +311,15 @@ describe('onDesktopOnlyConfirmPending(#926)', () => {const decision = await bridge.request('s1',{ title: 't', body: 'b', type: 'bug' },- { appVersion: '0.0.0', platform: 'darwin', arch: 'arm64', osVersion: '1', region: 'cn' },+ {+ appVersion: '0.0.0',+ platform: 'darwin',+ arch: 'arm64',+ osVersion: '1',+ harness: 'Codex',+ modelId: 'gpt-5.6',+ region: 'cn',+ },{platform: PLATFORM_IDENTITY,githubUser: { kind: 'github-user', login: 'u' },@@ -325,7 +343,15 @@ describe('onDesktopOnlyConfirmPending 抛错防护(#1059 review)', () => {const decision = await bridge.request('s-throw',{ title: 't', body: 'b', type: 'bug' },- { appVersion: '0.0.0', platform: 'darwin', arch: 'arm64', osVersion: '1', region: 'cn' },+ {+ appVersion: '0.0.0',+ platform: 'darwin',+ arch: 'arm64',+ osVersion: '1',+ harness: 'Codex',+ modelId: 'gpt-5.6',+ region: 'cn',+ },{platform: PLATFORM_IDENTITY,githubUser: { kind: 'github-user', login: 'u' },diff --git a/apps/desktop/src/main/github-issue/githubIssueSubmitService.ts b/apps/desktop/src/main/github-issue/githubIssueSubmitService.tsindex 12913fb567..4d70f94973 100644--- a/apps/desktop/src/main/github-issue/githubIssueSubmitService.ts+++ b/apps/desktop/src/main/github-issue/githubIssueSubmitService.ts@@ -14,6 +14,11 @@ import type { CindyRegion } from '@cindy/maker-shared/brand-identity';import { CINDY_REGION_CODE } from '../../shared/regionCode.js';import { normalizeIssuePublicName } from '../../shared/issuePublicName.js';+import {+ issueHarnessForAgentKind,+ normalizeIssueModelId,+ type IssueAgentKind,+} from '../../shared/issueRuntimeMetadata.js';import type { SubmittedIssueRecord } from '../../shared/myIssues.js';import { myIssueUrl } from '../../shared/myIssues.js';import { redactSensitive } from '../learn-host/redaction';@@ -50,6 +55,7 @@ export type GithubIssueSubmitResult =export interface SubmitIssueRequest {sessionId: string;+ agentKind: IssueAgentKind;workingDir: string;title: string;body: string;@@ -86,6 +92,8 @@ export interface GithubIssueSubmitServiceDeps {) => Promise<GithubIssuePostResponse>;getAppVersion: () => string;getOsInfo: () => { platform: string; arch: string; osVersion: string };+ /** 返回 /issue 所在轮开始时冻结的 Cindy 模型 ID;读取失败不得阻断反馈提交。 */+ getTurnModelId: (sessionId: string) => Promise<string | undefined>;/** 本构建的区域身份(构建期烘焙);同版本号的 cn / global 是两个不同的包。 */getRegion: () => CindyRegion;/** main 侧 OS locale,仅当 renderer 未回传 uiLanguage 时兜底。 */@@ -104,13 +112,32 @@ export interface GithubIssueSubmitServiceDeps {const SERVER_TITLE_MAX = 200;const SERVER_DESC_MAX = 5000;+/** Keep provider-controlled model IDs inert when they are appended to public GitHub Markdown. */+function markdownCodeSpan(value: string): string {+ let fence = '`';+ for (const match of value.matchAll(/`+/g)) {+ if (match[0].length >= fence.length) {+ fence = '`'.repeat(match[0].length + 1);+ }+ }+ return `${fence} ${value} ${fence}`;+}+export async function submitGithubIssueWithConfirm(deps: GithubIssueSubmitServiceDeps,req: SubmitIssueRequest,): Promise<GithubIssueSubmitResult> {+ let modelId = 'unknown';+ try {+ modelId = normalizeIssueModelId(await deps.getTurnModelId(req.sessionId)) ?? 'unknown';+ } catch {+ // Runtime metadata is supplemental. A failed local lookup must not block issue submission.+ }const env: IssueEnvInfo = {appVersion: deps.getAppVersion(),...deps.getOsInfo(),+ harness: issueHarnessForAgentKind(req.agentKind),+ modelId,region: deps.getRegion(),};@@ -172,6 +199,8 @@ export async function submitGithubIssueWithConfirm(// global 不写这一行 —— 缺失即默认区域,理由见 CINDY_REGION_CODE(与确认卡片同源)。...(regionCode ? [`**版本区域**: ${regionCode}`] : []),`**OS**: ${env.platform} ${env.arch} (${env.osVersion})`,+ `**Harness**: ${env.harness}`,+ `**Model ID**: ${markdownCodeSpan(env.modelId)}`,`**界面语言**: ${uiLanguage}`,].join('\n');// env 块必须完整保留,clamp 只裁用户正文部分。diff --git a/apps/desktop/src/main/github-issue/index.ts b/apps/desktop/src/main/github-issue/index.tsindex c9843d404f..24b959a0fc 100644--- a/apps/desktop/src/main/github-issue/index.ts+++ b/apps/desktop/src/main/github-issue/index.ts@@ -1,7 +1,7 @@/*** github-issue/index.ts —— module holder + 真实依赖接线。*- * register.ts 启动时调 initGithubIssueSubmit(bridge);mcp-providers.ts 通过+ * register.ts 启动时注入确认桥与本轮模型解析器;mcp-providers.ts 通过* submitGithubIssueForSession 给 cindy_helper 注入 githubIssue 回调* (deferred-lookup:holder 未就绪时返回 HOST_NOT_READY,模式同 OrcaCollabService)。*/@@ -38,9 +38,14 @@ export type { IssueConfirmDecision, IssueConfirmInteractionSnapshot } from './isconst log = createLogger('github-issue');let bridgeHolder: IssueConfirmBridge | null = null;+let getTurnModelIdHolder: ((sessionId: string) => Promise<string | undefined>) | null = null;-export function initGithubIssueSubmit(bridge: IssueConfirmBridge): void {+export function initGithubIssueSubmit(+ bridge: IssueConfirmBridge,+ getTurnModelId: (sessionId: string) => Promise<string | undefined>,+): void {bridgeHolder = bridge;+ getTurnModelIdHolder = getTurnModelId;}export async function submitGithubIssueForSession(@@ -54,7 +59,8 @@ export async function submitGithubIssueForSession(};}const bridge = bridgeHolder;- if (!bridge) {+ const getTurnModelId = getTurnModelIdHolder;+ if (!bridge || !getTurnModelId) {return {ok: false,errorCode: 'HOST_NOT_READY',@@ -93,6 +99,7 @@ export async function submitGithubIssueForSession(arch: process.arch,osVersion: os.release(),}),+ getTurnModelId,getRegion: () => CURRENT_CINDY_REGION,getFallbackLocale: () => app.getLocale(),getSubmitterName: getCurrentMembershipDisplayName,diff --git a/apps/desktop/src/main/github-issue/issueConfirmBridge.ts b/apps/desktop/src/main/github-issue/issueConfirmBridge.tsindex 846ad12599..966666642b 100644--- a/apps/desktop/src/main/github-issue/issueConfirmBridge.ts+++ b/apps/desktop/src/main/github-issue/issueConfirmBridge.ts@@ -20,6 +20,7 @@import type { CindyRegion } from '@cindy/maker-shared/brand-identity';import { normalizeIssuePublicName } from '../../shared/issuePublicName.js';+import type { IssueHarness } from '../../shared/issueRuntimeMetadata.js';import { createDesktopOnlyConfirmationRequestId } from '../cindy-brain/desktopOnlyConfirmationProjection.js';import { MAKER_PUSH } from '../maker-ipc/channels';import { HOST_CONFIRM_TIMEOUT_MS } from '../maker-ipc/hostConfirmTiming.js';@@ -36,6 +37,10 @@ export interface IssueEnvInfo {platform: string;arch: string;osVersion: string;+ /** 本次 /issue 工具调用所在的 Agent harness;使用公开全名,不使用内部缩写。 */+ harness: IssueHarness;+ /** /issue 所在轮开始时冻结的 Cindy 模型选择值。 */+ modelId: string;/*** 本构建的区域身份(中国版 / 国际版 / 开发版)。构建期烘焙、运行时不可切换,* 但同一个版本号在两区是两个不同的包——反馈里没有它就分不清用户装的是哪一个。diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 8a23f197f2..ce3626cd93 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -6001,7 +6001,9 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)});// submit_github_issue 工具的 main 侧提交服务(确认桥 → serverApiFetch)。- initGithubIssueSubmit(issueConfirmBridge);+ initGithubIssueSubmit(issueConfirmBridge, (sessionId) =>+ turnModelPromiseBySession.get(sessionId) ?? readSessionModelForUsage(sessionId),+ );initRenameSessionsConfirm(renameSessionsConfirmBridge);// ── newMakerDraft 缓存同步 ──────────────────────────────────────────────diff --git a/apps/desktop/src/renderer/__tests__/issueConfirmPayload.test.ts b/apps/desktop/src/renderer/__tests__/issueConfirmPayload.test.tsindex 32a71bf8c5..d4ca7eccfb 100644--- a/apps/desktop/src/renderer/__tests__/issueConfirmPayload.test.ts+++ b/apps/desktop/src/renderer/__tests__/issueConfirmPayload.test.ts@@ -1,12 +1,32 @@import { describe, expect, it } from 'vitest';import {+ parseIssueEnvHarness,+ parseIssueEnvModelId,parseIssueEnvRegion,parseOptionalGithubUserIdentity,parseIssueSuggestedPublicName,parseIssueSubmissionIdentity,} from '@/lib/issueConfirmPayload';+describe('issue runtime metadata parsers', () => {+ it('只接受三个公开 Harness 全名', () => {+ expect(parseIssueEnvHarness('Claude Code')).toBe('Claude Code');+ expect(parseIssueEnvHarness('Codex')).toBe('Codex');+ expect(parseIssueEnvHarness('Pi')).toBe('Pi');+ expect(parseIssueEnvHarness('cc')).toBeUndefined();+ expect(parseIssueEnvHarness('cx')).toBeUndefined();+ expect(parseIssueEnvHarness(undefined)).toBeUndefined();+ });++ it('把模型 ID 规范成有界单行值并兼容旧 Main 缺失字段', () => {+ expect(parseIssueEnvModelId(' custom\nmodel ')).toBe('custom model');+ expect(parseIssueEnvModelId('x'.repeat(201))).toBe('x'.repeat(200));+ expect(parseIssueEnvModelId('')).toBeUndefined();+ expect(parseIssueEnvModelId(undefined)).toBeUndefined();+ });+});+describe('parseIssueSubmissionIdentity', () => {it('保留 GitHub 用户和平台的实际 login', () => {expect(parseIssueSubmissionIdentity({ kind: 'github-user', login: ' octocat ' })).toEqual({diff --git a/apps/desktop/src/renderer/features/cc-agent/IssueConfirmCard.tsx b/apps/desktop/src/renderer/features/cc-agent/IssueConfirmCard.tsxindex 43d5cea656..2e11c418cc 100644--- a/apps/desktop/src/renderer/features/cc-agent/IssueConfirmCard.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/IssueConfirmCard.tsx@@ -361,9 +361,18 @@ export function IssueConfirmCard({ sessionId, pending, onRespond }: IssueConfirmappVersion: pending.env.appVersion,platform: pending.env.platform,arch: pending.env.arch,+ osVersion: pending.env.osVersion,uiLanguage: i18n.language,})}</p>+ {pending.env.harness && pending.env.modelId && (+ <p className="mt-1 [overflow-wrap:anywhere] text-12 leading-tight text-[var(--status-bar-meta)]">+ {t('issueAgent.confirm.runtimeLine', {+ harness: pending.env.harness,+ modelId: pending.env.modelId,+ })}+ </p>+ )}<label className="mt-3 flex cursor-pointer items-start gap-2 text-12 leading-snug text-[var(--chat-input-text)]"><inputdiff --git a/apps/desktop/src/renderer/features/cc-agent/__tests__/IssueConfirmCard.test.tsx b/apps/desktop/src/renderer/features/cc-agent/__tests__/IssueConfirmCard.test.tsxindex cd218e4ab7..31e2235410 100644--- a/apps/desktop/src/renderer/features/cc-agent/__tests__/IssueConfirmCard.test.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/__tests__/IssueConfirmCard.test.tsx@@ -8,9 +8,13 @@ import { IssueConfirmCard } from '../IssueConfirmCard';import { clearIssueConfirmDraftsForSession } from '@/lib/issueConfirmDraftStore';import type { PendingIssueConfirm } from '@/lib/makerChatStore';+const { tMock } = vi.hoisted(() => ({+ tMock: vi.fn((key: string) => key),+}));+vi.mock('react-i18next', () => ({useTranslation: () => ({- t: (key: string) => key,+ t: tMock,i18n: { language: 'zh-CN' },}),}));@@ -27,6 +31,8 @@ const initialPending: PendingIssueConfirm = {platform: 'win32',arch: 'x64',osVersion: '10.0',+ harness: 'Codex',+ modelId: 'gpt-5.6',},submissionIdentity: {kind: 'platform',@@ -70,10 +76,53 @@ function confirmPublicContent() {afterEach(() => {cleanup();+ tMock.mockClear();clearIssueConfirmDraftsForSession('session-a');clearIssueConfirmDraftsForSession('session-b');});+describe('IssueConfirmCard environment metadata', () => {+ it('把完整 OS 版本、Harness 和 Model ID 交给确认卡文案', () => {+ render(<IssueConfirmCard sessionId="session-a" pending={initialPending} onRespond={vi.fn()} />);++ expect(tMock).toHaveBeenCalledWith('issueAgent.confirm.envLine', {+ appVersion: '0.1.18',+ platform: 'win32',+ arch: 'x64',+ osVersion: '10.0',+ uiLanguage: 'zh-CN',+ });+ expect(tMock).toHaveBeenCalledWith('issueAgent.confirm.runtimeLine', {+ harness: 'Codex',+ modelId: 'gpt-5.6',+ });+ expect(screen.getByText('issueAgent.confirm.runtimeLine').className).toContain(+ '[overflow-wrap:anywhere]',+ );+ });++ it('兼容旧 Main 未提供 runtime metadata 的确认卡', () => {+ render(+ <IssueConfirmCard+ sessionId="session-a"+ pending={{+ ...initialPending,+ requestId: 'issue-request-old-main',+ env: {+ appVersion: '0.1.18',+ platform: 'win32',+ arch: 'x64',+ osVersion: '10.0',+ },+ }}+ onRespond={vi.fn()}+ />,+ );++ expect(tMock).not.toHaveBeenCalledWith('issueAgent.confirm.runtimeLine', expect.anything());+ });+});+describe('IssueConfirmCard draft persistence', () => {it('restores title, body and type after a session-switch remount', () => {render(<Harness />);diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 7f5d7ffa4f..f683af6a95 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -9596,7 +9596,8 @@"publicNameHint": "This attribution will appear publicly in the Issue body","anonymous": "Anonymous","useAnonymous": "Use Anonymous Attribution",- "envLine": "Attached automatically on submit: client {{appVersion}} · {{platform}} {{arch}} · UI language {{uiLanguage}}",+ "envLine": "Attached automatically on submit: client {{appVersion}} · {{platform}} {{arch}} ({{osVersion}}) · UI language {{uiLanguage}}",+ "runtimeLine": "Harness {{harness}} · Model ID {{modelId}}","regionLine": "Build region: {{region}}","regionCodeCn": "CN","regionCodeDev": "Dev",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 1ddd20592c..0ab0a35133 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -9583,7 +9583,8 @@"publicNameHint": "この署名は Issue 本文に公開表示されます","anonymous": "匿名","useAnonymous": "匿名の署名を使用",- "envLine": "送信時に自動で付加されます:クライアント {{appVersion}} · {{platform}} {{arch}} · 表示言語 {{uiLanguage}}",+ "envLine": "送信時に自動で付加されます:クライアント {{appVersion}} · {{platform}} {{arch}}({{osVersion}})· 表示言語 {{uiLanguage}}",+ "runtimeLine": "Harness {{harness}} · Model ID {{modelId}}","regionLine": "リージョン:{{region}}","regionCodeCn": "CN","regionCodeDev": "Dev",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex 54eeffb28f..6062ecc580 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -9583,7 +9583,8 @@"publicNameHint": "이 서명은 Issue 본문에 공개적으로 표시됩니다","anonymous": "익명","useAnonymous": "익명 서명 사용",- "envLine": "제출 시 자동으로 첨부됩니다: 클라이언트 {{appVersion}} · {{platform}} {{arch}} · 표시 언어 {{uiLanguage}}",+ "envLine": "제출 시 자동으로 첨부됩니다: 클라이언트 {{appVersion}} · {{platform}} {{arch}}({{osVersion}}) · 표시 언어 {{uiLanguage}}",+ "runtimeLine": "Harness {{harness}} · Model ID {{modelId}}","regionLine": "지역: {{region}}","regionCodeCn": "CN","regionCodeDev": "Dev",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 757c3e37b6..81b8f9f81d 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -9575,7 +9575,8 @@"publicNameHint": "该署名会公开显示在 Issue 正文中","anonymous": "匿名","useAnonymous": "使用匿名署名",- "envLine": "提交时将自动附加:客户端 {{appVersion}} · {{platform}} {{arch}} · 界面语言 {{uiLanguage}}",+ "envLine": "提交时将自动附加:客户端 {{appVersion}} · {{platform}} {{arch}}({{osVersion}})· 界面语言 {{uiLanguage}}",+ "runtimeLine": "Harness {{harness}} · Model ID {{modelId}}","regionLine": "版本区域:{{region}}","regionCodeCn": "CN","regionCodeDev": "Dev",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 2ce1dd20e7..27b2406170 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -9575,7 +9575,8 @@"publicNameHint": "該署名會公開顯示在 Issue 正文中","anonymous": "匿名","useAnonymous": "使用匿名署名",- "envLine": "提交時將自動附加:客戶端 {{appVersion}} · {{platform}} {{arch}} · 介面語言 {{uiLanguage}}",+ "envLine": "提交時將自動附加:客戶端 {{appVersion}} · {{platform}} {{arch}}({{osVersion}})· 介面語言 {{uiLanguage}}",+ "runtimeLine": "Harness {{harness}} · Model ID {{modelId}}","regionLine": "版本區域:{{region}}","regionCodeCn": "CN","regionCodeDev": "Dev",diff --git a/apps/desktop/src/renderer/lib/issueConfirmPayload.ts b/apps/desktop/src/renderer/lib/issueConfirmPayload.tsindex 0e4d4dfc08..49bc5d609c 100644--- a/apps/desktop/src/renderer/lib/issueConfirmPayload.ts+++ b/apps/desktop/src/renderer/lib/issueConfirmPayload.ts@@ -1,5 +1,10 @@import type { CindyRegion } from '@cindy/maker-shared/brand-identity';import { normalizeIssuePublicName } from '../../shared/issuePublicName';+import {+ normalizeIssueModelId,+ parseIssueHarness,+ type IssueHarness,+} from '../../shared/issueRuntimeMetadata';/*** issue_confirm IPC 里的构建区域。非法或缺失一律返回 undefined —— 确认卡片宁可@@ -14,6 +19,16 @@ export function parseIssueEnvRegion(raw: unknown): CindyRegion | undefined {return raw === 'cn' || raw === 'global' || raw === 'dev' ? raw : undefined;}+/** issue_confirm IPC 里的公开 Harness 名称;内部缩写或未知值一律不展示。 */+export function parseIssueEnvHarness(raw: unknown): IssueHarness | undefined {+ return parseIssueHarness(raw);+}++/** 与 Main 使用同一规范化函数,保证确认卡展示的值可安全落入单行 Markdown。 */+export function parseIssueEnvModelId(raw: unknown): string | undefined {+ return normalizeIssueModelId(raw);+}+/** issue_confirm IPC 中可由用户在确认卡选择的实际提交身份。 */export type IssueSubmissionIdentity ={ kind: 'github-user'; login: string } | { kind: 'platform'; login: string };diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.tsindex 5bbdfe2e01..694ea342ff 100644--- a/apps/desktop/src/renderer/lib/makerChatStore.ts+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts@@ -143,12 +143,15 @@ import {} from '@/lib/remoteDataOwnerPushFence';import { buildUserMessageAttachmentPayload } from '@/lib/messageAttachmentPayload';import {+ parseIssueEnvHarness,+ parseIssueEnvModelId,parseIssueEnvRegion,parseOptionalGithubUserIdentity,parseIssueSuggestedPublicName,parseIssueSubmissionIdentity,type IssueSubmissionIdentity,} from '@/lib/issueConfirmPayload';+import type { IssueHarness } from '../../shared/issueRuntimeMetadata';import { resolveStaleCodexSubscriptionValueEstimate } from '../../shared/codexSubscriptionValue';import { normalizeTurnUsageDetails, type TurnUsageDetails } from '../../shared/turnUsageDetails';import {@@ -779,6 +782,8 @@ export interface PendingIssueConfirm {platform: string;arch: string;osVersion: string;+ harness?: IssueHarness;+ modelId?: string;region?: CindyRegion;};/**@@ -7470,11 +7475,16 @@ function initGlobalListeners(options: GlobalListenerOptions = {}): void {// ephemeral 卡片(同 permission 语义,无 persistId 不落库),直接写 state,// 不走 handleStreamEvent —— 它不属于 agent 事件流。const draft = request.draft as PendingIssueConfirm['draft'] | undefined;- // region 必须先 Omit 掉再重建成 unknown:交叉类型做不到这件事+ // 公开 runtime metadata 必须先 Omit 掉再重建成 unknown:交叉类型做不到这件事// (`CindyRegion & unknown` 仍是 `CindyRegion`),那样写会让 TS 以为 IPC 传来的// region 已经是合法值,下面的白名单校验看着像在校验、实际没有类型层面的约束。const rawEnv = request.env as- (Omit<PendingIssueConfirm['env'], 'region'> & { region?: unknown }) | undefined;+ | (Omit<PendingIssueConfirm['env'], 'region' | 'harness' | 'modelId'> & {+ region?: unknown;+ harness?: unknown;+ modelId?: unknown;+ })+ | undefined;const submissionIdentity = parseIssueSubmissionIdentity(request.submissionIdentity);if (!draft || !rawEnv || !submissionIdentity) return;// 新版 Main:平台默认 + 可选 GitHub 身份。旧版 Main:只传已经固定的单一@@ -7487,8 +7497,13 @@ function initGlobalListeners(options: GlobalListenerOptions = {}): void {submissionIdentity.kind === 'platform'? parseIssueSuggestedPublicName(request.suggestedPublicName): undefined;- // region 过一遍白名单:非法值宁可不展示区域,也不能把 CN 版说成默认版。- const env = { ...rawEnv, region: parseIssueEnvRegion(rawEnv.region) };+ // IPC 值过白名单/单行化:非法值宁可不展示,也不能污染公开确认内容。+ const env = {+ ...rawEnv,+ region: parseIssueEnvRegion(rawEnv.region),+ harness: parseIssueEnvHarness(rawEnv.harness),+ modelId: parseIssueEnvModelId(rawEnv.modelId),+ };setState(sessionId, (s) => ({...s,pendingIssueConfirm: {diff --git a/apps/desktop/src/shared/issueRuntimeMetadata.ts b/apps/desktop/src/shared/issueRuntimeMetadata.tsnew file mode 100644index 0000000000..4953d299d0--- /dev/null+++ b/apps/desktop/src/shared/issueRuntimeMetadata.ts@@ -0,0 +1,26 @@+export type IssueAgentKind = 'claude-code' | 'codex' | 'pi';++export type IssueHarness = 'Claude Code' | 'Codex' | 'Pi';++const ISSUE_HARNESS_BY_AGENT_KIND: Record<IssueAgentKind, IssueHarness> = {+ 'claude-code': 'Claude Code',+ codex: 'Codex',+ pi: 'Pi',+};++export const ISSUE_MODEL_ID_MAX = 200;++export function issueHarnessForAgentKind(agentKind: IssueAgentKind): IssueHarness {+ return ISSUE_HARNESS_BY_AGENT_KIND[agentKind];+}++export function parseIssueHarness(value: unknown): IssueHarness | undefined {+ return value === 'Claude Code' || value === 'Codex' || value === 'Pi' ? value : undefined;+}++/** Keep a custom model ID safe for a single Markdown environment line and the confirmation UI. */+export function normalizeIssueModelId(value: unknown): string | undefined {+ if (typeof value !== 'string') return undefined;+ const normalized = value.trim().replace(/\s+/g, ' ').slice(0, ISSUE_MODEL_ID_MAX).trim();+ return normalized || undefined;+}diff --git a/i18n/GLOSSARY.md b/i18n/GLOSSARY.mdindex 566d2b81c2..ac8e125936 100644--- a/i18n/GLOSSARY.md+++ b/i18n/GLOSSARY.md@@ -227,6 +227,10 @@ OAuth 2.0 Device Authorization Grant 中由用户在另一设备验证页输入设备间数据在发送端加密、接收端解密,中转服务只搬运密文。当前先按四语言常用安全术语登记为待讨论,避免 E2EE、端对端加密、End-to-End 暗号化等多套可见说法并存。+### Harness++用户确认并公开提交 Issue 时显示承载当前 Agent 的运行框架。五语暂统一保留英文 Harness;具体值固定使用 Claude Code、Codex、Pi 的公开全名,不使用 cc/cx/pi 等内部缩写。+### iOS SimulatorApple Simulator 与 Cindy 内置查看器能力的用户可见名称。iOS 保留官方大小写;中文使用「模拟器」,日语使用「シミュレータ」,韩语使用「시뮬레이터」。先登记为 proposed,待插件与内置面板文案稳定后固化。@@ -267,6 +271,10 @@ issue #882:模型管理/新对话选择器的分类标签,对应 Gateway modissue #882:模型管理/新对话选择器的分类标签,对应 Gateway mode=audio_speech 的语音合成模型(如 elevenlabs/eleven_v3)。原先与语音转写、实时音频混在一个笼统的「音频语音」分类里,本次拆分为独立类型。+### Model ID++用户确认并公开提交 Issue 时展示本轮在 Cindy 中冻结的模型标识。五语暂统一保留技术名称 Model ID,避免与可翻译的模型显示名混淆。+### Not signed in跳过登录后应用内的账号状态名(侧边栏账号胶囊、设置页资料卡、语音服务提示,以及 main 侧不走 locale 的 model-visible 文案——已知 mcp-integrations/ghost.ts 的 GHOST_NOT_FOUND tool result,它会被模型读到并可能回显进对话,#907 review 补上)。**约束范围不限于 locale JSON**:guard 只扫 locale 文件,这类硬编码文案要人工找(见 engineering-conventions §5.1「Slack / IM 侧的文案不在任何 locale 文件里」同类问题)。2026-07-29 产品口径:面向用户只说「未登录」,不再叫「本地模式」——后者听起来像另一种服务端连接方式,实际只是没有登录 Cindy 账号。「本地」仅用于描述数据落在本机(如资料卡副文案「数据仅保存在本机」),不作为状态名。代码内部标识(AuthState mode='local'、authEnterLocal IPC、data owner)不受本条约束,仍用 local。en 侧统一走 not signed in 一种说法(含 settings.userProfile.local 的 exit / exitFailed 两条当前无引用的文案:the not-signed-in state),不与 unauthenticated 混用——PR #907 review 指出过同一状态两种英文说法会让日后启用这些文案时 UI 自相矛盾。status 仍为 proposed:Not signed in 作为状态名尚未与设计侧正式过一遍。diff --git a/i18n/glossary.json b/i18n/glossary.jsonindex f78315564d..a97bc18fc8 100644--- a/i18n/glossary.json+++ b/i18n/glossary.json@@ -13,6 +13,30 @@"desktop:settings.help.qnaFeedbackBodyTemplate"],"terms": [+ {+ "id": "harness",+ "status": "proposed",+ "en": "Harness",+ "translations": {+ "zh-CN": "Harness",+ "zh-TW": "Harness",+ "ja": "Harness",+ "ko": "Harness"+ },+ "note": "用户确认并公开提交 Issue 时显示承载当前 Agent 的运行框架。五语暂统一保留英文 Harness;具体值固定使用 Claude Code、Codex、Pi 的公开全名,不使用 cc/cx/pi 等内部缩写。"+ },+ {+ "id": "model-id",+ "status": "proposed",+ "en": "Model ID",+ "translations": {+ "zh-CN": "Model ID",+ "zh-TW": "Model ID",+ "ja": "Model ID",+ "ko": "Model ID"+ },+ "note": "用户确认并公开提交 Issue 时展示本轮在 Cindy 中冻结的模型标识。五语暂统一保留技术名称 Model ID,避免与可翻译的模型显示名混淆。"+ },{"id": "plugin-main-view","status": "proposed",diff --git a/packages/lizi-mcps/src/__tests__/submitGithubIssueTool.test.ts b/packages/lizi-mcps/src/__tests__/submitGithubIssueTool.test.tsindex fd31c9a6dc..daefaa1ba4 100644--- a/packages/lizi-mcps/src/__tests__/submitGithubIssueTool.test.ts+++ b/packages/lizi-mcps/src/__tests__/submitGithubIssueTool.test.ts@@ -101,6 +101,7 @@ describe('submit_github_issue tool', () => {});expect(submit).toHaveBeenCalledWith({sessionId: 'sess-1',+ agentKind: 'claude-code',workingDir: '/tmp/wd',title: VALID_ARGS.title,body: VALID_ARGS.body,diff --git a/packages/lizi-mcps/src/xdt-helper/submit_github_issue.ts b/packages/lizi-mcps/src/xdt-helper/submit_github_issue.tsindex a519ac199c..4f02850c99 100644--- a/packages/lizi-mcps/src/xdt-helper/submit_github_issue.ts+++ b/packages/lizi-mcps/src/xdt-helper/submit_github_issue.ts@@ -7,8 +7,9 @@* - agent 初稿进入确认卡前会做高置信度隐私脱敏;确认卡仍展示最终公开内容,* 用户编辑后的内容视为用户明确确认。* - host 在确认前确定并展示真实提交身份;确认后失败也不会静默切换身份。- * - 环境信息(客户端版本 / 版本区域 / OS / 界面语言)由 host 自动附加,agent 无法也- * 无需填写。版本区域(CN / Dev;默认 global 不标注)是构建期身份,agent 更猜不到。+ * - 环境信息(客户端版本 / 版本区域 / OS / Harness / 模型 ID / 界面语言)由 host 自动+ * 附加,agent 无法也无需填写。版本区域(CN / Dev;默认 global 不标注)是构建期身份,+ * agent 更猜不到。* - 成功返回 issue 链接及开源协作提示,让 agent 可以继续帮助用户从源码参与修复。* 本文件只承载工具 schema + 描述(对 LLM 的流程指引)和 host 回调的 payload 整形。*/@@ -59,6 +60,7 @@ export interface SubmitGithubIssueDeps {/** host 回调:弹确认卡片 → 用户确认后提交到 server。 */submit: (req: {sessionId: string;+ agentKind: 'claude-code' | 'codex' | 'pi';workingDir: string;title: string;body: string;@@ -74,7 +76,7 @@ const DESCRIPTION = ['3) 本工具被调用后会在 App 内弹出系统确认卡片,用户可以编辑标题/正文并确认或取消;最终提交内容以用户确认的版本为准(返回的 final_title 可能与你传入的不同)。确认前不得创建 issue。','4) Cindy 官方 Bot 是默认且始终可用的提交身份,不要求用户安装插件或配置 GitHub。仅当系统实时验证到可用的 Cindy GitHub 账号时,确认卡才额外提供“用本人账号提交”的选项(受其 token 仓库权限约束)。用户确认身份后,提交失败不会静默切换身份。','5) errorCode 语义: USER_CANCELLED = 用户主动取消了本次提交,如实告知即可,不要换参数自动重试; CONFIRM_TIMEOUT = 确认卡片超时无人响应(用户可能不在电脑前),告知用户可以再说一声重新发起; AUTH_NOT_READY / NETWORK_ERROR / SERVER_ERROR / HOST_NOT_READY = 提交失败,如实转告原因,不存在任何绕过确认、权限或失败的提交途径。',- '6) 环境信息(客户端版本 / 版本区域 / OS / 界面语言)由系统自动附加;GitHub 作者就是确认卡片显示的身份——都无需也无法由你填写。版本区域是用户装的哪个区域构建(CN / Dev,默认的 global 构建不标注),构建期烘焙,你猜不到也不要写。',+ '6) 环境信息(客户端版本 / 版本区域 / OS / Harness / 模型 ID / 界面语言)由系统自动附加;GitHub 作者就是确认卡片显示的身份——都无需也无法由你填写。版本区域是用户装的哪个区域构建(CN / Dev,默认的 global 构建不标注),构建期烘焙,你猜不到也不要写。',`7) 提交成功后告诉用户 issue 编号和链接,说明 ${BRAND_NAME} 是开源软件,并询问用户是否愿意继续参与:可以协助其通过源码复现、修复 Bug、开发功能、补测试并准备 PR。`,].join('\n');@@ -86,7 +88,7 @@ const D_BODY ='Markdown 正文。bug 优先用「## 现象 / ## 复现步骤 / ## 期望行为 / ## 实际行为 / ## 复现频率 / ## 已尝试」结构;' +'feature 优先用「## 使用场景 / ## 当前痛点 / ## 诉求 / ## 建议方案」结构,信息来自与用户的对话。' +'默认概括并泛化用户原话、真实场景和示例,不要逐字复制可识别的私人或业务内容。诊断信息只放用户同意公开的、经过脱敏的摘要;缺失信息写“用户未知”或省略,不要编造。' +- '不要写环境信息(客户端版本 / 版本区域 / OS / 界面语言)和提交人——系统会自动附加。';+ '不要写环境信息(客户端版本 / 版本区域 / OS / Harness / 模型 ID / 界面语言)和提交人——系统会自动附加。';const D_TYPE = 'bug=缺陷, feature=功能建议。决定 GitHub label。';@@ -121,6 +123,7 @@ export function registerSubmitGithubIssueTool(const result = await deps.submit({sessionId: ctx.sessionId,+ agentKind: ctx.agentKind,workingDir: ctx.workingDir,title: title.trim(),body: body.trim(),diff --git a/packages/maker-shared/src/__tests__/interaction.test.ts b/packages/maker-shared/src/__tests__/interaction.test.tsindex 1d4d5ce038..6a08341730 100644--- a/packages/maker-shared/src/__tests__/interaction.test.ts+++ b/packages/maker-shared/src/__tests__/interaction.test.ts@@ -258,12 +258,14 @@ describe('interaction shared model', () => {platform: 'darwin',arch: 'arm64',osVersion: 'fixture',+ harness: 'Pi',+ modelId: 'claude-sonnet-4-5',},uiLanguage: 'zh-CN',})).toEqual({bodyCharCount: 45,canSubmit: true,- envLabel: '0.0.0-mobile-e2e / darwin / arm64 / fixture / zh-CN',+ envLabel: '0.0.0-mobile-e2e / darwin / arm64 / fixture / Pi / claude-sonnet-4-5 / zh-CN',issueTypeLabel: 'Bug',summary: {title: '草稿完整,可以确认提交',@@ -529,12 +531,24 @@ describe('interaction shared model', () => {kind: 'issue_confirm',requestId: 'i1',draft: { title: 'Bug', body: 'Steps', type: 'bug' },- env: { appVersion: '0.1.0', platform: 'darwin', arch: 'arm64' },+ env: {+ appVersion: '0.1.0',+ platform: 'darwin',+ arch: 'arm64',+ harness: 'Claude Code',+ modelId: ' custom\nmodel ',+ },});expect(payload).toMatchObject({draft: { title: 'Bug', body: 'Steps', type: 'bug' },- env: { appVersion: '0.1.0', platform: 'darwin', arch: 'arm64' },+ env: {+ appVersion: '0.1.0',+ platform: 'darwin',+ arch: 'arm64',+ harness: 'Claude Code',+ modelId: 'custom model',+ },});expect(buildIssueConfirmDecision(true, payload!.draft, 'zh-CN')).toEqual({confirmed: true,diff --git a/packages/maker-shared/src/interaction.ts b/packages/maker-shared/src/interaction.tsindex be273959a9..5ded3f4b20 100644--- a/packages/maker-shared/src/interaction.ts+++ b/packages/maker-shared/src/interaction.ts@@ -29,6 +29,8 @@ export interface IssueEnv {platform: string;arch: string;osVersion?: string;+ harness?: 'Claude Code' | 'Codex' | 'Pi';+ modelId?: string;}export interface IssueConfirmPayload {@@ -354,6 +356,8 @@ export function buildIssueConfirmReviewPresentation(input: {input.env.platform,input.env.arch,input.env.osVersion,+ input.env.harness,+ input.env.modelId,input.uiLanguage,].filter((part): part is string => typeof part === 'string' && part.trim().length > 0);@@ -1065,10 +1069,22 @@ export function normalizeIssueConfirm(request: InteractionRequestLike): IssueConplatform: readString(env.platform) ?? 'unknown',arch: readString(env.arch) ?? 'unknown',osVersion: readString(env.osVersion) ?? undefined,+ harness: readIssueHarness(env.harness),+ modelId: normalizeIssueModelId(env.modelId),},};}+function readIssueHarness(value: unknown): IssueEnv['harness'] {+ return value === 'Claude Code' || value === 'Codex' || value === 'Pi' ? value : undefined;+}++function normalizeIssueModelId(value: unknown): string | undefined {+ if (typeof value !== 'string') return undefined;+ const normalized = value.trim().replace(/\s+/g, ' ').slice(0, 200).trim();+ return normalized || undefined;+}+export function buildIssueConfirmDecision(confirmed: true,draft: IssueDraft,