boardx / boardx/workspacex

URL 导入的 skill 用内部 id 当 stable_name,chat 阶段文案直接展示裸 uuid

Open
#2,945 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 现象(2026-09-07 人类实测,截图)

chat 面板执行阶段文案显示为:

> 正在执行技能脚本(sk_c8b0b9a3-ee21-43bf-a5c1-5017528dbd46)…

括号里的不是技能名,是技能的内部 id(`sk_`)。

## 根因

`apps/api/src/infrastructure/skill/pg-skill-url-import-repository.ts` 的 `persist()`
在 URL 导入 skill 时,把新生成的 `skillId`(`sk_`)同时写进 `stable_name` 列:

```ts
const skillId = `sk_${randomUUID()}`;
...
[skillId, input.orgId, skillId, input.name, input.actorId, now],
// ^^^^^^^ stable_name 列
```

而 `call_skill(skill_stable_name, task)` 工具调用把 `skill_stable_name` 原样传给模型,
前端 `apps/web/lib/agent-run-phase.ts` 的 `phaseLabelForCallSkillArgs` 又把它原样回显到
chat 阶段文案(这个设计是故意的:不额外维护一张 "stable_name → 人类可读名" 的第二张
表,前提是 `stable_name` 本身必须是人类可读的)。声明式创建路径(starter pack 导入,
`pg-skill-starter-import-repository.ts`)走的是 pack manifest 里的 slug(如
`pdf-create`),从未出现这个问题;只有 URL 导入这条姊妹路径把内部 id 当 `stable_name`
用。

## 修法

`persist()` 应该从 `input.name`(用户导入时填的展示名)派生一个可读的 `stable_name`,
而不是复用内部 id;同组织内 slug 撞车时追加数字后缀(`skills_stable_name_uniq` 是
`(org_id, stable_name)` 维度)。

Refs: chat 侧回显设计见 `apps/web/lib/agent-run-phase.ts` 文件头(issue #2321 round 3)。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in apps/api/src/infrastructure/skill/pg-skill-url-import-repository.ts, especially persist(), and compare its stable_name handling with pg-skill-starter-import-repository.ts. Check the skills_stable_name_uniq constraint and verify that URL-imported names are readable and receive numeric suffixes on same-organization collisions. Confirm the resulting chat label remains human-readable through apps/web/lib/agent-run-phase.ts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.