diff --git a/skills/gt-usage/references/commands.md b/skills/gt-usage/references/commands.md index b7d5662..e3f744d 100644 --- a/skills/gt-usage/references/commands.md +++ b/skills/gt-usage/references/commands.md @@ -91,6 +91,9 @@ gt issue edit --title "" -m # Close an issue gt issue close + +# Log elapsed implementation time (seconds) to an issue without a global stopwatch lock +gt api -X POST /repos/{owner}/{repo}/issues//times -F time= ``` ## 5. Pull Requests diff --git a/skills/implement-slice/SKILL.md b/skills/implement-slice/SKILL.md index 6e7e0d5..5f14db0 100644 --- a/skills/implement-slice/SKILL.md +++ b/skills/implement-slice/SKILL.md @@ -20,10 +20,10 @@ description: >- 1. **Preflight branch check, readiness audit, and `Backlog -> Ready`.** Check session mode per `profile/AGENTS.md`. Classify working tree per [handoff-contracts](references/handoff-contracts.md) (`CLEAN_BASE`, `ADOPTABLE_DIFF`, `CONFLICTING_STATE`, `WRONG_BASE`). Stop on conflicts. Read target Gitea issue/milestone/board state via `gt issue`, `gt milestone`, direction docs (`ARCHITECTURE.md`, `ROADMAP.md`, `docs/designs/*.md`, `AGENTS.md`), and `git status --short`. Reconcile issue acceptance criteria against current `HEAD` (handing off to `reconcile-docs` if canonical design docs drifted during upstream slices, or updating the Gitea issue after owner approval) and, when `--dry-run` is not active, move the issue card `Backlog -> Ready` on the project board. Hand off to `gitea-plan` if tracking issues must be created first. 2. **Select orchestration topology (`complexity x risk`).** Combine planning size with assurance risk per [orchestration-tiers](references/orchestration-tiers.md). Keep pure-orchestrator invariants: retain plan, status, commit SHAs, QA dispositions, blockers; never edit implementation files, repair Git via code edits, self-certify QA, or ingest full test logs unless resolving a failure. 3. **Lock Planned Workflow and pre-committed rubrics.** Formulate the Planned Workflow using the Canonical Node Schema (5-tuples: `node_id`, `claim`, `method`, `executor`, `pass_condition`), decomposing multi-module slices into bottom-up vertical per-submodule `Red -> Green` tasks rather than horizontal "all tests first, all code second" batching per [orchestration-tiers](references/orchestration-tiers.md). Project a dynamic Mermaid diagram deriving directly from node IDs with visible rework edges. If `--dry-run` is active, halt after displaying the plan (enforce 0 file changes, 0 commits, 0 remote calls). Hard gate: pause for human approval. -4. **Move card `Ready -> Work in Progress`, assign workspaces, and delegate.** Once the human approves Step 3, move the issue card `Ready -> Work in Progress` on the project board per [handoff-contracts](references/handoff-contracts.md). Govern branch/worktree lifecycle through `git-manager` per [orchestration-tiers](references/orchestration-tiers.md). Dispatch worker subagent(s) with the Implementation Assignment in [handoff-contracts](references/handoff-contracts.md). Never run concurrent workers in the same working tree. Update the runtime Execution Record table as nodes change state. +4. **Move card `Ready -> Work in Progress`, start slice clock, and delegate.** Once the human approves Step 3, move the issue card `Ready -> Work in Progress` on the project board and record `started_at=$(date +%s)` per [handoff-contracts](references/handoff-contracts.md). Govern branch/worktree lifecycle through `git-manager` per [orchestration-tiers](references/orchestration-tiers.md). Dispatch worker subagent(s) with the Implementation Assignment in [handoff-contracts](references/handoff-contracts.md). Never run concurrent workers in the same working tree. Update the runtime Execution Record table as nodes change state. 5. **Audit worker reports and run rubric QA.** Verify worker reports via read-only Git checks. Spawn read-only QA subagents running `verify-slice` against pre-committed rubrics. Update Execution Record with concrete evidence (SHA, exit codes). 6. **Triage outcomes and route rework.** Classify failures using [handoff-contracts](references/handoff-contracts.md): route code defects to existing worker via `send_message`; record justified rubric amendments if criteria change. Loop Steps 4-6 until all nodes pass. -7. **Enforce final-HEAD evidence, move card `Work in Progress -> Review`, and integrate.** Confirm `code-review` (`Ready`) and `verify-slice` match the exact final `HEAD` and base, then move the issue card `Work in Progress -> Review` on the project board. Present the Execution Deviation Report (skipped/added checks, rework iterations, scope drift; if scope drift evolved a contract in `docs/designs/*.md` or `ARCHITECTURE.md`, prompt to run `reconcile-docs` before the next slice). Integrate per [orchestration-tiers](references/orchestration-tiers.md) Policy Matrix: fast-forward merge (and move card `Review -> Completed`) if repo `AGENTS.md` permits and user approves, else hand off to `gitea-pr`. +7. **Enforce final-HEAD evidence, log elapsed time, move card `Work in Progress -> Review`, and integrate.** Confirm `code-review` (`Ready`) and `verify-slice` match the exact final `HEAD` and base, log elapsed issue time (`POST .../issues//times`) and move the issue card `Work in Progress -> Review` on the project board per [handoff-contracts](references/handoff-contracts.md). Present the Execution Deviation Report (skipped/added checks, rework iterations, scope drift; if scope drift evolved a contract in `docs/designs/*.md` or `ARCHITECTURE.md`, prompt to run `reconcile-docs` before the next slice). Integrate per [orchestration-tiers](references/orchestration-tiers.md) Policy Matrix: fast-forward merge (and move card `Review -> Completed`) if repo `AGENTS.md` permits and user approves, else hand off to `gitea-pr`. ## Your call - **Session mode**: decide whether to switch from `learning` to `delivery` before autonomous delegation. diff --git a/skills/implement-slice/references/handoff-contracts.md b/skills/implement-slice/references/handoff-contracts.md index 0a3906e..5ded128 100644 --- a/skills/implement-slice/references/handoff-contracts.md +++ b/skills/implement-slice/references/handoff-contracts.md @@ -142,6 +142,6 @@ When the repository tracks a Gitea Project Board (resolved from the `AGENTS.md` | Step | Transition | Condition | | :--- | :--- | :--- | | **Step 1 (Preflight & Readiness)** | `Backlog -> Ready` | Blocking issues are closed, issue acceptance criteria are reconciled against current `HEAD` and `AGENTS.md`, and `--dry-run` is **not** active. | -| **Step 4 (Worker Delegation)** | `Ready -> Work in Progress` | Human owner approved the Step 3 Planned Workflow and implementation branch/worker starts. | -| **Step 7 (Final-HEAD Gate)** | `Work in Progress -> Review` | Final-`HEAD` `code-review` (`Ready`) and `verify-slice` pass with zero unhandled `FAIL` outcomes. | +| **Step 4 (Worker Delegation)** | `Ready -> Work in Progress` | Human owner approved the Step 3 Planned Workflow and implementation branch/worker starts. Also record `started_at=$(date +%s)` in the Execution Record (never use Gitea's global `stopwatch/start`, which blocks parallel issues with `409 Conflict`). | +| **Step 7 (Final-HEAD Gate)** | `Work in Progress -> Review` | Final-`HEAD` `code-review` (`Ready`) and `verify-slice` pass with zero unhandled `FAIL` outcomes. Compute `elapsed=$(( $(date +%s) - started_at ))` (when `started_at` was recorded and `elapsed > 0`) and log it to the issue via `gt api -X POST /repos/{owner}/{repo}/issues//times -F time=${elapsed}`. | | **Step 7 (Direct Merge Only)** | `Review -> Completed` | Only when repository policy permits direct fast-forward merge to `main`, human owner approves, and the issue is closed. Otherwise `gitea-pr` owns `Review -> Completed`. | diff --git a/tests/fixtures/test_skills_behavioral_contracts.py b/tests/fixtures/test_skills_behavioral_contracts.py index 6d62c8a..d36fc17 100755 --- a/tests/fixtures/test_skills_behavioral_contracts.py +++ b/tests/fixtures/test_skills_behavioral_contracts.py @@ -396,6 +396,15 @@ class TestSkillsBehavioralContracts(unittest.TestCase): self.assertNotIn("### Publish a `code-review` Comment Block", pr_pulls) self.assertIn("/orgs//projects//issues//move", (REPO_ROOT / "skills" / "implement-slice" / "references" / "handoff-contracts.md").read_text()) + # Elapsed issue time tracking uses lock-free POST .../times rather than global stopwatch/start + gt_cmds = (REPO_ROOT / "skills" / "gt-usage" / "references" / "commands.md").read_text() + impl_skill = (REPO_ROOT / "skills" / "implement-slice" / "SKILL.md").read_text() + impl_handoff = (REPO_ROOT / "skills" / "implement-slice" / "references" / "handoff-contracts.md").read_text() + self.assertIn("/issues//times", gt_cmds) + self.assertIn("started_at=$(date +%s)", impl_skill) + self.assertIn("/issues//times", impl_handoff) + self.assertNotIn("stopwatch/start", impl_skill) + def test_project_board_reconciliation_and_card_transitions(self): """Proves 5-column board reconciliation, Deep Signal colors, and card transition ownership.""" tiers_text = (REPO_ROOT / "skills" / "gitea-plan" / "references" / "decomposition-tiers.md").read_text()