Skip to content

docs(openspec): add-single-gpu-session-ai-review-mvp——單 GPU session 生命週期 + AI 審查草稿最小閉環規格提案(spec-only,8 項 OQ 待使用者裁決) - #377

Merged
monkey1sai merged 1 commit into
mainfrom
codex/openspec/add-single-gpu-session-ai-review-mvp
Jul 22, 2026
Merged

docs(openspec): add-single-gpu-session-ai-review-mvp——單 GPU session 生命週期 + AI 審查草稿最小閉環規格提案(spec-only,8 項 OQ 待使用者裁決)#377
monkey1sai merged 1 commit into
mainfrom
codex/openspec/add-single-gpu-session-ai-review-mvp

Conversation

@monkey1sai

@monkey1sai monkey1sai commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Change Classification

項目
Change lane F
Behavior contract changed no
Requirement source docs/plans(AI-BIM 前後端設計文件 §01–§08 A1–A4 藍圖)+使用者 2026-07-22 openspec-forge 明確指令(goal 原文入 proposal Why)

Why

openspec-forge workflow(七軸上網研究→三層交叉對抗驗證→五角度候選生成→十指標錦標賽→兩輪 grill-me 對抗詰問)對「A1–A4 整合 + 工作室 AI agent 自審自派 BCF + Kit 前期渲染/3D viewer/WebRTC 多人會議」目標的產出。使用者明示約束:排除工作室 agent 學習(非本 repo 範疇)、以穩定多 session/單 GPU 生命週期為首要、多 GPU 只留基礎能力。

錦標賽冠軍角度:MVP 優先(81.3/100,10 評審 × 10 指標),嫁接落選者亮點 43 條。

What(spec-only,零程式碼變更)

openspec/changes/add-single-gpu-session-ai-review-mvp/:proposal.md + design.md(8 個技術決策)+ tasks.md(9 phase)+ 6 份 delta spec。

6 新 capability / 22 requirements(皆 ADDED,與既有 archived specs 及 5 個 active change 無 capability 重疊):

capability 重點
session-lifecycle (7) SessionBroker:admission fail-closed、primary 佇列、spectator 分流、idle 綁 readyState=4、健康探針非 port-open、冷啟動 202、DTLS-SRTP 不降級、環境指紋 fail-loud
gpu-session-baseline (3) Phase 0 量測 harness=session-lifecycle 硬 gate(VRAM/TTFF/soak 記憶體斜率/SLO 數值化)
ai-review-draft-pipeline (3) IfcClash 規則審查(has_occ hard guard)、證據包 fail-closed ingest、draft gate(AI 無直建正式 issue)
issue-idempotency (4) 兩層 fingerprint、guid_churn_suspected 強制人審、parent/child 收斂、reopen-candidate
human-triage-queue (3) 批量 accept/reject/edit、單一寫入者+版本號 409、稽核 ledger
bcf-contract-export (2) BCF-API 3.0 JSON 匯出+官方 schema 驗證、IFC 4.3 pin

Validation

npx openspec validate add-single-gpu-session-ai-review-mvp --strict
Change 'add-single-gpu-session-ai-review-mvp' is valid

openspec CLI 1.6.0;openspec show --json deltaCount=22。

Known risks / 待裁決

  • grill-me 第 2 輪 6 題未解(OQ-1 GUID churn 資料模型、OQ-2 MVP 無 LLM 的 headline 落差、OQ-3 忘關分頁餓死、OQ-4 認領視窗 vs 冷啟動、OQ-5 soak 涵蓋不足、OQ-6 ledger 持久化)+ 2 項產品決策(OQ-A max-hold、OQ-B BCFzip),全數寫入 proposal.md「Open Questions」;tasks 0.1/0.2 為實作前收斂閘門,本 PR 僅合入規格文件,不代表核准實作
  • 純 openspec/** 文件變更,不觸碰凍結三檔與任何服務程式碼。

🤖 Generated with Claude Code

https://claude.ai/code/session_01U8BiTXJtW1jPYPEtPq27Cx

…命週期 + AI 審查草稿最小閉環規格提案(spec-only,8 項 OQ 待使用者裁決)

openspec-forge 七軸研究→三層對抗驗證→五候選錦標賽→兩輪 grill-me 產出。
6 新 capability / 22 requirements:session-lifecycle(SessionBroker admission/佇列/idle 回收/健康探針)、gpu-session-baseline(Phase 0 量測硬 gate)、ai-review-draft-pipeline(IfcClash 草稿管線)、issue-idempotency(兩層 fingerprint)、human-triage-queue(人審轉正)、bcf-contract-export(BCF-API 3.0)。
npx openspec validate --strict 通過;tasks 0.1/0.2 把 OQ-A/OQ-B 與 OQ-1~6 列為實作前收斂閘門。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8BiTXJtW1jPYPEtPq27Cx
Copilot AI review requested due to automatic review settings July 22, 2026 04:11
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds specifications and implementation tasks for a fingerprint-gated single-GPU session broker, deterministic IfcClash review drafts, human triage controls, issue idempotency, audit logging, and validated BCF-API 3.0 export.

Changes

Single-GPU AI Review MVP

Layer / File(s) Summary
Baseline gates and MVP architecture
openspec/changes/add-single-gpu-session-ai-review-mvp/design.md, proposal.md, specs/gpu-session-baseline/spec.md, tasks.md
Defines phased MVP scope, environment fingerprints, baseline measurements, SLO gates, service ownership, governance checks, and implementation prerequisites.
SessionBroker lifecycle and admission
openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md, tasks.md
Defines primary/spectator admission, queue and TTL behavior, health probing, recovery, idle teardown, cold-start polling, DTLS-SRTP enforcement, and startup fingerprint validation.
Deterministic review and finding identity
openspec/changes/add-single-gpu-session-ai-review-mvp/specs/ai-review-draft-pipeline/spec.md, specs/issue-idempotency/spec.md, tasks.md
Defines deterministic IfcClash checks, fail-closed evidence ingest, IFC coordinate tracking, draft-only outputs, two-layer fingerprinting, rerun handling, and calibration gates.
Human triage and BCF contract export
openspec/changes/add-single-gpu-session-ai-review-mvp/specs/human-triage-queue/spec.md, specs/bcf-contract-export/spec.md, tasks.md
Defines human-authoritative triage, serialized draft updates, optimistic conflicts, audit records, BCF-API 3.0 validation, IFC 4.3 pinning, and final end-to-end validation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the spec-only single-GPU session lifecycle and AI review MVP proposal, though it is verbose.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/openspec/add-single-gpu-session-ai-review-mvp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This is a spec-only OpenSpec change proposal (zero code changes) under openspec/changes/add-single-gpu-session-ai-review-mvp/. It documents an MVP scope for a single-GPU multi-session lifecycle manager (SessionBroker) plus a minimal "AI-drafts → human-triages-to-official-issue" review loop, layered additively on the existing A1–A4 closed loop without touching the three frozen files (app.py/conversion_authority.py/governanceProxy.ts). It adds 6 new capabilities / 22 ADDED requirements, an 8-decision design doc, a 9-phase task list, and records 8 unresolved Open Questions (OQ-1..OQ-6, OQ-A/OQ-B) as pre-implementation gates.

Changes:

  • Adds proposal/design/tasks plus 6 delta specs (session lifecycle, GPU baseline harness, AI-review draft pipeline, issue idempotency, human triage queue, BCF contract export), all requirements ADDED.
  • Encodes fail-closed admission, primary queue + spectator split, readyState=4-based idle/health, cold-start 202, DTLS-SRTP non-degradation, environment-fingerprint gating, and draft-gate (AI cannot directly create/close/reopen official issues).
  • Explicitly defers LLM layer, multi-GPU/MIG/K8s, BCFzip serializer, and auth/RBAC; leaves 8 Open Questions as decision gates before implementation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
proposal.md Why/What/Capabilities/Impact/Open Questions; enumerates the 6 capabilities and 8 OQs (capability-count line inconsistent — see comment).
design.md 8 technical decisions, source-of-truth table, verification strategy, anti-false-green table; cross-references R/CAP/OQ numbers consistently.
tasks.md 9-phase implementation checklist (Phase 0 baseline → E2E vertical slice) gated on OQ convergence.
specs/session-lifecycle/spec.md 7 requirements: admission, idle/terminate, health/-ResetUser, cold-start 202, DTLS-SRTP, primary queue, fingerprint gate.
specs/gpu-session-baseline/spec.md 3 requirements: baseline report + fingerprint, soak memory-slope, numeric SLO binding.
specs/ai-review-draft-pipeline/spec.md 3 requirements: IfcClash + has_occ guard, fail-closed ingest, draft-only gate.
specs/issue-idempotency/spec.md 4 requirements: two-layer fingerprint, parent/child convergence, resolved/reopen, tolerance calibration gate.
specs/human-triage-queue/spec.md 3 requirements: triage UI entry, audit ledger, single-writer + version-409 concurrency.
specs/bcf-contract-export/spec.md 2 requirements: BCF-API 3.0 JSON export + schema validation, IFC 4.3 pin via adapter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


## What Changes

四個 capability、四個交付分期,全部疊加在既有 A1–A4 之上:

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e8206af5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


## Impact

- **所屬目錄/服務**:`bim-review-coordinator` 擁有 SessionBroker 排程/admission/佇列/生命週期 state、AI draft store(單一寫入者序列化)、triage accept 寫入正式 issue、稽核 ledger、BCF 匯出端點與冷啟動 202 輪詢 API;`bim-streaming-server` 提供 Kit runtime 起流/回收/`-ResetUser`、`omni.services.livestream.session` REST、IfcClash 執行環境與 IFC→USD 座標變換鏈;`governance-service` 維持既有 issues/annotations/BCF 持久化與匯出契約,draft 為 additive `source_type`;`web-viewer-sample` 擁有 triage 頁與冷啟動進度 UI(dist-ui 體系,build:ui 交付)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep draft and BCF authority in one service

This ownership line assigns the AI draft store, the triage path that writes formal issues, and the BCF export endpoint to bim-review-coordinator, while this same change later puts finding ingest/draft state and BCF export tasks under governance-service; if implementers follow different parts of the spec, draft/issue/BCF state can be split across two authorities and bypass the existing issue audit/proxy boundary. Please make coordinator only orchestrate/proxy here, or consistently document an explicit boundary change.

AGENTS.md reference: AGENTS.md:L90-L92

Useful? React with 👍 / 👎.

Comment on lines +40 to +42
### Requirement: SessionBroker SHALL 以 readyState=4 加影像尺寸加 DataChannel 回應定義健康並自動復原

health SHALL 定義為 readyState=4 + 影像尺寸 + DataChannel 回應,SHALL NOT 以 port-open 判定存活。連續 N 次健康探針失敗時 watchdog SHALL 觸發自動 `-ResetUser` 復原;復原失敗 SHALL teardown 回收並將事件寫入 session ledger 供排程器決策。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require DataChannel health only for primary

As written, the health contract requires a DataChannel response without carving out spectator streams. The current repo docs/evidence treat spectators as view-only and explicitly say no app DataChannel is required for a healthy spectator (web-viewer-sample/README.md:153, docs/verification/2026-05-08-spec-end-to-end-verification.md:377), so a 1-primary + k-spectator session could mark healthy spectators as failed and trigger -ResetUser/teardown during the 6-person E2E. Please make the DataChannel probe primary-only or define a video-only spectator health path.

Useful? React with 👍 / 👎.


### Requirement: primary 佇列 SHALL 具 requester-TTL 與認領視窗語意且無 preemption

佇列項的 requester-TTL 逾時(請求者離開/放棄)時 SHALL 自動出列、釋放佔位、後方遞補。輪到某請求者且前一 primary 回收釋放 GPU 時 SHALL 發「輪到你」通知並開啟認領視窗;認領視窗 N 秒內未起流 SHALL 讓位給下一位(本人可重新排隊)。MVP SHALL NOT 做搶佔(preemption),SHALL NOT 設會議最長持有硬上限(max-hold hard cap);餓死風險以可見等待資訊(佇列位置/預估)+人際協調吸收。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not make pending max-hold normative

This requirement hard-codes SHALL NOT 設會議最長持有硬上限 even though proposal OQ-A and task 0.1 say that decision still needs user confirmation and unresolved requirements should be marked pending. If the change is archived or implementation starts before that gate, SessionBroker will be built to allow a forgotten/long-lived tab to starve the single GPU indefinitely without explicit sign-off; mark this requirement as pending or remove the no-max-hold SHALL until OQ-A is resolved.

Useful? React with 👍 / 👎.


## 3. Phase 2a — ai-review-draft-pipeline(`bim-streaming-server` 審查執行 + `governance-service` draft store)

- [ ] 3.1(streaming)建立 Finding SPI(SEAM-2)並落地唯一 IfcClash checker;凍結「LLM 層可整層關閉不中斷審查」降級接縫但不實作 LLM 層。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep IfcClash checks out of streaming

This task makes bim-streaming-server own the Finding SPI and IfcClash checker, but the repository boundary assigns streaming to IFC→USDC/Kit/WebRTC runtime and governance-service to A1 rule-run/issue/BCF authority. Implementing Phase 2 this way would put CPU governance checks and rule semantics inside the GPU runtime service, creating a second governance authority; move the checker execution/contract to governance-service and let streaming only provide conversion/runtime evidence.

AGENTS.md reference: AGENTS.md:L90-L92

Useful? React with 👍 / 👎.


### Requirement: 兩層 fingerprint SHALL 兜底 GUID churn 且幾何 fallback 命中禁靜默 dedup

同一 IFC 模型連跑兩次審查時第二次 SHALL 產 0 筆新 draft,既有 draft SHALL 更新 `last_seen`;SHALL 沿用 repo `mw_` 前綴 hash 鍵 + ConversionLedger atomic swap 寫入。第一層(精確)SHALL 以 GUID 組合 + 規則 id 精確匹配。第一層 miss 時第二層(幾何 fallback)SHALL 以規則 id + 幾何量化位置 bucket 匹配,命中 SHALL 標記 `guid_churn_suspected`。標記 `guid_churn_suspected` 的第二層命中 SHALL 必路由人審確認,SHALL NOT 自動 suppress/dedup 為同一 finding(防兩個實為不同的 finding 因幾何量化落同 bucket 被誤併而隱藏真實新 finding)。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not reuse ConversionLedger for issue fingerprints

This requirement binds AI finding idempotency to the mw_ key namespace and ConversionLedger atomic writes, but ConversionLedger is a coordinator-local shadow ledger for MinIO IFC conversion events with conversion-only statuses (detected|queued|converting|ready|failed). If issue fingerprints are written there, conversion records and AI drafts can collide or corrupt each other's lifecycle/status assumptions; define a separate draft/finding ledger or only reuse the atomic-swap pattern, not the conversion ledger/keyspace.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openspec/changes/add-single-gpu-session-ai-review-mvp/design.md`:
- Around line 51-55: 在
openspec/changes/add-single-gpu-session-ai-review-mvp/design.md 第 51-55 行,定義
GUID churn fallback parent/child identity 的唯一 canonical key 及正規化規則,並讓其與第一層 GUID
組合鍵及既有冪等模式一致;在 openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md 第
40-42 行,依同一 canonical key 更新 fingerprint、分群、merge、resolved/reopen lineage
與差異報告,確保兩處不再使用不同 identity key。
- Around line 25-29: 更新單 GPU warm primary 設計,避免將 POST /v1/streaming/endsession
作為常駐 session 的回收機制。明確 pin Kit 與 ext. "omni.services.livestream.session" 版本及設定,定義
quitOnSessionEnded、resumeTimeoutSeconds、waitForSessionReadyEvent 的狀態轉移,確保
session 結束後仍能維持或恢復 warm primary。補充涵蓋此 REST contract 與 warm-session 行為的 contract
test。
- Around line 69-73: 在設計文件第 7 節的成本基準中,將「2026-07-01 官方公告」修正為有來源支持的「2026 年 5
月起」,並明確限定免費範圍為開發與生產使用;正式 Enterprise Support 仍需 NVIDIA AI Enterprise。保留 G3 的
Omniverse EULA/pricing 逐字確認、官方文件連結與日期要求。

In `@openspec/changes/add-single-gpu-session-ai-review-mvp/proposal.md`:
- Around line 46-51: 在 proposal 的「保留的外部邊界」與「API/資料/儲存影響」描述中,明確補充所有 mutating
coordinator endpoints(session create/join/terminate、triage 寫入與 BCF 匯出)僅可經既有
authenticated/internal ingress 存取,並要求請求綁定 tenant、project 與 actor context。保留不新增
auth/RBAC 模型的範圍,但明確定義未通過既有 ingress 或缺少綁定 context 的 caller 不得執行這些操作。

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/ai-review-draft-pipeline/spec.md`:
- Around line 25-39: Update the finding ingest requirement and its scenarios so
accepted findings explicitly include abstain=false, while rejected findings are
routed to the abstain bucket with abstain=true and a machine-readable rejection
reason. Ensure the complete evidence package scenario states abstain=false and
the missing-field scenario specifies the required abstain=true reason.
- Around line 41-43: Update the AI review draft requirement to mandate a
user-visible API/UI disclosure that the MVP output is deterministic IfcClash
analysis rather than LLM-generated, including the checker version and rule-set
version. Preserve the existing draft-only, non-issue-listing, and non-dispatch
behavior.
- Around line 20-23: Update the “超大模型” scenario to define a measurable size
threshold and input metric, such as IFC entity count, file size, estimated VRAM,
or predicted runtime. Specify the deterministic failure behavior when the
threshold is exceeded—reject, queue, or route to abstain—so the size guard can
prevent timeouts consistently.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/bcf-contract-export/spec.md`:
- Around line 3-5: Extend the BCF-API 3.0 export requirement to define
deterministic handling for accepted parent/child clashes: specify which finding
produces the topic and how accepted child evidence is represented through the
corresponding comment/viewpoint without creating duplicate topics or dropping
evidence. Keep the mapping compatible with the official BCF schema and preserve
the MVP’s export-only scope.
- Around line 3-5: Clarify the BCF-API 3.0 export requirement by naming the
canonical BCF-API 3.0 API/OpenAPI definition used for schema validation. Specify
the resource mapping for each accepted issue—one topic with separate comment and
viewpoint resources—and document where component ifc_guid references appear in
the exported payload, while preserving the MVP-only export endpoint scope.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/gpu-session-baseline/spec.md`:
- Around line 3-5: 補強「基準量測腳本 SHALL 產出含環境指紋的結構化基準報告」需求,明確加入 probe
timeout、並發上限、idle-timeout、leak threshold 與記憶體斜率等欄位、單位及測量或推導方法;若其中參數不由 Phase 0
量測,則將其明確定義為部署政策輸入,並同步更新 R2.1、R2.2、R2.3 相關條款,確保 hard gate 僅接受有量測或明確政策依據的值。

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/human-triage-queue/spec.md`:
- Around line 24-26: Extend the draft store concurrency requirement around the
coordinator store service to define a cross-process single-writer invariant:
require deployment topology and recovery semantics that ensure only one writer
across replicas, restarts, and separate ingest workers, or specify a distributed
lease/leader mechanism with failover behavior. Preserve the existing in-process
serialization, version-based 409 handling, and AI field-ownership rules while
making the zero-loss guarantee enforceable across processes.
- Around line 3-5: 在既有 issues store 及其服務端寫入入口加入人類驗證,要求建立、關閉、指派與重新開啟只能由已驗證的人類
triage command 執行,並驗證預期的 draft/version context;不要僅依賴 triage UI,拒絕其他客戶端或 AI
直接呼叫正式 issue 轉正流程。保留 accept 經 issues store 寫入正式 issue 的既有路徑。
- Around line 13-15: Update the triage audit-ledger requirement for each
accept/reject/edit operation to persist an immutable, content-addressed evidence
snapshot or version identifier rather than a mutable evidence reference, along
with the AI version and deterministic checker/rule-set digest as they existed at
operation time. Keep the MVP scope limited to collecting these historical fields
without introducing automated thresholds.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/issue-idempotency/spec.md`:
- Around line 3-5: The specification must resolve the geometric-fallback
contradiction before implementation: define whether a `guid_churn_suspected` hit
is an independent candidate linked to an existing draft or participates in
parent/child grouping, while preserving distinct findings in the same geometry
bucket and never automatically suppressing or deduplicating them. Update OQ-1
and the parent/child requirement consistently, retaining exact GUID matching,
`last_seen` updates, and the required `mw_`/ConversionLedger behavior.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md`:
- Around line 94-102: Update the SessionBroker startup requirement and its
“環境指紋不符” scenario so a fingerprint mismatch defaults to rejecting scheduling,
not merely issuing an alert. If an override is supported, require explicit
authorization, audit the override, and require a valid new baseline; otherwise
do not permit reuse of the old SLO thresholds.
- Around line 56-64: 補充冷啟動建立流程的 statusUrl 可輪詢契約:明確指定 URL 對應的 coordinator 或
upstream route,定義 queued、starting、ready、failed、expired
等狀態及其回應格式、終止錯誤與授權要求;同時規定前端在 failed 或 expired 等終止狀態停止輪詢並完成錯誤處理,避免永久輪詢。
- Around line 34-38: 補充「顯式 terminate」情境的契約:僅允許 session owner 或管理員終止目標
session,並驗證請求者與目標 session 的綁定;未授權或 session 不匹配時拒絕操作。另明確規定對已終止或不存在的 session 重複
terminate 應回傳冪等結果,不得再次執行 `/endsession` 或 teardown。
- Around line 28-38: Update the session idle-timeout and explicit terminate
scenarios in the session-lifecycle specification so SessionBroker dispatches the
next queued session only after /endsession and teardown are confirmed
successful; define retry and alert behavior for failures or timeouts, and
require the queue to remain blocked while cleanup is incomplete.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea13b61e-31f4-4d95-8c05-b3d54d2a69e1

📥 Commits

Reviewing files that changed from the base of the PR and between 99cd722 and 3e8206a.

📒 Files selected for processing (9)
  • openspec/changes/add-single-gpu-session-ai-review-mvp/design.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/proposal.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/ai-review-draft-pipeline/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/bcf-contract-export/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/gpu-session-baseline/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/human-triage-queue/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/issue-idempotency/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md
  • openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md

Comment on lines +25 to +29
### 1. 單 GPU 路線=單一常駐 warm primary + spectator 分流 + primary 佇列

**依據(簡報 confirmed)**:NVIDIA 官方明文 "limit each GPU worker instance to a single stream";論壇實測單機第二個 Kit session 會使前一個斷流,port remapping/multi-container 變通均失敗,社群建議改用多台各配單 GPU 的獨立機器。官方 production-grade 多 session 靠 K8s 控制面(Streaming Session Manager + Resource Management Control Plane + CRD/Helm + Min=Max 預熱池),但那是為多 GPU 雲端叢集設計。

**裁決**:單 GPU(消費級 RTX)首要路線放棄 MIG 與多 instance 預熱池,改走「單一常駐 warm Kit session + viewer 佇列/spectator 分流」,用 `omni.services.livestream.session` REST(GET `/v1/streaming/ready`、POST `/endsession`、POST `/creds`)自建輕量 app 層排程器。K8s/MIG 僅列未來多 GPU 水平擴充選項。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

set -euo pipefail

printf '\n== File context ==\n'
wc -l openspec/changes/add-single-gpu-session-ai-review-mvp/design.md
sed -n '1,120p' openspec/changes/add-single-gpu-session-ai-review-mvp/design.md

printf '\n== Repository search ==\n'
rg -n --hidden --glob '!**/.git/**' -e 'quitOnSessionEnded|/endsession|endsession|recycle|resume|warm primary|streaming/ready|omni.services.livestream.session' openspec .

Repository: monkey1sai/AI-BIM-governance

Length of output: 45607


🌐 Web query:

"site:docs.omniverse.nvidia.com omni.services.livestream.session quitOnSessionEnded /endsession session recycle resume reconnect"

💡 Result:

The omni.services.livestream.session extension, introduced in Omniverse Kit 108 to replace the legacy omni.services.livestream.nvcf extension, provides REST API endpoints to manage livestream sessions [1][2][3]. Key settings and their functions include: exts."omni.services.livestream.session".quitOnSessionEnded: A boolean setting (default: true) that determines whether the application should exit automatically when a livestream session terminates [1][4]. exts."omni.services.livestream.session".resumeTimeoutSeconds: Defines the number of seconds the system waits for a session to resume after a disconnection before fully closing the session (default: 30) [1][2]. exts."omni.services.livestream.session".waitForSessionReadyEvent: A boolean flag (default: false) that, when set to true, forces the session service to wait for an explicit "session ready" event before finalizing the connection status [1][2][4]. These settings can be configured via command-line arguments, environment-specific configuration files, or programmatically using carb.settings [1]. For instance, via command line: --/exts/omni.services.livestream.session/quitOnSessionEnded=true \ --/exts/omni.services.livestream.session/resumeTimeoutSeconds=30 \ --/exts/omni.services.livestream.session/waitForSessionReadyEvent=false For developers migrating from Kit 107 or earlier, note that legacy settings such as app.livestream.nvcf.quitOnSessionEnded and app.livestream.nvcf.sessionResumeTimeoutSeconds have been deprecated and replaced by the new exts."omni.services.livestream.session" paths [2][5][4]. Additionally, the extension's design ensures that application shutdown is deferred to allow HTTP responses (such as those from an endsession request) to be sent properly [6].

Citations:


🌐 Web query:

"omni.services.livestream.session Overview quitOnSessionEnded default true endsession recycle"

💡 Result:

The extension omni.services.livestream.session provides a REST API and configuration settings to manage livestreaming sessions in Omniverse Kit applications [1]. It is the successor to the legacy omni.services.livestream.nvcf extension [2][3]. Key details regarding your query: quitOnSessionEnded This is a configuration setting for the omni.services.livestream.session extension [2][3]. When set to true (which is a common default or requirement for specific deployment environments), the Omniverse Kit application will automatically quit when the streaming session ends [2][3][4]. The setting is configured in the [settings] block of your application's.kit file or via command-line arguments: --/exts/omni.services.livestream.session/quitOnSessionEnded=true [2][3]. endsession The extension provides a REST API endpoint, POST /v1/streaming/endsession, used to programmatically terminate a streaming session [1][4]. The request body typically requires the sessionId and an optional gracefulShutdown boolean [4]. recycle The term recycle in the context of Omniverse livestreaming services typically refers to the state or process of resetting an application instance or session after it has ended so it can be reused for a new connection [4]. For example, the status message Streaming session ended (recycle instance) is associated with the session lifecycle management when a session completes [4]. Note: The concepts of RecycleSession found in some external software projects (e.g., GembaCore) are distinct from the native Omniverse Kit livestreaming session lifecycle [5][6][7]. Within Omniverse, session lifecycle is managed by this extension to ensure Kit applications can handle connections, terminations, and potential resumptions gracefully [1][4].

Citations:


🌐 Web query:

"docs.omniverse.nvidia.com Kit livestream session quitOnSessionEnded default"

💡 Result:

The default value for the setting exts."omni.services.livestream.session".quitOnSessionEnded in NVIDIA Omniverse Kit is true [1][2]. This setting determines whether the application should automatically quit when a livestream session ends [1][2]. You can configure this setting via your application's.kit file, command line arguments, or programmatically [1][2]:.kit file configuration: [settings] exts."omni.services.livestream.session".quitOnSessionEnded = true Command line argument: --/exts/omni.services.livestream.session/quitOnSessionEnded=true Programmatic (Python): import carb.settings settings = carb.settings.get_settings settings.set_bool("exts/omni.services.livestream.session/quitOnSessionEnded", True) Note that this setting was introduced as part of the session management restructuring in Kit 108, replacing legacy settings [3][4][5].

Citations:


不要把 /endsession 當成常駐 warm primary 的回收機制。 exts."omni.services.livestream.session".quitOnSessionEnded 預設為 truePOST /v1/streaming/endsession 會把 session 推向終止/回收路徑;若要保留 warm primary,這裡要明確 pin Kit/extension 版本與設定,定義 quitOnSessionEndedresumeTimeoutSecondswaitForSessionReadyEvent 的狀態轉移,並補一個 contract test。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-single-gpu-session-ai-review-mvp/design.md` around lines
25 - 29, 更新單 GPU warm primary 設計,避免將 POST /v1/streaming/endsession 作為常駐 session
的回收機制。明確 pin Kit 與 ext. "omni.services.livestream.session" 版本及設定,定義
quitOnSessionEnded、resumeTimeoutSeconds、waitForSessionReadyEvent 的狀態轉移,確保
session 結束後仍能維持或恢復 warm primary。補充涵蓋此 REST contract 與 warm-session 行為的 contract
test。

Comment on lines +51 to +55
### 4. 冪等價值=收斂非產量,兩層 fingerprint 兜底 GUID churn

**依據(簡報 key_constraint + repo 現況)**:BCF issue 需跨 model 版本冪等,套用 repo 既有冪等鍵模式(`mw_` 前綴 hash / ConversionLedger atomic swap),避免每次重跑審查變 issue 工廠。repo 已知 IFC 重匯出常重配 GlobalId(GUID churn),是既有 A1–A4 反覆踩過的坑。

**裁決**:第一層=GUID 組合 + 規則 id 精確匹配;第一層 miss → 第二層=規則 id + 幾何量化位置 bucket,命中標 `guid_churn_suspected` 必路由人審、**禁自動 dedup/suppress**(防兩個實為不同的 finding 因幾何量化落同 bucket 被誤併而隱藏真實新 finding)。分群鍵寫死 `(rule_id, sorted 涉事元素 GUID 集合)`,明確不採距離/樓層/系統啟發式。幾何 bucket 大小引用 R4.4 校準報告(GUID 存活率與幾何容差曲線),禁模糊詞。**GUID churn 常態下的資料模型形狀(新 draft vs merge-candidate)與 parent 級一鍵確認語意仍未定義,見 Open Question OQ-1。**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

統一 GUID churn fallback 的 canonical identity contract。

目前設計與任務對 fallback parent/child identity 使用不同 key,會破壞跨版本 idempotency、resolved/reopen lineage 與差異報告一致性。

  • openspec/changes/add-single-gpu-session-ai-review-mvp/design.md#L51-L55: 定義唯一 canonical key 與正規化規則。
  • openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md#L40-L42: 依同一 key 更新 fingerprint、分群、merge、resolved/reopen 與差異報告實作。
📍 Affects 2 files
  • openspec/changes/add-single-gpu-session-ai-review-mvp/design.md#L51-L55 (this comment)
  • openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md#L40-L42
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-single-gpu-session-ai-review-mvp/design.md` around lines
51 - 55, 在 openspec/changes/add-single-gpu-session-ai-review-mvp/design.md 第
51-55 行,定義 GUID churn fallback parent/child identity 的唯一 canonical key
及正規化規則,並讓其與第一層 GUID 組合鍵及既有冪等模式一致;在
openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md 第 40-42 行,依同一
canonical key 更新 fingerprint、分群、merge、resolved/reopen lineage 與差異報告,確保兩處不再使用不同
identity key。

Comment on lines +69 to +73
### 7. 成本基準=Omniverse 現免費、企業支援選配 + 制度化查證 gate

**依據(簡報 confirmed)**:2026-07-01 官方公告 Omniverse 開發與生產雙雙免費化,取消強制訂閱 AI Enterprise($4,500/GPU/年已過時);但 2025-10 有 AI Enterprise/Omniverse Enterprise 整併為 NVIDIA Enterprise 之變動且來源曾 citation mismatch,簽約/生產前須調閱官方 EULA/pricing 逐字確認。可觀測性走 DCGM Exporter + Grafana(dashboard 12239)。

**裁決**:規格以「Omniverse 現免費、企業支援選配」為基準,但加制度化 gate G3:宣稱 production-ready 前 checklist 必有一項「Omniverse EULA/pricing 逐字確認完成,附官方文件連結與日期」。不把免費當永久前提。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant section of the spec file
FILE="openspec/changes/add-single-gpu-session-ai-review-mvp/design.md"
wc -l "$FILE"
sed -n '55,85p' "$FILE"

# Search for the disputed date and related NVIDIA terms in the repo
rg -n "2026-07-01|2026 年 5 月|Omniverse|AI Enterprise|Enterprise Support|EULA/pricing|G3" openspec/changes/add-single-gpu-session-ai-review-mvp/design.md

Repository: monkey1sai/AI-BIM-governance

Length of output: 3446


🌐 Web query:

NVIDIA Omniverse enterprise latest free use since May 2026 Enterprise Support still requires NVIDIA AI Enterprise official docs

💡 Result:

As of May 2026, NVIDIA Omniverse is freely available for both development and production use, and no NVIDIA AI Enterprise subscription is required to use the software for these purposes [1][2][3][4]. Additionally, software built with Omniverse may be freely redistributed under these same terms [1][2][3]. While the software itself is free to use, NVIDIA AI Enterprise subscriptions remain the requirement for customers who need official Enterprise Support [1][2][3][4]. When using Omniverse without an NVIDIA AI Enterprise subscription, support is restricted to community-based resources, such as the NVIDIA Developer Forums and Discord [1][2][3][4]. For organizations requiring official support, NVIDIA AI Enterprise subscriptions are available for purchase through NVIDIA Partner Network (NPN) resellers or Cloud Service Provider (CSP) marketplaces [1][2]. These subscriptions provide access to NVIDIA's enterprise-grade technical support, including assistance with installation, operation, and troubleshooting [5][6]. As part of this licensing model change, the legacy Omniverse License Server and associated configuration requirements have been deprecated [3]. Current licensing terms for Omniverse are now consolidated under the NVIDIA AI Products terms within the broader NVIDIA Software License Agreement [1][7][8].

Citations:


修正 Omniverse 成本依據的日期與支持範圍。 官方文件是自 2026 年 5 月起可免費用於開發與生產;若要正式 Enterprise Support,仍需 NVIDIA AI Enterprise。把「2026-07-01 官方公告」改成有來源的時間點,並保留 G3 的 EULA/pricing 逐字查證要求。

🧰 Tools
🪛 LanguageTool

[uncategorized] ~73-~73: 数词与名词之间一般应存在量词,可能缺少量词。
Context: ...te G3:宣稱 production-ready 前 checklist 必有一項「Omniverse EULA/pricing 逐字確認完成,附官方文件連結與日...

(wa5)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-single-gpu-session-ai-review-mvp/design.md` around lines
69 - 73, 在設計文件第 7 節的成本基準中,將「2026-07-01 官方公告」修正為有來源支持的「2026 年 5
月起」,並明確限定免費範圍為開發與生產使用;正式 Enterprise Support 仍需 NVIDIA AI Enterprise。保留 G3 的
Omniverse EULA/pricing 逐字確認、官方文件連結與日期要求。

Comment on lines +46 to +51
- **所屬目錄/服務**:`bim-review-coordinator` 擁有 SessionBroker 排程/admission/佇列/生命週期 state、AI draft store(單一寫入者序列化)、triage accept 寫入正式 issue、稽核 ledger、BCF 匯出端點與冷啟動 202 輪詢 API;`bim-streaming-server` 提供 Kit runtime 起流/回收/`-ResetUser`、`omni.services.livestream.session` REST、IfcClash 執行環境與 IFC→USD 座標變換鏈;`governance-service` 維持既有 issues/annotations/BCF 持久化與匯出契約,draft 為 additive `source_type`;`web-viewer-sample` 擁有 triage 頁與冷啟動進度 UI(dist-ui 體系,build:ui 交付)。
- **保留的外部邊界**:外部客戶落地端 IFC Worker 仍是 IFC producer;外部公司雲端 `bim-control` 仍擁有 tenant/RBAC/enterprise workflow。本 change 不新增跨 repo 外部工作室派發、不引入 auth/RBAC 模型(維持 `:8004/ui` 現況)。
- **API/資料/儲存影響**:新增 additive session 生命週期 REST(create/join/status/terminate)、Phase 0 基準報告 schema、AI draft 記錄(issues store 疊加 `source_type=ai_review` + draft 狀態 + fingerprint 鍵 + 版本號)、resolved-candidate 差異報告 JSON、BCF-API 3.0 匯出端點。既有 `/api/external/ifc-ready`、conversion callback、`:8004` proxy 與凍結三檔均不變。
- **Session/runtime 影響**:SessionBroker 為 out-of-process 控制面,只做 admission/回收/佇列,不注入 per-session 渲染路徑;WebRTC 維持 RFC 8825/8826/8827 DTLS-SRTP 不降級;Kit GPU 渲染僅 host-native(repo 既知 Docker/WSL2 無繪圖驅動)。
- **量測依賴**:所有 admission SLO 綁定 Phase 0 報告環境指紋;硬體/driver/Kit/fixture 任一變動即令 SLO 失效須重跑基準。
- **非目標**:不上 K8s/MIG/多 GPU 水平擴充(僅記錄 SessionBroker driver 介面約束)、不做 Kit 串流內 fly-to 或 live 視角→BCF viewpoint 擷取、不建 LLM 分類層(僅凍結可停用降級接縫)、不建 IDS 完整規則引擎、不做 BCFzip serializer、不做 auth/RBAC、不做 AI 繪圖寫回、不做完整 OpenCDE server、不含建築工作室 agent 學習訓練(使用者明示不屬本 repo)。詳見 design.md 與各 spec 的 scope。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant file and locate related security / ingress / auth wording.
git ls-files 'openspec/changes/add-single-gpu-session-ai-review-mvp/**' | sed -n '1,200p'
printf '\n--- outline proposal.md ---\n'
ast-grep outline openspec/changes/add-single-gpu-session-ai-review-mvp/proposal.md --view expanded || true
printf '\n--- outline design.md ---\n'
ast-grep outline openspec/changes/add-single-gpu-session-ai-review-mvp/design.md --view expanded || true
printf '\n--- outline tasks.md ---\n'
ast-grep outline openspec/changes/add-single-gpu-session-ai-review-mvp/tasks.md --view expanded || true

printf '\n--- search for trust boundary / auth / RBAC / ingress / tenant / project / actor ---\n'
rg -n --hidden -S 'auth|RBAC|trust boundary|ingress|tenant|project|actor|internal ingress|authenticated|session create|join|terminate|BCF export|triage|mutating route' \
  openspec/changes/add-single-gpu-session-ai-review-mvp

Repository: monkey1sai/AI-BIM-governance

Length of output: 9789


補上 mutating routes 的明確 trust boundary。

proposal 仍明確寫了不引入 auth/RBAC/project-tenant 隔離,但同時新增 session create/join/terminate、triage 寫入與 BCF 匯出;請明定這些 coordinator endpoints 只能走既有 authenticated/internal ingress,並綁定 tenant/project/actor,否則任何可達 caller 都可能終止 session 或改寫正式 issue。

🧰 Tools
🪛 LanguageTool

[uncategorized] ~50-~50: 数词与名词之间一般应存在量词,可能缺少量词。
Context: ...定 Phase 0 報告環境指紋;硬體/driver/Kit/fixture 任一變動即令 SLO 失效須重跑基準。 - 非目標:不上 K8s/MIG/多 ...

(wa5)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openspec/changes/add-single-gpu-session-ai-review-mvp/proposal.md` around
lines 46 - 51, 在 proposal 的「保留的外部邊界」與「API/資料/儲存影響」描述中,明確補充所有 mutating
coordinator endpoints(session create/join/terminate、triage 寫入與 BCF 匯出)僅可經既有
authenticated/internal ingress 存取,並要求請求綁定 tenant、project 與 actor context。保留不新增
auth/RBAC 模型的範圍,但明確定義未通過既有 ingress 或缺少綁定 context 的 caller 不得執行這些操作。

Comment on lines +20 to +23
#### Scenario: 超大模型

- **WHEN** 超大模型進審查
- **THEN** size guard SHALL 攔截避免逾時

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Define a measurable size guard and its failure contract.

“超大模型” has no measurable threshold, input metric, or required outcome. Define the guard using concrete limits such as IFC entity count, file size, estimated VRAM, or predicted runtime, and specify whether the request is rejected, queued, or routed to abstain; otherwise implementations cannot deterministically prevent timeouts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/ai-review-draft-pipeline/spec.md`
around lines 20 - 23, Update the “超大模型” scenario to define a measurable size
threshold and input metric, such as IFC entity count, file size, estimated VRAM,
or predicted runtime. Specify the deterministic failure behavior when the
threshold is exceeded—reject, queue, or route to abstain—so the size guard can
prevent timeouts consistently.

Comment on lines +3 to +5
### Requirement: 兩層 fingerprint SHALL 兜底 GUID churn 且幾何 fallback 命中禁靜默 dedup

同一 IFC 模型連跑兩次審查時第二次 SHALL 產 0 筆新 draft,既有 draft SHALL 更新 `last_seen`;SHALL 沿用 repo `mw_` 前綴 hash 鍵 + ConversionLedger atomic swap 寫入。第一層(精確)SHALL 以 GUID 組合 + 規則 id 精確匹配。第一層 miss 時第二層(幾何 fallback)SHALL 以規則 id + 幾何量化位置 bucket 匹配,命中 SHALL 標記 `guid_churn_suspected`。標記 `guid_churn_suspected` 的第二層命中 SHALL 必路由人審確認,SHALL NOT 自動 suppress/dedup 為同一 finding(防兩個實為不同的 finding 因幾何量化落同 bucket 被誤併而隱藏真實新 finding)。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Resolve the contradictory geometric-fallback semantics before implementation.

The first requirement says a geometric fallback hit must not be automatically deduplicated as the same finding, while the parent/child requirement says fallback keys converge matching hits into one parent. This can hide two distinct clashes in the same bucket. Define whether a fallback hit creates an independent candidate linked to an existing draft or participates in grouping, and preserve distinct occurrences without suppression; OQ-1 should be resolved before implementation.

Also applies to: 21-23

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/issue-idempotency/spec.md`
around lines 3 - 5, The specification must resolve the geometric-fallback
contradiction before implementation: define whether a `guid_churn_suspected` hit
is an independent candidate linked to an existing draft or participates in
parent/child grouping, while preserving distinct findings in the same geometry
bucket and never automatically suppressing or deduplicating them. Update OQ-1
and the parent/child requirement consistently, retaining exact GUID matching,
`last_seen` updates, and the required `mw_`/ConversionLedger behavior.

Comment on lines +28 to +38
#### Scenario: session idle 逾時自動回收

- **WHEN** session idle 逾 idle-timeout(連續 T 秒無任一 readyState=4 連線),watchdog 判定 idle
- **THEN** SessionBroker SHALL 走 `/endsession` + teardown
- **AND** 佇列中下一位 SHALL 獲派並收到「輪到你」

#### Scenario: 顯式 terminate

- **WHEN** 收到顯式 terminate 請求
- **THEN** SessionBroker SHALL 走 `/endsession` + teardown 回收
- **AND** 佇列中下一位 SHALL 獲派

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

只有確認 teardown 成功後才能遞補下一位。

目前未定義 /endsession 失敗、逾時或 teardown 未完成時的行為;若仍直接派發下一個 primary,可能同時存在兩個 Kit primary。請加入成功確認、重試/告警,以及失敗時維持佇列阻塞的語意。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md`
around lines 28 - 38, Update the session idle-timeout and explicit terminate
scenarios in the session-lifecycle specification so SessionBroker dispatches the
next queued session only after /endsession and teardown are confirmed
successful; define retry and alert behavior for failures or timeouts, and
require the queue to remain blocked while cleanup is incomplete.

Comment on lines +34 to +38
#### Scenario: 顯式 terminate

- **WHEN** 收到顯式 terminate 請求
- **THEN** SessionBroker SHALL 走 `/endsession` + teardown 回收
- **AND** 佇列中下一位 SHALL 獲派

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

補充顯式 terminate 的授權與 session 綁定。

此契約未限制誰能終止哪個 session;實作若只依賴請求即可呼叫 /endsession,可能允許任意使用者終止他人的會議。請明確要求 owner/管理員授權、目標 session 綁定,以及重複 terminate 的冪等回應。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md`
around lines 34 - 38, 補充「顯式 terminate」情境的契約:僅允許 session owner 或管理員終止目標
session,並驗證請求者與目標 session 的綁定;未授權或 session 不匹配時拒絕操作。另明確規定對已終止或不存在的 session 重複
terminate 應回傳冪等結果,不得再次執行 `/endsession` 或 teardown。

Comment on lines +56 to +64
### Requirement: SessionBroker SHALL 對冷啟動立即回 202 加可輪詢 statusUrl 而非假同步

冷啟動(起流 30–40 秒、shader cache 未預熱更久)時 SessionBroker SHALL 立即回 202 + 可輪詢 statusUrl,SHALL NOT 假裝同步成功。前端 SHALL 輪詢至 ready 才進 viewer,UI SHALL 顯示啟動進度。

#### Scenario: 冷啟動建立請求

- **WHEN** 收到冷啟動建立請求
- **THEN** SessionBroker SHALL 立即回 202 + statusUrl
- **AND** UI SHALL 顯示啟動進度,前端 SHALL 輪詢至 ready 才進 viewer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

補齊 statusUrl 的可輪詢契約。

目前只規定回傳 URL,未定義它是 coordinator route 還是 upstream route,也未定義 queued/starting/ready/failed/expired 等狀態、終止錯誤與授權。若啟動永久失敗,前端可能無限輪詢且無法完成流程。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md`
around lines 56 - 64, 補充冷啟動建立流程的 statusUrl 可輪詢契約:明確指定 URL 對應的 coordinator 或
upstream route,定義 queued、starting、ready、failed、expired
等狀態及其回應格式、終止錯誤與授權要求;同時規定前端在 failed 或 expired 等終止狀態停止輪詢並完成錯誤處理,避免永久輪詢。

Comment on lines +94 to +102
### Requirement: SessionBroker 啟動 SHALL 比對環境指紋,不符即 fail-loud

SessionBroker 啟動並載入 `gpu-session-baseline` 基準 SLO 門檻時 SHALL 讀取當前環境指紋(GPU 型號/driver 版/Kit 版/量測 fixture hash)並與基準報告指紋比對;不符時 SHALL fail-loud(拒絕起排程或顯著告警),SHALL NOT 靜默沿用舊門檻。

#### Scenario: 環境指紋不符

- **WHEN** SessionBroker 啟動讀取的環境指紋與基準報告指紋不符
- **THEN** SessionBroker SHALL fail-loud(拒絕起排程或顯著告警)
- **AND** SHALL NOT 靜默沿用舊 SLO 門檻

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

指紋不符時應預設拒絕排程,而非僅告警。

「顯著告警」允許留下不明確的可運行路徑;若仍沿用舊 SLO,admission 可能基於錯誤基準執行。請改為預設拒絕起排程;若要支援人工 override,需明確授權、記錄並要求有效的新基準。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@openspec/changes/add-single-gpu-session-ai-review-mvp/specs/session-lifecycle/spec.md`
around lines 94 - 102, Update the SessionBroker startup requirement and its
“環境指紋不符” scenario so a fingerprint mismatch defaults to rejecting scheduling,
not merely issuing an alert. If an override is supported, require explicit
authorization, audit the override, and require a valid new baseline; otherwise
do not permit reuse of the old SLO thresholds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants