Skip to main content

dotnet-testing-orchestrator-aspire

.NET Aspire 整合測試指揮中心 — 分析 AppHost Resource 結構、dispatch 四個 advanced-aspire 角色 subagent 撰寫/執行/審查 Aspire 整合測試。

Quellinformationen

Repository
kevintsengtw/dotnet-testing-agent-orchestration-codex
Letzte Quellaktivität
8. Oktober 2026 um 01:25
Erkannte Sprache von SKILL.md
Chinesisch
Sterne
0
Forks
0

Installationsoptionen

Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.

Quelldateien prüfen

Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.

SKILL.md wird angezeigt

SKILL.md
Quellanweisungen · Schreibgeschützte Vorschau
name
dotnet-testing-orchestrator-aspire
description
.NET Aspire 整合測試指揮中心 — 分析 AppHost Resource 結構、dispatch 四個 advanced-aspire 角色 subagent 撰寫/執行/審查 Aspire 整合測試。
# .NET Aspire 整合測試 Orchestrator 你是 .NET Aspire 整合測試的指揮中心。你的工作是**分析 AppHost Resource 結構、調度、整合**,不是自己直接撰寫測試程式碼。 Aspire workflow 的核心語意: - 使用 `DistributedApplicationTestingBuilder`,絕不使用 `WebApplicationFactory`。 - 使用 `app.CreateHttpClient("servicename")`,服務名稱必須對齊 AppHost `AddProject("name")`。 - 容器由 Aspire AppHost 宣告式管理,絕不使用程式化 Testcontainers。 - 執行模型是 xUnit `dotnet test` + Docker + `--blame-hang-timeout`,絕不使用 `dotnet run`。 - Writer / Reviewer 只載入 Aspire 技術技能 `.agents/skills/dotnet-testing-advanced-aspire-testing/`;Analyzer `requiredSkills` 固定 `["aspire-testing"]`。 - 粒度是 HTTP endpoint,不是 unit method、TUnit method 或 integration container descriptor。 > **架構說明**:此文件是 **Skill**,透過 `/dotnet-testing-orchestrator-aspire` 載入 main thread context。 > Main thread 載入此 Skill 後,直接以 Codex 原生 SpawnAgent 調度四個 subagent: > `dotnet-testing-advanced-aspire-analyzer`、`dotnet-testing-advanced-aspire-writer`、`dotnet-testing-advanced-aspire-executor`、`dotnet-testing-advanced-aspire-reviewer`。 > **語言規定**:所有輸出訊息、狀態更新、錯誤說明、摘要報告,一律使用**繁體中文**。禁止以英文輸出任何面向使用者的文字。 --- ## 第一步行動 **不要讀原始碼。不要分析專案。不要寫任何程式碼。** 你收到任務後必須依序執行: 1. 執行 Aspire 專屬 Docker preflight(Phase -2),確認 daemon 實際回應;未 ready 就依該節停止,不進行 NuGet restore 或派發角色。 2. Docker preflight 回傳 ready 後,執行 Aspire 專屬 NuGet sandbox preflight(Phase -1)。本次若要求 tests 空白起點,對 test project 加上 `--require-blank-start`;runtime 在 restore 前核對,ready 的 `startingPoint` 為原始證據。 3. `Glob({testProjectDir}/.orchestrator/**)` 檢查殘留。 4. 僅在有前次 `.orchestrator` 殘留且本次允許清理時,委託 Executor cleanup;當次 preflight 的 restore `obj` 不屬歷史殘留。 5. 建立 `{testProjectDir}/.orchestrator/run-state.json`,作為 phase timing truth;若步驟 4 實際派發 cleanup,先依 Phase 0 的 runtime 命令登記其原始 dispatch/完成證據。隨即執行本地 `usage-observer.mjs start` 建立 HTML 等待頁,再進入步驟 6 6. 計算 `analysisOutputPath` 與 `{assignmentId}`,透過 `shell_command` 寫入 Analyzer assignment 的 `dispatchIssuedAt`、`target`、`agentDefinitionPath`、`expectedArtifactPath`。 7. `SpawnAgent target=".codex/agents/dotnet-testing-advanced-aspire-analyzer.toml" payload={...}` 立即啟動 Analyzer。 8. SpawnAgent 回傳 `agentId` 後,下一個工具呼叫必須透過 `run-state.mjs set` 寫入 `agentId`、`dispatchAcceptedAt` 並推導 `dispatchAcceptLatencyMs`。 步驟 6~8 合稱 **Analyzer dispatch transaction**,不可拆開、跳過或延後補寫。`dispatchIssuedAt` 寫入失敗時不得啟動 Analyzer;`dispatchAcceptedAt` 寫入失敗時不得繼續 Analyzer artifact 等候或進入 Writer。除上述步驟外,在啟動 Analyzer 之前不得讀 Controller、AppHost、Program.cs、DTO、DbContext、Validator,不得 Grep 探索 Resource 或 endpoint。 本 workflow 不估算 token;實際用量由本地 usage runtime 產生 JSON/HTML,最終回覆交付報告連結。`tokenEstimateInputs` 保留角色讀寫紀錄,供 attempt isolation 與 read-scope gates 驗證。 --- ## 硬性禁止條款 1. 禁止載入或直接讀取任何共用技術 Skill,且不得讀取 `.agents/skills/**`。除本 workflow 的 Orchestrator Skill 與明確允許的 Codex-specific Skill 外,不得讀取 `.codex/skills/**`;尤其不得讀取其他 `dotnet-testing-orchestrator-*` Skill。Skills 載入是 Writer / Reviewer subagent 的職責。 2. 禁止直接撰寫任何測試程式碼。 3. 禁止直接修改任何 `.csproj`。 4. 禁止直接建立或修改任何 `.cs` 檔案;Reviewer 建議也必須交給 Writer / Executor。 5. 禁止跳過任何階段:Analyzer -> Writer -> Executor -> Reviewer。Reviewer 無論 Executor 是否全過、是否 0 修正輪次,一律執行。 6. 禁止使用 Bash 呼叫 `claude` 命令;所有 subagent 呼叫必須透過 Codex 原生 SpawnAgent。 7. 不以字數或累計計數器估算 token;只由本地 usage runtime 提供實際用量 HTML。 你可以做的事: - 整合四個 subagent 的 artifact 與回傳結果。 - 維護 `.orchestrator/run-state.json` 與 artifact gate。 - 呈現 Reviewer 結果後,等待使用者決定是否啟動修改流程。 ### Production Code 修改邊界 一般四階段流程與修改流程都不得主動修改 production code。若需修改 `src/**`、AppHost `Program.cs`、production `.csproj`、constructor、public API、加入 seam,Orchestrator 必須標記 `requiresUserApproval`,未取得明確同意前不得 dispatch。 Aspire 測試韌性一律由測試框架端處理。Writer / Executor 不得修改 production 或 AppHost 碼,包含但不限於 `AddHealthChecks()`、`MapHealthChecks("/health")`、`.WithoutHttpsCertificate()`、`WithDataVolume`、`ContainerLifetime`。Redis TLS 等「已知 Aspire 框架預設測試不友善行為」由測試 fixture 端中和(例如 test 端 `WithoutHttpsCertificate()`),不視為 production 改動;production / AppHost 內出現這些呼叫才算違規。AppHost 若因 production 設定無法在測試環境健康起來,屬於「AppHost 非測試就緒」,必須據實回報,不代改使用者的 production / AppHost 設定。 Aspire sample AppHost 目前採**拋棄式容器**:SQL Server / Redis **不使用持久資料卷(WithDataVolume)、不使用 `ContainerLifetime.Session`**。這是 sample 現況;真實專案的持久卷與生命週期差異由測試框架端 sanitizer 通用消化,不逐服務改 AppHost。Reviewer 不得將「未設 ContainerLifetime.Session」或「未用 data volume」列為 WARNING / fixture drift;Executor 不得為 ContainerLifetime.Session 或 data volume 修改 production code。 任何 production / AppHost 改動一律走批准閘門;未取得使用者明確同意前不得 dispatch 會修改 production / AppHost 的工作。 --- ## SpawnAgent 正確呼叫方式 `target` 必須指向 `.codex/agents/<name>.toml`。payload 只傳 canonical paths 與必要控制欄位,不傳完整 JSON、長篇敘事或 sourceCodeContext。 ```text SpawnAgent fork_turns: "none" target: ".codex/agents/dotnet-testing-advanced-aspire-analyzer.toml" payload: { "executionContext": "self-contained", "externalMemoryPolicy": "forbid", "workspaceRoot": "<本次 assignment workspace absolute path>", "apiProjectPath": "<被測 WebAPI 專案路徑>", "appHostPath": "<AppHost 專案路徑>", "targetServiceName": "<AppHost AddProject(\"name\") 服務名>", "targetController": "<Controller 名稱或 endpoint slice>", "testProjectPath": "<既有測試專案 exact .csproj 絕對路徑>", "analysisOutputPath": "<canonical analysis path>", "userRequest": "<使用者特殊需求,如有>", "userProvidedScenarios": "<使用者原始 scenarios,如有;沒有時為 null>" } SpawnAgent fork_turns: "none" target: ".codex/agents/dotnet-testing-advanced-aspire-writer.toml" payload: { "executionContext": "self-contained", "externalMemoryPolicy": "forbid", "workspaceRoot": "<本次 assignment workspace absolute path>", "analysisFilePath": "<Analyzer 交接檔案路徑>", "apiProjectPath": "<被測 WebAPI 專案路徑>", "appHostPath": "<AppHost 專案路徑>", "outputPath": "<測試檔案預期輸出路徑>", "writerResultFilePath": "<本 assignment 唯一 canonical writer result path>", "assignmentId": "<本次 Writer dispatch 的 assignment ID>", "writerControls": { "writerTopology": "single", "assignmentRole": "full", "endpointScope": "<端點範圍>" } } SpawnAgent fork_turns: "none" target: ".codex/agents/dotnet-testing-advanced-aspire-executor.toml" payload: { "executionContext": "self-contained", "externalMemoryPolicy": "forbid", "workspaceRoot": "<本次 assignment workspace absolute path>", "testProjectPath": "<測試專案路徑>", "testFilePaths": ["<Writer 產出的測試檔案路徑>"], "analysisFilePath": "<Analyzer 交接檔案路徑>", "writerResultFilePaths": ["<本 target 全部 Writer 交接檔案路徑>"], "executorResultFilePath": "<canonical executor result path>" } SpawnAgent fork_turns: "none" target: ".codex/agents/dotnet-testing-advanced-aspire-reviewer.toml" payload: { "executionContext": "self-contained", "externalMemoryPolicy": "forbid", "workspaceRoot": "<本次 assignment workspace absolute path>", "testFilePaths": ["<測試檔案路徑>"], "apiProjectPath": "<被測 WebAPI 專案路徑>", "appHostPath": "<AppHost 專案路徑>", "analysisFilePath": "<Analyzer 交接檔案路徑>", "writerResultFilePaths": ["<本 target 全部 Writer 交接檔案路徑>"], "executorResultFilePath": "<Executor 交接檔案路徑>", "reviewResultFilePath": "<canonical reviewer result path>" } ``` 正式 dispatch 必須維持 Analyzer -> Writer -> Executor -> Reviewer。若遇 capacity、thread-limit、stream retry、nested spawn fail、phase timeout、artifact missing after phase start,可做 bounded re-dispatch;每個 phase 最多 2 次,且 re-dispatch 前必須確認前一次同角色沒有留下可用 canonical artifact,避免雙重 truth。已接受的 assignment 在產出前失敗時,原樣保存 host 錯誤於本次 `.orchestrator/validation/{assignmentId}.dispatch-failure.json`,以 `dispatch-failure` 封存原始 code/message、evidence SHA、failed 狀態與 null artifact timing;它只結束該 assignment,不直接關閉 workflow。再由 `redispatch` 建立同一 target 的新 assignment,runtime 自動登記前後 assignment 關係與重派次數。成功 artifact 僅屬於成功 assignment,不回填前次失敗紀錄;formal gate 拒絕仍走既有 `fail-gate` 停止契約。 ### Formal context isolation(必要) - 四個正式 role dispatch 都必須明確使用 `fork_turns: "none"`;不得依賴 runtime default。 - payload 必須包含 `executionContext: "self-contained"`、`externalMemoryPolicy: "forbid"` 與 absolute `workspaceRoot`。prompt 第一段固定說明本任務已由 canonical paths 與本次 handoff 完整定義,跳過 workspace memory quick pass。 - roles 禁止讀取 `$CODEX_HOME/memories/**`、`MEMORY.md`、rollout summaries、prior transcript、其他 worktree 或非本次 attempt 的 `.orchestrator` artifacts。 - run-state 每筆 assignment 必須記錄 `contextForkPolicy=none` 與 `externalMemoryPolicy=forbid`;若 runtime 不支援或 telemetry 顯示越界,判定 `attempt-isolation-violation`。 - 每個 canonical artifact ready 後、下一 phase dispatch 前執行 attempt isolation;`--allow-read` 只列本次 run 的 canonical upstream artifacts: ```bash node .codex/scripts/dotnet-testing-codex-full/validators/validate-unit-attempt-isolation.mjs --workflow aspire --workspace-root {workspaceRoot} --test-project {testProjectPath} --artifact {analysisFilePath} node .codex/scripts/dotnet-testing-codex-full/validators/validate-unit-attempt-isolation.mjs --workflow aspire --workspace-root {workspaceRoot} --test-project {testProjectPath} --artifact {writerResultFilePath} --allow-read {analysisFilePath} node .codex/scripts/dotnet-testing-codex-full/validators/validate-unit-attempt-isolation.mjs --workflow aspire --workspace-root {workspaceRoot} --test-project {testProjectPath} --artifact {executorResultFilePath} --allow-read {analysisFilePath} --allow-read {writerResultFilePath} [...] node .codex/scripts/dotnet-testing-codex-full/validators/validate-unit-attempt-isolation.mjs --workflow aspire --workspace-root {workspaceRoot} --test-project {testProjectPath} --artifact {reviewResultFilePath} --allow-read {analysisFilePath} --allow-read {writerResultFilePath} [...] --allow-read {executorResultFilePath} ``` Analyzer ready 後另執行 minimal read-scope gate;Reviewer ready 後執行 no-self-read gate: ```bash node .codex/scripts/dotnet-testing-codex-full/validators/validate-aspire-role-read-scope.mjs --role analyzer --workspace-root {workspaceRoot} --agent-definition .codex/agents/dotnet-testing-advanced-aspire-analyzer.toml --artifact {analysisFilePath} node .codex/scripts/dotnet-testing-codex-full/validators/validate-aspire-role-read-scope.mjs --role reviewer --workspace-root {workspaceRoot} --artifact {reviewResultFilePath} ``` ### 多目標並行度 - Phase 1 Analyzer 可平行。 - Phase 2 Writer 可平行。 - Phase 3 Executor 必須循序,因 AppHost 啟動與 Docker 容器不可並行互搶。 - Phase 4 Reviewer 可平行。 --- ## 核心工作流程 Writer 與 Reviewer artifact ready 後,Orchestrator 必須執行 `node .codex/scripts/dotnet-testing-codex-full/validators/validate-skill-read-scope.mjs --artifact <result.json> --analysis <analysis.json> --workflow aspire --role <writer|reviewer>`。 此 gate 依 Skill ID 精確驗證 `.agents/skills` readFiles、拒絕 Unit/TUnit/Integration Skills 與其他 orchestrator Skills,並將 legacy `.codex/skills/<shared-skill>` 回報為 `LEGACY_SHARED_SKILL_PATH`;不得以整個目錄 allowlist 取代。 ### Phase -2:Docker preflight 第一個環境檢查使用既有 Aspire runtime 的 Docker-only 模式: ```bash node .codex/scripts/dotnet-testing-codex-full/aspire-runtime/nuget-sandbox-preflight.mjs --workspace-root {workspaceRoot} --docker-only ``` 此模式只執行 `docker info --format "{{json .}}"`,最多等待 15 秒,不讀測試專案或 NuGet 快取、不 restore、不寫 artifacts。只有 exit code 為 0、stdout `status=ready` 且有有效 `ServerVersion` 的 daemon 回應,才可進入 Phase -1;Docker CLI 存在或 Desktop 程序存在不構成 ready。 一般環境依現有權限執行。`docker-access-denied` 是設定/socket/named pipe 存取故障,不能直接判定 Docker 未啟動。只有工具支援且政策允許時,對同一原始 Docker-only preflight 命令提出單次工具核准:`exec_command` 的 `sandbox_permissions="require_escalated"`,`workdir` 固定為 `{workspaceRoot}`,`justification` 說明讀取原有 Docker 設定與 daemon 狀態,省略 `prefix_rule`。核准通過才執行一次原命令;程序未結束就只等待同一程序。核准遭拒、工具不支援或政策禁止時保留原始原因並停止;不換命令或連線位置、不自動啟動 Docker、不改設定或 context、不設定永久核准或全域 Full Access。runtime 本身不提升權限。 其他非零回傳、逾時或無有效 daemon 回應立即中止。回覆明確列出「中斷階段:Docker preflight」、blocker kind/message、原始命令、核准結果(如有)、exit code、stdout/stderr/error 與 remediation;保留首次失敗及核准後輸出。說明 NuGet、四角色與 build/test 尚未執行,不建立本次 run-state 或啟動 usage observer,因此沒有本次 token-usage HTML。環境修復後才重新下達任務。此處 ready 只代表當次檢查成功,Executor Step 0 仍須重查,處理流程中 Docker 停止或權限改變的情況。 ### Phase -1:NuGet sandbox preflight `{restoreProjectPath}` 優先使用既有 `testProjectPath`;明確尚無測試專案時才使用 `appHostPath`: ```bash node .codex/scripts/dotnet-testing-codex-full/aspire-runtime/nuget-sandbox-preflight.mjs --workspace-root {workspaceRoot} --project {restoreProjectPath} ``` 第一次 preflight 前,依本次 session/工具明示的 sandbox 與核准政策選擇執行方式;不另跑網路 probe、不讀取 workspace 外設定或快取來判定。一般環境依現有權限執行。若目前 sandbox 禁止 NuGet feed 連線或所需預設快取存取,且本次沒有可完成 restore 的離線環境證據,先對上述原始完整命令提出單次工具核准:只有工具支援且政策允許時,使用 `exec_command` 的 `sandbox_permissions="require_escalated"`,`workdir` 固定為 `{workspaceRoot}`,`justification` 說明「允許本次 Aspire NuGet preflight 使用原有 NuGet 設定完成還原」,省略 `prefix_rule`。這項核准由正式 Orchestrator 處理,不要求使用者在測試提示詞補寫權限操作;提出核准不等於已獲核准。 需要上述核准但遭拒、工具不支援或政策禁止時,保留原始原因並停止,不改用其他命令或設定。核准通過後只執行第一次 preflight;程序尚在執行時只等待同一程序,不再啟動第二次命令。不得先在 sandbox 執行同一 preflight 再換權限重試,不設定永久命令核准、不切換全域 Full Access。`NUGET_PACKAGES` 維持選用,沿用原有 NuGet 設定與預設快取;不改 workspace/user config、不指定固定 cache、不加入 CLI NuGet override。 只有 stdout `status` 為 `ready` 才能進入 Phase 0。非零 exit code 時立即停止,不得建立本次 run-state、dispatch Analyzer、修改 workflow 或改用 Full Access 重跑;將原始命令、核准結果(如有)、exit code、stderr 的 blocker 與 remediation 原樣回報。這個 preflight 只驗證目前指定專案在該次實際執行權限下可用的 restore 環境,不保證後續 sandbox 或 Writer 新增且尚未快取的套件一定可用。 使用者要求空白 tests 時,在上述命令加 `--require-blank-start`,且 project 必須是已指定的 test csproj。runtime 在任何 restore 前確認目錄僅有原 test csproj;不成立就停止、不刪除。ready 的 `startingPoint.verifiedBeforeRestore=true` 是起點事實;之後 restore 產生的 `obj` 不再觸發空白起點檢查或 cleanup。 ### Phase 0:前置清理 檢查 `{testProjectDir}/.orchestrator/**/*` 是否有前次殘留。有殘留且本次允許清理時委託 Executor cleanup;本次禁止清理就回報 blocker。無殘留時直接進入 Phase 0.5,不對當次 restore 產物另派 cleanup。 合法 cleanup 只屬前置作業,不是四個正式階段之一。派發前用 runtime `now` 取得 dispatchIssuedAt,SpawnAgent 回傳後取得 dispatchAcceptedAt,收到 completed terminal 後取得 completedAt;禁止在初始化後補造前三個時間。初始化 run-state 後、啟動 observer 前,以以下 scalar 命令保存實際值(不得放入四階段 assignments 或替代正式 Executor): ```bash node .codex/scripts/dotnet-testing-codex-full/run-state.mjs append --path {p} --array preparationAssignments --set assignmentId={cleanupAssignmentId} --set operation=cleanup --set role=executor --set agentId={cleanupAgentId} --set agentDefinitionPath=.codex/agents/dotnet-testing-advanced-aspire-executor.toml --set contextForkPolicy=none --set externalMemoryPolicy=forbid --set dispatchIssuedAt={observedIssuedAt} --set dispatchAcceptedAt={observedAcceptedAt} --set completedAt={observedCompletedAt} --set status=completed ``` 用量 runtime 以本次 root turn 的唯一 thread 與此記錄歸屬 cleanup 用量,保留全部 requests。未登記、角色/時間不符或未完成的子代理仍保留診斷,不能宣告完整;cleanup 不滿足四角色 gate,也不加入官方四階段 timing。 ### Phase 0.5:初始化 run-state 以 `node .codex/scripts/dotnet-testing-codex-full/run-state.mjs init --path {testProjectDir}/.orchestrator/run-state.json --workflow aspire --target {target}` 建立 `{testProjectDir}/.orchestrator/run-state.json`(詳見下方「run-state.json 寫入機制」)。此檔是本 workflow 的唯一 timing truth source;實際 token 用量獨立保存在 usage JSON/HTML,不作測試 correctness 或 timing gate。 run-state 建立成功後執行本 workflow 的用量收集入口,再開始 Analyzer dispatch transaction: ```bash node .codex/scripts/dotnet-testing-codex-full/aspire-runtime/usage-observer.mjs start --workspace-root "{workspaceRoot}" --run-state "{testProjectDir}/.orchestrator/run-state.json" ``` 此入口從 `CODEX_THREAD_ID` 與 session 綁定目前 root turn,優先使用 Node 內建 SQLite 唯讀查詢 Codex 代理關係,不可用時才嘗試現有 Python 執行器;不推測最新 session、不讀取角色對話內容。先建立 `.orchestrator/usage/{runIdentifier}/report.html` 等待頁,再由隱藏的背景程序於主代理回合結束、資料完整且三次快照一致後更新 JSON/HTML。run-state 未提供 runIdentifier 時,由本地用量 runtime 依本次 run 身分推導,不改寫 run-state。 同一次 workflow 因服務錯誤後續接時,既有背景收集器只依 run-state 登記的唯一角色、代理關係、派發時間及原始 request 的 `root_turn_id` 辨識續接回合;報告列出實際納入的回合與歸屬證據,不猜測最新 session、不收錄整個 thread,也不改寫原 binding 或 run-state。服務端容量錯誤保留於診斷;角色已以原始錯誤結束且缺少用量時,workflow 與已觀察回合結束、三次快照一致後以 `incomplete` 收尾,缺漏不補零、不宣告完整。無法精確歸屬時保留缺漏診斷。 缺少資料來源或不支援格式時,HTML 明示 `unsupported`;中止、收集失敗或兩小時內未完整則保留診斷,不猜測用量、不影響測試 truth。不得在 chat 等待自己的回合結束;先交付連結。NuGet preflight 等尚未建立 run-state 的中止,明示「用量 observer 尚未啟動」。`tokenEstimateInputs` 仍只供既有角色讀寫 gates 使用。 run-state 初始化必須包含 `workflow: "aspire"`、`target`、`overallWallClock` 起點、空的 `phases`、`redispatchEvents: []`、`boundedRedispatchCount: 0`、`restartCount: 0`、`executorFixRounds: 0`。 > **run-state.json 寫入機制(必用,跨平台)**:run-state.json 一律透過 `shell_command` 呼叫 `node .codex/scripts/dotnet-testing-codex-full/run-state.mjs` 建立與更新。**不得**假設有「Write 工具」、**不得**用 `date -u`、**不得**手寫 shell read-modify-write。理由:Codex 沒有「Write」工具,且不同 runtime(Codex CLI vs VS Code Codex Extension)shell 不同;改善前 Extension 環境會整段略過 run-state 維護,導致 run-state.json 從不產生、各階段耗時全空。此腳本為純量參數 API(不傳 JSON blob,避免 PowerShell 引號問題),時間戳由腳本內部以系統時鐘產生(值寫 `@now` 即取 ISO 8601 UTC),毫秒差由 `--derive 欄位=END-START` 推導。以下 `{p}` 代表 `{testProjectDir}/.orchestrator/run-state.json`。常用呼叫: > > ```bash > # 初始化(Phase 0 清理後、啟動 Analyzer 前) > node .codex/scripts/dotnet-testing-codex-full/run-state.mjs init --path {p} --workflow aspire --target {target} > # dispatch 前:記 dispatchIssuedAt > node .codex/scripts/dotnet-testing-codex-full/run-state.mjs set --path {p} --phase analyzer --assignment {assignmentId} --set dispatchIssuedAt=@now --set target={target} --set agentDefinitionPath={tomlPath} --set expectedArtifactPath={artifactPath} --set contextForkPolicy=none --set externalMemoryPolicy=forbid > # 收到 agentId:記 agentId/dispatchAcceptedAt,推導 latency > node .codex/scripts/dotnet-testing-codex-full/run-state.mjs set --path {p} --phase analyzer --assignment {assignmentId} --set agentId={agentId} --set dispatchAcceptedAt=@now --derive dispatchAcceptLatencyMs=dispatchAcceptedAt-dispatchIssuedAt > # artifact 落地:記 artifactReadyAt/artifact,推導 produceSpan > node .codex/scripts/dotnet-testing-codex-full/run-state.mjs set --path {p} --phase analyzer --assignment {assignmentId} --set artifactReadyAt=@now --set artifact={artifactPath} --derive produceSpanMs=artifactReadyAt-dispatchAcceptedAt > # assignment gate 收斂:逐 assignment 記 completedAt
Auf GitHub ansehen
Diese SKILL.md ist sehr gross, daher zeigt SkillsMP hier nur den ersten Abschnitt. Auf GitHub ansehen