Repository navigation
feat(chat): refresh workspace repository context on demand - #1096
Conversation
Robert0622
left a comment
There was a problem hiding this comment.
用本提交生成的仓库清单和同一真实 CodeBuddy iOA 会话跑了三轮 DeepSeek V4.1 Flash。首次读取、续接时从历史读取、更新后读取新分支均通过,三次输入中的清单块数分别为 1、0、1。另用本地测试项目验证了大清单的 CLI 启动路径,发现以下问题。
| // The journal's catalogue is uncertain until the phase completes. | ||
| workspaceRepositoryHash = "" | ||
| } | ||
| prompt = assistantWorkspaceSystemPrompt + "\n审批模式:" + approvalMode + "。\n" + repositoryPrompt + prompt |
There was a problem hiding this comment.
[P2] 完整清单拼进 prompt 后,仍用单个 argv 参数传递提示词的 CLI 会在 Linux 上启动失败。本地用 1,000 个普通仓库记录生成了 187,071 字节的清单,即使用户只问当前分支,Cursor、Pi、Antigravity 的实际命令构造器都产生了约 190 KB 的单参数。把可执行文件换成 /usr/bin/true 验证,三个调用都在进入 CLI 之前返回 E2BIG。建议按 CLI 能力使用标准输入,或让 CLI 从工作区内的清单文件读取完整内容,并覆盖刷新和重建路径。
| for _, r := range repositories { | ||
| r = domain.PublicRepository(r) | ||
| hint := workspaceRepositoryHint{ | ||
| ID: r.ID, Name: r.Name, CloneURL: r.CloneURL, DefaultBranch: strings.TrimSpace(r.DefaultBranch), |
There was a problem hiding this comment.
[P1] 请给模型清单中的仓库 URL 单独做脱敏。PublicRepository 清理的是 URL 的 userinfo,历史记录的签名查询参数仍可能随 CloneURL 进入原生会话历史,备用 WebURL 也经过同一路径。建议生成仅含必要组成部分的仓库地址,并覆盖这两个字段的脱敏测试。
Robert0622
left a comment
There was a problem hiding this comment.
上一轮的大清单和签名 URL 问题已修复。用 1000 个仓库构造 Cursor、Pi、agy 的实际命令参数,再以 /usr/bin/true 代替模型进程执行,三者均能启动,最长单个参数为 7609 字节。对同步后的 168000 字节 JSONL,用 CodeBuddy iOA 的 DeepSeek V4.1 Flash 在同一会话实测了首次进入、续聊、更新分支,三次均调用 Read 并答对目标分支。另有一处合法本地 Git 路径会在清单中被截断,见行内评论。
| // may have signed query strings or fragments in addition to URL userinfo. | ||
| func workspaceRepositoryURL(raw string) string { | ||
| base := strings.TrimSpace(raw) | ||
| if i := strings.IndexAny(base, "?#"); i >= 0 { |
There was a problem hiding this comment.
[P3] 保留本地 Git 路径中的字面 #
这里在判断地址类型前就截断 ? 和 #,会改写管理员可以登记的本地 Git 路径。我建了一个名为 billing#core.git 的裸仓库,通过 /api/repositories 登记返回 200,对登记的完整路径执行 git ls-remote 也成功。工作区清单给出的路径却只到 billing,同一条 Git 命令退出 128。建议只对有 URL 查询串或片段语义的地址清理这些部分,普通文件系统路径保留原样,并补一个带 # 的本地路径用例。
Robert0622
left a comment
There was a problem hiding this comment.
复审通过。使用管理员身份通过仓库 API 登记了三个真实的本地 Git 裸仓库,分别覆盖路径中的 #、? 和同时含两者的 file:// 地址。工作区清单保留了原地址,使用清单里的值执行 git ls-remote 均成功。网络 URL 清理和共享会话恢复的回归测试也通过。
用最新提交生成并同步 1000 项仓库清单后,又在同一个 CodeBuddy iOA 会话中实测了首次读取、续聊和更新分支。三次都只使用 DeepSeek V4.1 Flash,都实际调用 Read 并返回了目标仓库的正确分支。
What changed
Follow-up to #947. A conversation workspace gives its native CLI the current project's repository catalog, including repository IDs, names, credential-free clone URLs, and default branches.
#and?.Scope
Compatibility
The catalog fingerprint is stored in the local native-session metadata after the CLI phase completes successfully. Existing sessions establish it the first time they receive the catalog after upgrade.
Validation
go test -count=1 -timeout=5m ./internal/httpapipassed with a process-local Git configuration for the bare-repository test fixture. Focused workspace and native-session regression tests passed again after rebasing ontomain.python3 scripts/check-public.pyandgit diff --checkpassed.billing#core.gitpath on first entry and read the expected Git commit from the existing checkout in the same native session on resume.Safety