ns-execution-gitlab-issue
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExecute GitLab Issue
执行GitLab Issue
Entry priority 1 for GitLab . Owns GitLab issue state end to end — status, branch/worktree lifecycle, MR, comments, delivery, review gate. Delegates actual coding to the engine (Phase 2). Full routing: .
ISSUE_URLns-autonomous../../ns-harness/references/code-skill-routing.md针对GitLab 的入口优先级为1。全权负责GitLab issue的全生命周期状态——包括状态、分支/工作树生命周期、MR、评论、交付、审核校验。实际编码任务委托给引擎(第二阶段)。完整路由:。
ISSUE_URLns-autonomous../../ns-harness/references/code-skill-routing.mdRouting (read first)
路由(请先阅读)
Entry priority 1. Harness table: . Trigger phrases: .
../../ns-harness/references/code-skill-routing.mdreferences/entry-triggers.md| Handoff | Target |
|---|---|
| Phase 2 execution | |
| MR / status / time / comments | |
| Phase 4 review gate | |
| Rejected fix loop | |
GA入口优先级1。路由对照表:。触发短语:。
../../ns-harness/references/code-skill-routing.mdreferences/entry-triggers.md| 交接对象 | 目标 |
|---|---|
| 第二阶段执行 | |
| MR / 状态 / 时间 / 评论 | |
| 第四阶段审核校验 | |
| 修复循环驳回 | |
在交付完成前,始终是GitLab生命周期的唯一负责人。下的工作单元不得重新启动此技能。
GASession boot
会话启动
See . Complete Session boot (blocking) there before any MCP call. Read after Session boot.
../../ns-harness/references/session-boot.mdmcp-gitlab-usage详见。在调用任何MCP之前,必须完成会话启动(阻塞式)。会话启动后阅读文档。
../../ns-harness/references/session-boot.mdmcp-gitlab-usageInputs
输入参数
| Variable | Required |
|---|---|
| Yes |
| No — resolved by Gate 1 if omitted |
Single worktree, single branch, single MR, single commit per issue:
WORKTREE_ROOT = .worktrees/{ISSUE_ID}WORK_BRANCH = work/{ISSUE_ID}-{ISSUE_SLUG}
| 变量名 | 是否必填 |
|---|---|
| 是 |
| 否 — 若未填写则由第一阶段校验自动解析 |
每个issue对应单一工作树、单一分支、单一MR、单一提交:
WORKTREE_ROOT = .worktrees/{ISSUE_ID}WORK_BRANCH = work/{ISSUE_ID}-{ISSUE_SLUG}
Phase 0 — Context (boot before MCP)
第0阶段 — 上下文(调用MCP前启动)
- Session boot (blocking) — complete before any MCP call.
../../ns-harness/references/session-boot.md - Ensure is gitignored (see
.worktrees/).references/worktree-setup.md - Read before the first MCP call.
mcp-gitlab-usage
- 会话启动(阻塞式) — 在调用任何MCP之前,完成中的步骤。
../../ns-harness/references/session-boot.md - 确保已加入git忽略规则(详见
.worktrees/)。references/worktree-setup.md - 首次调用MCP前阅读文档。
mcp-gitlab-usage
Phase 1 — Prepare
第1阶段 — 准备
First act (mandatory, before any gate)
首要操作(必填,任何校验前执行)
Apply (Em andamento) to the issue via MCP. If this call fails, abort immediately and wait for human intervention — nothing below runs on an issue that isn't marked in progress.
status_in_progress通过MCP将issue状态设为(进行中)。若此调用失败,立即终止流程并等待人工干预——未标记为进行中的issue不得执行后续任何操作。
status_in_progressGate 0 — Existing branch/MR reuse
校验0 — 复用已有分支/MR
An issue may already have a work branch (e.g. returned by a human reviewer). Detect it before Gate 1 so you never open a duplicate branch/MR:
- — look for an open MR whose
list_issue_merge_requestsmatchessource_branch; record itswork/{ISSUE_ID}-*andsource_branch.target_branch - as a second signal.
git ls-remote --heads origin "work/{ISSUE_ID}-*" - Found → ,
REUSE_MODE = true,WORK_BRANCH = {existing branch}. SkipSOURCE_BRANCH = {existing MR target}derivation below and skip Gate 1 (only re-validate the branch still exists on the remote).WORK_BRANCH - Not found → , proceed to Gate 1.
REUSE_MODE = false
issue可能已存在工作分支(例如由人工审核者返回的分支)。在执行校验1前检测该分支,避免创建重复分支/MR:
- — 查找
list_issue_merge_requests匹配source_branch的开放MR;记录其work/{ISSUE_ID}-*和source_branch。target_branch - 执行作为二次验证。
git ls-remote --heads origin "work/{ISSUE_ID}-*" - 找到分支 → 设置,
REUSE_MODE = true,WORK_BRANCH = {existing branch}。跳过下方SOURCE_BRANCH = {existing MR target}推导步骤及校验1(仅需重新验证远程分支是否仍存在)。WORK_BRANCH - 未找到分支 → 设置,继续执行校验1。
REUSE_MODE = false
Gate 1 — SOURCE_BRANCH (mandatory, blocking; skipped when REUSE_MODE = true
)
REUSE_MODE = true校验1 — SOURCE_BRANCH(必填,阻塞式;REUSE_MODE = true
时跳过)
REUSE_MODE = trueResolve only via (priority order: human → issue text → product rule → milestone/version discovery → mandatory fallback).
SOURCE_BRANCHreferences/source-branch-resolution.mddevelop- Never infer from the current checkout or ad hoc heuristics.
- Never auto-use any branch except a discovered version-relative /
develop_*or thedevelop-*fallback — other bases (develop,homolog,release/*,main, etc.) require explicit human confirmation this run.master - /
mainare allowed asmasteronly with express human authorization this run — never auto; issue text naming them alone is not enough (ask once).SOURCE_BRANCH
After resolution, validate on the remote (fetch, , ↔ alternates) per the same reference. When the mandatory fallback is missing on the remote → abort with the exact error; ask the operator once.
ls-remote_-develop仅通过解析(优先级顺序:人工指定 → issue文本 → 产品规则 → 里程碑/版本发现 → 强制分支兜底)。
references/source-branch-resolution.mdSOURCE_BRANCHdevelop- 禁止从当前检出分支或临时启发式规则推导。
- 禁止自动使用除已发现的版本关联/
develop_*分支或develop-*兜底分支之外的任何分支——其他基准分支(develop、homolog、release/*、main等)需本次运行的明确人工确认。master - /
main仅在本次运行获得明确人工授权时才可作为master——禁止自动使用;仅issue文本提及不足以生效(需询问一次)。SOURCE_BRANCH
解析完成后,参照同一文档在远程仓库验证(拉取、、与替代规则)。若强制兜底的分支在远程不存在 → 终止流程并返回明确错误;询问操作者一次。
ls-remote_-developGate 1.5 — Single worktree (monorepo)
校验1.5 — 单一工作树(单体仓库)
Create per — always , never under . Abort if a worktree already exists for this and is in use by another run, unless this is an explicit resume. Never implement in the main checkout or on //. If fails → abort with the exact error (do not fall back to the main checkout "to keep going"). Isolation is a hard gate before Phase 2.
WORKTREE_ROOTreferences/worktree-setup.md.worktrees/{ISSUE_ID}.cursor/ISSUE_IDmainmasterSOURCE_BRANCHgit worktree add按照创建——固定为,禁止在下创建。若此对应的工作树已存在且被其他运行占用,除非是明确的恢复操作,否则终止流程。禁止在主检出分支或//上执行实现逻辑。若失败 → 终止流程并返回明确错误(不得回退到主检出分支继续执行)。隔离性是进入第二阶段前的硬性校验规则。
references/worktree-setup.mdWORKTREE_ROOT.worktrees/{ISSUE_ID}.cursor/ISSUE_IDmainmasterSOURCE_BRANCHgit worktree addMCP setup
MCP配置
- if empty: current date + 5 business days.
due_date - Do not set here — wall-clock for spent time starts at Phase 2 (see
START_TIME).references/time-tracking.md
- 若为空:设为当前日期 + 5个工作日。
due_date - 请勿在此处设置——耗时统计的实际开始时间为第二阶段(详见
START_TIME)。references/time-tracking.md
Phase 2 — Execution (delegated)
第2阶段 — 执行(委托式)
- Read the full issue payload via MCP (title, description, comments, attachments). Note for the estimate gate below.
time_stats.time_estimate - Set /
START_TIMEnow (UTC + Unix epoch) — immediately before the first Engine invoke. SeeSTART_EPOCH.references/time-tracking.md - Invoke the skill in Engine mode, passing: issue payload,
ns-autonomous,WORKTREE_ROOT,WORK_BRANCH. The engine self-decides planning depth, runs its doubt protocol, and dispatches implementation (single- or multi-agent) insideSOURCE_BRANCH— seeWORKTREE_ROOT'sns-autonomousfor what "Engine mode" means and what it returns.references/routing.md - Estimate (first invocation only): call only if
set_issue_estimateis empty (time_stats.time_estimate/ missing) and the engine returned0≥ 60. If an estimate already exists, or the engine value is < 60 — skip; never overwrite, never write a 1-second estimate. Full rules:estimate_seconds.references/time-tracking.md - Doubt escalation contract — the engine never mutates GitLab state itself. When it returns a destructive-doubt event instead of (or alongside) unit results:
- Record epoch (exclude wait from spent time).
PAUSE_START - Apply (Em Impedimento).
status_blocked - Post a comment mentioning the issue author (from
@{author.username}) with the questions, options, and recommended default.read_issue - Mirror the same question in the interactive chat and wait.
- On answer (chat and/or issue comment): add pause duration to , set status back to
PAUSED_SECONDS(Em andamento), and re-invoke the engine with the resolved doubt appended to its context.status_in_progress
- Record
- No intermediate confirmations otherwise — this loop is the only pause point until Phase 4's review gate.
- 通过MCP读取完整issue payload(标题、描述、评论、附件)。记录用于后续预估校验。
time_stats.time_estimate - 立即设置/
START_TIME(UTC + Unix时间戳)——就在首次调用引擎之前。详见START_EPOCH。references/time-tracking.md - 以引擎模式调用技能,传入:issue payload、
ns-autonomous、WORKTREE_ROOT、WORK_BRANCH。引擎将自行决定规划深度、执行疑问协议,并在SOURCE_BRANCH内调度实现逻辑(单代理或多代理)——详见WORKTREE_ROOT的ns-autonomous中关于“引擎模式”的定义及返回内容。references/routing.md - 预估(仅首次调用):仅当为空(
time_stats.time_estimate/缺失)且引擎返回的0≥60时,调用estimate_seconds。若已有预估,或引擎返回值<60 —— 跳过;禁止覆盖已有预估,禁止写入1秒预估。完整规则:set_issue_estimate。references/time-tracking.md - 疑问升级约定 — 引擎不得自行修改GitLab状态。当引擎返回破坏性疑问事件而非(或同时返回)单元结果时:
- 记录时间戳(暂停时间不计入耗时)。
PAUSE_START - 将状态设为(阻塞)。
status_blocked - 发布一条**@issue作者**的评论(从获取
read_issue),包含问题、选项及推荐默认值。@{author.username} - 在交互式聊天中同步相同问题并等待回复。
- 收到回复(聊天和/或issue评论)后:将暂停时长加入,将状态改回
PAUSED_SECONDS(进行中),并将已解决的疑问追加到上下文后重新调用引擎。status_in_progress
- 记录
- 除此循环外,无其他中间确认环节——直至第四阶段审核校验前均无暂停点。
Phase 3 — Delivery
第3阶段 — 交付
- Squash to one Conventional Commit before push (, types: feat/fix/refactor/test/docs/chore). The engine may leave internal checkpoint commits per work unit in the worktree during Phase 2 — squash them here to preserve one-commit-per-delivery atomicity. See
<type>(#{ISSUE_ID}): <imperative description in English>for attribution.../../ns-harness/references/agent-git-identity.md - Push .
WORK_BRANCH - Run Phase 4 (review gate). Do not set , spent time, or Dev 100% until Phase 4 returns
END_TIME.Approved - On only — close the clock and board (same instant):
Approved- Set /
END_TIMEnow.END_EPOCH - with
add_issue_spent_timefromduration = ELAPSED_SECONDS(epoch delta minusreferences/time-tracking.md). Never usePAUSED_SECONDSor any plan estimate asestimate_seconds.duration - Status → (Dev 100%).
status_done - Internal delivery comment () using
internal: true.references/delivery-report.template.md
- Set
- 合并为单一规范提交后再推送(格式:,类型包括:feat/fix/refactor/test/docs/chore)。引擎在第二阶段可能会在工作树中留下各工作单元的内部检查点提交——在此处合并这些提交,以保持“每次交付对应单一提交”的原子性。署名规则详见
<type>(#{ISSUE_ID}): <英文祈使句描述>。../../ns-harness/references/agent-git-identity.md - 推送。
WORK_BRANCH - 执行第四阶段(审核校验)。仅当第四阶段返回后,才可设置
Approved、耗时统计及标记Dev 100%完成。END_TIME - 仅在时——关闭计时与看板(同一时刻):
Approved- 立即设置/
END_TIME。END_EPOCH - 调用,传入
add_issue_spent_time(来自duration = ELAPSED_SECONDS,时间戳差值减去references/time-tracking.md)。禁止使用PAUSED_SECONDS或任何计划预估作为estimate_seconds。duration - 状态改为(开发完成100%)。
status_done - 使用发布内部交付评论(
references/delivery-report.template.md)。internal: true
- 立即设置
Phase 4 — Review gate (blocking, bounded fix loop)
第4阶段 — 审核校验(阻塞式,有限修复循环)
Canonical rules: .
../ns-reviewer/references/review-gate-workflow.md- MUST invoke when available (else
reviewer-agent) in Issue review mode (ns-reviewer) only — bridge/skill loadsISSUE_URLthen reviewer workflow. Read-only official gate; posts the internal GitLab comment. Forbidden: Task subagents (AGENTS.md,senior-tech-lead-reviewer,bugbot) or any substitute unless the human explicitly requests it for this run. Allowed: harnesssecurity-review. Seereviewer-agent.../../ns-harness/references/subagent-dispatch.md - Loop, max 3 rounds:
- → return to Phase 3 step 4 (END + spent + Dev 100% + delivery comment).
Approved - with rounds remaining → re-invoke
Rejected(same worktree/branch) with the findings as a fix work unit, then mandatory re-review vians-autonomous(MUST when available; elsereviewer-agent). Keep the originalns-reviewer; do not call spent/Dev 100% yet.START_TIME - , or rounds exhausted →
Blocked(Em Impedimento), post the findings, stop. Do not setstatus_blocked, spent time, or Dev 100%.END_TIME
- Final output: +
Fatto!+MR_URLS— exactly the verdict stringCode Review: {verdict}returned.ns-reviewer
标准规则:。
../ns-reviewer/references/review-gate-workflow.md- 必须调用**(若不可用则调用
reviewer-agent),且仅以Issue审核模式**(ns-reviewer)调用——桥接/技能将加载ISSUE_URL并执行审核流程。此为只读官方校验环节;将发布内部GitLab评论。禁止:调用任务子代理(AGENTS.md、senior-tech-lead-reviewer、bugbot)或任何替代工具,除非人工明确要求本次运行使用。允许:调用harness的security-review。详见reviewer-agent。../../ns-harness/references/subagent-dispatch.md - 循环最多3轮:
- → 返回第3阶段步骤4(结束计时 + 耗时统计 + Dev 100% + 交付评论)。
Approved - 且仍有剩余轮次 → 重新调用
Rejected(同一工作树/分支),将审核结果作为修复工作单元传入,然后必须再次通过ns-autonomous(可用时必须调用;否则调用reviewer-agent)进行重新审核。保留原始ns-reviewer;暂不调用耗时统计/标记Dev 100%。START_TIME - 或轮次耗尽 → 设置
Blocked(阻塞),发布审核结果,终止流程。禁止设置status_blocked、耗时统计及标记Dev 100%。END_TIME
- 最终输出:+
Fatto!+MR_URLS—— 完全使用Code Review: {verdict}返回的判定字符串。ns-reviewer
Stop and ask the human
终止流程并询问人工
| Condition | Action |
|---|---|
Gate 1: | Stop — ask once |
Gate 1: non-default base ( | Stop — ask once |
| Worktree conflict (same issue, another run) | Stop unless explicit resume |
| Ambiguous or conflicting acceptance criteria | Stop — ask once |
| MCP unavailable or auth failure | Stop — state blocker |
| Stop per |
Work on protected/base branch per | Stop |
| Destructive ops (issue delete, force-push main/master) | Stop — require explicit human |
| Product decision not stated in the issue | Stop — ask once |
| Engine reports a destructive doubt | Pause/resume per Phase 2 step 4 — not a hard stop |
See for MCP tool contracts and confirmation gates.
mcp-gitlab-usage| 条件 | 操作 |
|---|---|
校验1:远程仓库缺失 | 终止流程 — 询问一次 |
校验1:使用非默认基准分支( | 终止流程 — 询问一次 |
| 工作树冲突(同一issue被其他运行占用) | 终止流程,除非是明确的恢复操作 |
| 验收标准模糊或冲突 | 终止流程 — 询问一次 |
| MCP不可用或认证失败 | 终止流程 — 标记为阻塞 |
| 按照 |
在受保护/基准分支上操作(依据 | 终止流程 |
| 破坏性操作(删除issue、强制推送main/master) | 终止流程 — 需明确人工授权 |
| issue中未明确产品决策 | 终止流程 — 询问一次 |
| 引擎报告破坏性疑问 | 按照第2阶段步骤4暂停/恢复 — 并非硬性终止 |
MCP工具约定及确认校验规则详见。
mcp-gitlab-usageRelated skills
相关技能
| Skill | Role |
|---|---|
| All GitLab tools |
| Status label semantics |
| Phase 4 gate (MUST |
| Phase 2 execution engine |
| Non-GitLab ad-hoc implementation |
| 技能 | 角色 |
|---|---|
| 所有GitLab工具的操作入口 |
| 状态标签语义同步 |
| 第四阶段校验环节(可用时必须调用 |
| 第二阶段执行引擎 |
| 非GitLab场景的临时编码实现 |
References
参考文档
| File | When |
|---|---|
| Gate 1 — milestone/version discovery, |
| |
| MR title, draft, linking, reuse note |
| Phase 3 internal delivery comment |
| Estimate fill-if-empty; spent-time wall-clock + pause rules |
| 文件路径 | 使用场景 |
|---|---|
| 校验1 — 里程碑/版本发现、 |
| |
| MR标题、草稿状态、关联规则、复用说明 |
| 第3阶段内部交付评论模板 |
| 预估补全规则;耗时统计的时钟计时+暂停规则 |