prizmkit 1.1.190 → 1.1.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-prizmkit.js +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
- package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
- package/bundled/adapters/antigravity/paths.js +14 -0
- package/bundled/adapters/antigravity/rules-adapter.js +54 -0
- package/bundled/adapters/antigravity/skill-adapter.js +38 -0
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +21 -15
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +29 -70
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -442
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +49 -18
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +282 -217
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +369 -154
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
- package/bundled/dev-pipeline/scripts/continuation.py +6 -4
- package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2328
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +10 -15
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/dev-pipeline/tests/_helpers.py +418 -0
- package/bundled/dev-pipeline/tests/conftest.py +45 -1
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
- package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +561 -3094
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
- package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
- package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
- package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +490 -2006
- package/bundled/dev-pipeline/tests/test_utils.py +3 -3
- package/bundled/rules/USAGE.md +1 -0
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +25 -128
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/ai-cli-launch.js +1 -1
- package/src/clean.js +40 -4
- package/src/config.js +64 -4
- package/src/detect-platform.js +10 -6
- package/src/external-skills.js +2 -2
- package/src/index.js +1 -0
- package/src/manifest.js +1 -1
- package/src/platforms.js +6 -2
- package/src/prompts.js +11 -3
- package/src/scaffold.js +87 -11
- package/src/upgrade.js +9 -3
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
|
@@ -24,38 +24,52 @@ import json
|
|
|
24
24
|
import os
|
|
25
25
|
import shutil
|
|
26
26
|
import sys
|
|
27
|
-
from datetime import datetime, timezone
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
29
|
+
if _SCRIPTS_DIR not in sys.path:
|
|
30
|
+
sys.path.insert(0, _SCRIPTS_DIR)
|
|
31
|
+
|
|
32
|
+
from status_common import ( # noqa: E402
|
|
33
|
+
CONTINUATION_COUNTER_FIELDS as CONTINUATION_COUNTER_FIELDS,
|
|
34
|
+
CONTINUATION_PENDING_FIELDS as CONTINUATION_PENDING_FIELDS,
|
|
35
|
+
SEMANTIC_CHECKPOINT_FIELDS as SEMANTIC_CHECKPOINT_FIELDS,
|
|
36
|
+
SESSION_STATUS_VALUES as SESSION_STATUS_VALUES,
|
|
37
|
+
STALL_REASON as STALL_REASON,
|
|
38
|
+
_default_project_root as _default_project_root,
|
|
39
|
+
_load_checkpoint_state as _load_checkpoint_state,
|
|
40
|
+
_load_progress_fingerprint as _load_progress_fingerprint,
|
|
41
|
+
_resolve_project_file as _resolve_project_file,
|
|
42
|
+
_set_ai_error_continuation_metadata as _set_ai_error_continuation_metadata,
|
|
43
|
+
_sync_semantic_checkpoint as _sync_semantic_checkpoint,
|
|
44
|
+
action_pause as _common_action_pause,
|
|
45
|
+
auto_skip_blocked_items,
|
|
46
|
+
cleanup_continuation_artifacts as cleanup_continuation_artifacts,
|
|
47
|
+
clear_pending_continuation_metadata as clear_pending_continuation_metadata,
|
|
48
|
+
continuation_metadata_summary as continuation_metadata_summary,
|
|
49
|
+
get_item_status_from_list,
|
|
50
|
+
has_pending_continuation_metadata as has_pending_continuation_metadata,
|
|
51
|
+
load_item_status,
|
|
52
|
+
load_session_status as load_session_status,
|
|
53
|
+
now_iso as now_iso,
|
|
54
|
+
read_checkpoint_phase,
|
|
55
|
+
reconcile_orphaned_auto_skipped_items,
|
|
56
|
+
reset_continuation_metadata as reset_continuation_metadata,
|
|
57
|
+
save_item_status,
|
|
58
|
+
set_context_overflow_continuation_metadata as _common_set_context_overflow,
|
|
59
|
+
set_stalled_context_continuation_metadata as _common_set_stalled_context,
|
|
60
|
+
update_item_in_list,
|
|
61
|
+
)
|
|
62
|
+
from utils import ( # noqa: E402
|
|
30
63
|
load_json_file,
|
|
31
64
|
write_json_file,
|
|
32
65
|
error_out,
|
|
33
66
|
pad_right,
|
|
34
67
|
_build_progress_bar,
|
|
35
|
-
read_checkpoint_cursor,
|
|
36
68
|
dependency_rank_map,
|
|
37
69
|
causal_reset_selection,
|
|
38
70
|
orphaned_auto_skipped_ids,
|
|
39
71
|
)
|
|
40
72
|
|
|
41
|
-
|
|
42
|
-
SESSION_STATUS_VALUES = [
|
|
43
|
-
"success",
|
|
44
|
-
"partial_resumable",
|
|
45
|
-
"partial_not_resumable",
|
|
46
|
-
"failed",
|
|
47
|
-
"crashed",
|
|
48
|
-
"timed_out",
|
|
49
|
-
"infra_error",
|
|
50
|
-
"context_overflow",
|
|
51
|
-
"stalled_context_continuation",
|
|
52
|
-
"workflow_blocked",
|
|
53
|
-
"workflow_skipped",
|
|
54
|
-
"commit_missing",
|
|
55
|
-
"docs_missing",
|
|
56
|
-
"merge_conflict",
|
|
57
|
-
]
|
|
58
|
-
|
|
59
73
|
TERMINAL_STATUSES = {"completed", "failed", "skipped", "needs_info", "auto_skipped"}
|
|
60
74
|
RESET_BLOCKING_ROOT_STATUSES = {"failed", "skipped", "needs_info"}
|
|
61
75
|
|
|
@@ -98,144 +112,36 @@ def parse_args():
|
|
|
98
112
|
return parser.parse_args()
|
|
99
113
|
|
|
100
114
|
|
|
101
|
-
def now_iso():
|
|
102
|
-
return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
103
|
-
|
|
104
|
-
|
|
105
115
|
def load_bug_status(state_dir, bug_id):
|
|
106
|
-
"""Load runtime state from status.json for a bug.
|
|
107
|
-
|
|
108
|
-
Returns runtime fields only (retry_count, sessions, etc.).
|
|
109
|
-
The 'status' field is NOT included — status lives exclusively
|
|
110
|
-
in bug-fix-list.json.
|
|
111
|
-
"""
|
|
112
|
-
status_path = os.path.join(state_dir, bug_id, "status.json")
|
|
113
|
-
if not os.path.isfile(status_path):
|
|
114
|
-
now = now_iso()
|
|
115
|
-
return {
|
|
116
|
-
"bug_id": bug_id,
|
|
117
|
-
"retry_count": 0,
|
|
118
|
-
"max_retries": 3,
|
|
119
|
-
"max_infra_retries": 3,
|
|
120
|
-
"infra_error_count": 0,
|
|
121
|
-
"last_infra_error_session_id": None,
|
|
122
|
-
"sessions": [],
|
|
123
|
-
"last_session_id": None,
|
|
124
|
-
"resume_from_phase": None,
|
|
125
|
-
"created_at": now,
|
|
126
|
-
"updated_at": now,
|
|
127
|
-
}
|
|
128
|
-
data, err = load_json_file(status_path)
|
|
129
|
-
if err:
|
|
130
|
-
now = now_iso()
|
|
131
|
-
return {
|
|
132
|
-
"bug_id": bug_id,
|
|
133
|
-
"retry_count": 0,
|
|
134
|
-
"max_retries": 3,
|
|
135
|
-
"max_infra_retries": 3,
|
|
136
|
-
"infra_error_count": 0,
|
|
137
|
-
"last_infra_error_session_id": None,
|
|
138
|
-
"sessions": [],
|
|
139
|
-
"last_session_id": None,
|
|
140
|
-
"resume_from_phase": None,
|
|
141
|
-
"created_at": now,
|
|
142
|
-
"updated_at": now,
|
|
143
|
-
}
|
|
144
|
-
# Defensively remove status if present (legacy data)
|
|
145
|
-
data.pop("status", None)
|
|
146
|
-
return data
|
|
116
|
+
"""Load runtime state from status.json for a bug."""
|
|
117
|
+
return load_item_status(state_dir, bug_id, id_key="bug_id")
|
|
147
118
|
|
|
148
119
|
|
|
149
120
|
def save_bug_status(state_dir, bug_id, status_data):
|
|
150
121
|
"""Write the status.json for a bug (runtime fields only)."""
|
|
151
|
-
|
|
152
|
-
status_data.pop("status", None)
|
|
153
|
-
status_path = os.path.join(state_dir, bug_id, "status.json")
|
|
154
|
-
return write_json_file(status_path, status_data)
|
|
122
|
+
return save_item_status(state_dir, bug_id, status_data, write_json_fn=write_json_file)
|
|
155
123
|
|
|
156
124
|
|
|
157
125
|
def get_bug_status_from_list(bug_list_path, bug_id):
|
|
158
126
|
"""Read a single bug's status from bug-fix-list.json."""
|
|
159
|
-
|
|
160
|
-
if err:
|
|
161
|
-
return "pending"
|
|
162
|
-
for b in data.get("bugs", []):
|
|
163
|
-
if isinstance(b, dict) and b.get("id") == bug_id:
|
|
164
|
-
return b.get("status", "pending")
|
|
165
|
-
return "pending"
|
|
127
|
+
return get_item_status_from_list(bug_list_path, bug_id, list_key="bugs")
|
|
166
128
|
|
|
167
129
|
|
|
168
130
|
def update_bug_in_list(bug_list_path, bug_id, new_status):
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
break
|
|
179
|
-
if not found:
|
|
180
|
-
return "Bug '{}' not found in .prizmkit/plans/bug-fix-list.json".format(bug_id)
|
|
181
|
-
return write_json_file(bug_list_path, data)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
CONTINUATION_PENDING_FIELDS = [
|
|
185
|
-
"active_dev_branch",
|
|
186
|
-
"base_branch",
|
|
187
|
-
"continuation_pending",
|
|
188
|
-
"continuation_reason",
|
|
189
|
-
"last_context_overflow_session_id",
|
|
190
|
-
"previous_session_id",
|
|
191
|
-
"last_fatal_error_code",
|
|
192
|
-
"continuation_summary_path",
|
|
193
|
-
"no_progress_count",
|
|
194
|
-
"last_progress_fingerprint",
|
|
195
|
-
"needs_attention",
|
|
196
|
-
"stalled_context_continuation",
|
|
197
|
-
"stalled_reason",
|
|
198
|
-
]
|
|
199
|
-
|
|
200
|
-
CONTINUATION_COUNTER_FIELDS = [
|
|
201
|
-
"context_overflow_count",
|
|
202
|
-
"continuation_count",
|
|
203
|
-
]
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def has_pending_continuation_metadata(status_data):
|
|
207
|
-
"""Return True when runtime state still has pending continuation metadata."""
|
|
208
|
-
return any(key in status_data for key in CONTINUATION_PENDING_FIELDS)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def clear_pending_continuation_metadata(status_data):
|
|
212
|
-
"""Clear branch/pending continuation fields while preserving observability counters."""
|
|
213
|
-
for key in CONTINUATION_PENDING_FIELDS:
|
|
214
|
-
status_data.pop(key, None)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
def reset_continuation_metadata(status_data):
|
|
218
|
-
"""Clear all continuation runtime metadata, including manual-reset counters."""
|
|
219
|
-
clear_pending_continuation_metadata(status_data)
|
|
220
|
-
for key in CONTINUATION_COUNTER_FIELDS:
|
|
221
|
-
status_data.pop(key, None)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
STALL_REASON = "context_overflow_without_git_checkpoint_or_artifact_progress"
|
|
131
|
+
return update_item_in_list(
|
|
132
|
+
bug_list_path,
|
|
133
|
+
bug_id,
|
|
134
|
+
new_status,
|
|
135
|
+
list_key="bugs",
|
|
136
|
+
item_label="Bug",
|
|
137
|
+
list_display_path=".prizmkit/plans/bug-fix-list.json",
|
|
138
|
+
write_json_fn=write_json_file,
|
|
139
|
+
)
|
|
225
140
|
|
|
226
141
|
|
|
227
142
|
def _read_bugfix_checkpoint_phase(project_root, bug_id):
|
|
228
|
-
"""Read the phase index from the bugfix checkpoint file.
|
|
229
|
-
|
|
230
|
-
Returns an integer step index (e.g., 3 for S03) or None if the checkpoint
|
|
231
|
-
is not available. The value is consumed by the terminal status display as
|
|
232
|
-
``CP-BF-<n>``.
|
|
233
|
-
"""
|
|
234
|
-
checkpoint_path = os.path.join(
|
|
235
|
-
os.path.abspath(project_root) if project_root else _default_project_root(),
|
|
236
|
-
".prizmkit", "bugfix", bug_id, "workflow-checkpoint.json",
|
|
237
|
-
)
|
|
238
|
-
return read_checkpoint_cursor(checkpoint_path)
|
|
143
|
+
"""Read the phase index from the bugfix checkpoint file."""
|
|
144
|
+
return read_checkpoint_phase(project_root, "bugfix", bug_id)
|
|
239
145
|
|
|
240
146
|
|
|
241
147
|
def _checkpoint_phase_or_cached(project_root, bug_id, status_data):
|
|
@@ -251,140 +157,24 @@ def _sync_checkpoint_phase(project_root, bug_id, status_data):
|
|
|
251
157
|
return status_data.get("resume_from_phase")
|
|
252
158
|
|
|
253
159
|
|
|
254
|
-
def _load_progress_fingerprint(raw):
|
|
255
|
-
if not raw:
|
|
256
|
-
return None
|
|
257
|
-
try:
|
|
258
|
-
return json.loads(raw)
|
|
259
|
-
except (TypeError, ValueError):
|
|
260
|
-
return {"unparsed": str(raw)}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
SEMANTIC_CHECKPOINT_FIELDS = (
|
|
264
|
-
"current_stage",
|
|
265
|
-
"next_stage",
|
|
266
|
-
"stage_result",
|
|
267
|
-
"repair_scope",
|
|
268
|
-
"repair_round",
|
|
269
|
-
"blocked_reason",
|
|
270
|
-
"terminal_status",
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
def _load_checkpoint_state(raw):
|
|
275
|
-
if not raw:
|
|
276
|
-
return {}
|
|
277
|
-
try:
|
|
278
|
-
data = json.loads(raw)
|
|
279
|
-
except (TypeError, ValueError):
|
|
280
|
-
return {}
|
|
281
|
-
if not isinstance(data, dict):
|
|
282
|
-
return {}
|
|
283
|
-
return {key: data.get(key) for key in SEMANTIC_CHECKPOINT_FIELDS}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
def _sync_semantic_checkpoint(status_data, args):
|
|
287
|
-
semantic = _load_checkpoint_state(getattr(args, "checkpoint_state", None))
|
|
288
|
-
if semantic:
|
|
289
|
-
status_data.update(semantic)
|
|
290
|
-
return {key: status_data.get(key) for key in SEMANTIC_CHECKPOINT_FIELDS}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
def _set_continuation_common(status_data, args, session_id):
|
|
294
|
-
if args.active_dev_branch:
|
|
295
|
-
status_data["active_dev_branch"] = args.active_dev_branch
|
|
296
|
-
if args.base_branch:
|
|
297
|
-
status_data["base_branch"] = args.base_branch
|
|
298
|
-
status_data["last_context_overflow_session_id"] = session_id
|
|
299
|
-
status_data["previous_session_id"] = session_id
|
|
300
|
-
status_data["last_fatal_error_code"] = args.last_fatal_error_code or "context_overflow"
|
|
301
|
-
if args.continuation_summary_path:
|
|
302
|
-
status_data["continuation_summary_path"] = args.continuation_summary_path
|
|
303
|
-
else:
|
|
304
|
-
status_data.pop("continuation_summary_path", None)
|
|
305
|
-
if args.no_progress_count is not None:
|
|
306
|
-
status_data["no_progress_count"] = max(0, args.no_progress_count)
|
|
307
|
-
fingerprint = _load_progress_fingerprint(args.progress_fingerprint)
|
|
308
|
-
if fingerprint is not None:
|
|
309
|
-
status_data["last_progress_fingerprint"] = fingerprint
|
|
310
|
-
status_data["last_infra_error_session_id"] = None
|
|
311
|
-
status_data["resume_from_phase"] = None
|
|
312
|
-
if session_id:
|
|
313
|
-
status_data["last_session_id"] = session_id
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
def _set_ai_error_continuation_metadata(status_data, args, session_id, reason):
|
|
317
|
-
"""Preserve durable task/session state for any retryable launched AI error."""
|
|
318
|
-
if args.active_dev_branch:
|
|
319
|
-
status_data["active_dev_branch"] = args.active_dev_branch
|
|
320
|
-
if args.base_branch:
|
|
321
|
-
status_data["base_branch"] = args.base_branch
|
|
322
|
-
status_data["continuation_pending"] = True
|
|
323
|
-
status_data["continuation_reason"] = reason
|
|
324
|
-
status_data["continuation_count"] = status_data.get("continuation_count", 0) + 1
|
|
325
|
-
status_data["previous_session_id"] = session_id
|
|
326
|
-
status_data["last_fatal_error_code"] = args.last_fatal_error_code or reason
|
|
327
|
-
if args.continuation_summary_path:
|
|
328
|
-
status_data["continuation_summary_path"] = args.continuation_summary_path
|
|
329
|
-
if args.no_progress_count is not None:
|
|
330
|
-
status_data["no_progress_count"] = max(0, args.no_progress_count)
|
|
331
|
-
fingerprint = _load_progress_fingerprint(args.progress_fingerprint)
|
|
332
|
-
if fingerprint is not None:
|
|
333
|
-
status_data["last_progress_fingerprint"] = fingerprint
|
|
334
|
-
status_data["resume_from_phase"] = None
|
|
335
|
-
if session_id:
|
|
336
|
-
sessions = status_data.get("sessions", [])
|
|
337
|
-
if session_id not in sessions:
|
|
338
|
-
sessions.append(session_id)
|
|
339
|
-
status_data["sessions"] = sessions
|
|
340
|
-
status_data["last_session_id"] = session_id
|
|
341
|
-
|
|
342
|
-
|
|
343
160
|
def set_context_overflow_continuation_metadata(status_data, args, session_id):
|
|
344
161
|
"""Record continuation metadata for a context-overflow outcome in status.json."""
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
status_data.pop("stalled_reason", None)
|
|
352
|
-
_set_continuation_common(status_data, args, session_id)
|
|
162
|
+
return _common_set_context_overflow(
|
|
163
|
+
status_data,
|
|
164
|
+
args,
|
|
165
|
+
session_id,
|
|
166
|
+
pop_infra_error_session=False,
|
|
167
|
+
)
|
|
353
168
|
|
|
354
169
|
|
|
355
170
|
def set_stalled_context_continuation_metadata(status_data, args, session_id):
|
|
356
171
|
"""Record no-progress context-overflow stall without consuming retry budgets."""
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
status_data["stalled_context_continuation"] = True
|
|
364
|
-
status_data["stalled_reason"] = STALL_REASON
|
|
365
|
-
if args.no_progress_count is None or args.no_progress_count < 2:
|
|
366
|
-
status_data["no_progress_count"] = 2
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
def continuation_metadata_summary(status_data):
|
|
370
|
-
"""Return additive continuation fields for CLI JSON outputs."""
|
|
371
|
-
return {
|
|
372
|
-
"active_dev_branch": status_data.get("active_dev_branch"),
|
|
373
|
-
"base_branch": status_data.get("base_branch"),
|
|
374
|
-
"continuation_pending": status_data.get("continuation_pending", False),
|
|
375
|
-
"continuation_reason": status_data.get("continuation_reason"),
|
|
376
|
-
"last_context_overflow_session_id": status_data.get("last_context_overflow_session_id"),
|
|
377
|
-
"last_fatal_error_code": status_data.get("last_fatal_error_code"),
|
|
378
|
-
"previous_session_id": status_data.get("previous_session_id"),
|
|
379
|
-
"context_overflow_count": status_data.get("context_overflow_count", 0),
|
|
380
|
-
"continuation_count": status_data.get("continuation_count", 0),
|
|
381
|
-
"no_progress_count": status_data.get("no_progress_count", 0),
|
|
382
|
-
"last_progress_fingerprint": status_data.get("last_progress_fingerprint"),
|
|
383
|
-
"needs_attention": status_data.get("needs_attention", False),
|
|
384
|
-
"stalled_context_continuation": status_data.get("stalled_context_continuation", False),
|
|
385
|
-
"stalled_reason": status_data.get("stalled_reason"),
|
|
386
|
-
"continuation_summary_path": status_data.get("continuation_summary_path"),
|
|
387
|
-
}
|
|
172
|
+
return _common_set_stalled_context(
|
|
173
|
+
status_data,
|
|
174
|
+
args,
|
|
175
|
+
session_id,
|
|
176
|
+
pop_infra_error_session=False,
|
|
177
|
+
)
|
|
388
178
|
|
|
389
179
|
|
|
390
180
|
# ---------------------------------------------------------------------------
|
|
@@ -393,125 +183,36 @@ def continuation_metadata_summary(status_data):
|
|
|
393
183
|
|
|
394
184
|
def auto_skip_blocked_bugs(bug_list_path, state_dir, blocking_bug_id=None):
|
|
395
185
|
"""Mark pending descendants of terminal Bugfix blockers as auto_skipped."""
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
changed = False
|
|
411
|
-
for bug in bugs:
|
|
412
|
-
if not isinstance(bug, dict):
|
|
413
|
-
continue
|
|
414
|
-
bug_id = bug.get("id")
|
|
415
|
-
if not bug_id or bug_id in to_skip:
|
|
416
|
-
continue
|
|
417
|
-
if status_map.get(bug_id, "pending") != "pending":
|
|
418
|
-
continue
|
|
419
|
-
dependencies = bug.get("dependencies", [])
|
|
420
|
-
if not isinstance(dependencies, list):
|
|
421
|
-
continue
|
|
422
|
-
if any(
|
|
423
|
-
status_map.get(dependency_id, "pending")
|
|
424
|
-
in RESET_BLOCKING_ROOT_STATUSES | {"auto_skipped"}
|
|
425
|
-
or dependency_id in to_skip
|
|
426
|
-
for dependency_id in dependencies
|
|
427
|
-
):
|
|
428
|
-
to_skip.add(bug_id)
|
|
429
|
-
status_map[bug_id] = "auto_skipped"
|
|
430
|
-
changed = True
|
|
431
|
-
|
|
432
|
-
if not to_skip:
|
|
433
|
-
return []
|
|
434
|
-
|
|
435
|
-
for bug in bugs:
|
|
436
|
-
if isinstance(bug, dict) and bug.get("id") in to_skip:
|
|
437
|
-
bug["status"] = "auto_skipped"
|
|
438
|
-
err = write_json_file(bug_list_path, data)
|
|
439
|
-
if err:
|
|
440
|
-
error_out("Failed to write auto-skipped bugs: {}".format(err))
|
|
441
|
-
return []
|
|
442
|
-
|
|
443
|
-
for bug_id in to_skip:
|
|
444
|
-
bs = load_bug_status(state_dir, bug_id)
|
|
445
|
-
bs["updated_at"] = now_iso()
|
|
446
|
-
err = save_bug_status(state_dir, bug_id, bs)
|
|
447
|
-
if err:
|
|
448
|
-
error_out("Failed to save auto-skipped bug status: {}".format(err))
|
|
449
|
-
return []
|
|
450
|
-
|
|
451
|
-
skipped_info = []
|
|
452
|
-
for bug in bugs:
|
|
453
|
-
if not isinstance(bug, dict) or bug.get("id") not in to_skip:
|
|
454
|
-
continue
|
|
455
|
-
dependencies = bug.get("dependencies", [])
|
|
456
|
-
blockers = [
|
|
457
|
-
dependency_id
|
|
458
|
-
for dependency_id in dependencies
|
|
459
|
-
if dependency_id == blocking_bug_id
|
|
460
|
-
or status_map.get(dependency_id, "pending")
|
|
461
|
-
in RESET_BLOCKING_ROOT_STATUSES | {"auto_skipped"}
|
|
462
|
-
]
|
|
463
|
-
skipped_info.append({
|
|
464
|
-
"bug_id": bug["id"],
|
|
465
|
-
"title": bug.get("title", ""),
|
|
466
|
-
"blocked_by": blockers,
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
cause = blocking_bug_id or "existing terminal blockers"
|
|
470
|
-
print(
|
|
471
|
-
"[auto-skip] {} bug(s) auto-skipped due to {}".format(
|
|
472
|
-
len(skipped_info), cause
|
|
473
|
-
),
|
|
474
|
-
file=sys.stderr,
|
|
186
|
+
return auto_skip_blocked_items(
|
|
187
|
+
bug_list_path,
|
|
188
|
+
state_dir,
|
|
189
|
+
blocking_bug_id,
|
|
190
|
+
list_key="bugs",
|
|
191
|
+
id_key="bug_id",
|
|
192
|
+
blocking_statuses=RESET_BLOCKING_ROOT_STATUSES,
|
|
193
|
+
skip_only_when_status="pending",
|
|
194
|
+
error_on_load=True,
|
|
195
|
+
error_on_write=True,
|
|
196
|
+
load_load_label="bug fix list",
|
|
197
|
+
item_noun="bug",
|
|
198
|
+
detailed_stderr=False,
|
|
199
|
+
write_json_fn=write_json_file,
|
|
475
200
|
)
|
|
476
|
-
return skipped_info
|
|
477
201
|
|
|
478
202
|
|
|
479
203
|
def reconcile_orphaned_auto_skipped_bugs(bug_list_path, state_dir):
|
|
480
204
|
"""Restore auto-skipped bugs that have no current blocking root."""
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
bugs,
|
|
205
|
+
return reconcile_orphaned_auto_skipped_items(
|
|
206
|
+
bug_list_path,
|
|
207
|
+
state_dir,
|
|
208
|
+
list_key="bugs",
|
|
209
|
+
id_key="bug_id",
|
|
487
210
|
blocking_root_statuses=RESET_BLOCKING_ROOT_STATUSES,
|
|
488
211
|
item_label="Bug",
|
|
212
|
+
item_noun="bug",
|
|
213
|
+
list_noun="bug fix list",
|
|
214
|
+
write_json_fn=write_json_file,
|
|
489
215
|
)
|
|
490
|
-
if not orphan_ids:
|
|
491
|
-
return []
|
|
492
|
-
|
|
493
|
-
orphan_set = set(orphan_ids)
|
|
494
|
-
for bug in bugs:
|
|
495
|
-
if isinstance(bug, dict) and bug.get("id") in orphan_set:
|
|
496
|
-
bug["status"] = "pending"
|
|
497
|
-
err = write_json_file(bug_list_path, data)
|
|
498
|
-
if err:
|
|
499
|
-
raise RuntimeError("Failed to recover orphaned bugs: {}".format(err))
|
|
500
|
-
|
|
501
|
-
for bug_id in orphan_ids:
|
|
502
|
-
bs = load_bug_status(state_dir, bug_id)
|
|
503
|
-
bs["updated_at"] = now_iso()
|
|
504
|
-
err = save_bug_status(state_dir, bug_id, bs)
|
|
505
|
-
if err:
|
|
506
|
-
raise RuntimeError("Failed to save recovered bug status: {}".format(err))
|
|
507
|
-
|
|
508
|
-
print(
|
|
509
|
-
"[auto-skip] recovered {} orphaned bug(s): {}".format(
|
|
510
|
-
len(orphan_ids), ", ".join(orphan_ids)
|
|
511
|
-
),
|
|
512
|
-
file=sys.stderr,
|
|
513
|
-
)
|
|
514
|
-
return list(orphan_ids)
|
|
515
216
|
|
|
516
217
|
|
|
517
218
|
# ---------------------------------------------------------------------------
|
|
@@ -896,18 +597,6 @@ def action_update(args, bug_list_path, state_dir):
|
|
|
896
597
|
print(json.dumps(summary, indent=2, ensure_ascii=False))
|
|
897
598
|
|
|
898
599
|
|
|
899
|
-
def _default_project_root():
|
|
900
|
-
env = os.environ.get("PROJECT_ROOT")
|
|
901
|
-
if env:
|
|
902
|
-
return os.path.abspath(env)
|
|
903
|
-
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
904
|
-
pipeline_dir = os.path.dirname(script_dir)
|
|
905
|
-
pipeline_parent = os.path.dirname(pipeline_dir)
|
|
906
|
-
if os.path.basename(pipeline_parent) == ".prizmkit":
|
|
907
|
-
return os.path.dirname(pipeline_parent)
|
|
908
|
-
return pipeline_parent
|
|
909
|
-
|
|
910
|
-
|
|
911
600
|
def cleanup_bug_artifacts(state_dir, bug_id, project_root=None):
|
|
912
601
|
"""Delete intermediate artifacts for a failed bug run."""
|
|
913
602
|
if not project_root:
|
|
@@ -959,55 +648,6 @@ def cleanup_bug_artifacts(state_dir, bug_id, project_root=None):
|
|
|
959
648
|
return cleaned
|
|
960
649
|
|
|
961
650
|
|
|
962
|
-
def _resolve_project_file(project_root, path):
|
|
963
|
-
if not path:
|
|
964
|
-
return None
|
|
965
|
-
if os.path.isabs(path):
|
|
966
|
-
target = os.path.abspath(path)
|
|
967
|
-
else:
|
|
968
|
-
target = os.path.abspath(os.path.join(project_root, path))
|
|
969
|
-
root = os.path.abspath(project_root)
|
|
970
|
-
try:
|
|
971
|
-
rel = os.path.relpath(target, root)
|
|
972
|
-
except ValueError:
|
|
973
|
-
return None
|
|
974
|
-
if rel == os.pardir or rel.startswith(os.pardir + os.sep):
|
|
975
|
-
return None
|
|
976
|
-
return target
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
def cleanup_continuation_artifacts(project_root, status_data, candidate_paths=None):
|
|
980
|
-
"""Delete durable continuation handoff files for a manual clean reset."""
|
|
981
|
-
candidates = []
|
|
982
|
-
if isinstance(status_data, dict):
|
|
983
|
-
candidates.append(status_data.get("continuation_summary_path"))
|
|
984
|
-
candidates.extend(candidate_paths or [])
|
|
985
|
-
|
|
986
|
-
cleaned = []
|
|
987
|
-
seen = set()
|
|
988
|
-
for candidate in candidates:
|
|
989
|
-
target = _resolve_project_file(project_root, candidate)
|
|
990
|
-
if not target or target in seen:
|
|
991
|
-
continue
|
|
992
|
-
seen.add(target)
|
|
993
|
-
if os.path.basename(target) != "continuation-summary.md":
|
|
994
|
-
continue
|
|
995
|
-
if os.path.isfile(target):
|
|
996
|
-
os.remove(target)
|
|
997
|
-
cleaned.append("Deleted continuation artifact {}".format(target))
|
|
998
|
-
return cleaned
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
def load_session_status(state_dir, bug_id, session_id):
|
|
1002
|
-
session_status_path = os.path.join(state_dir, bug_id, "sessions",
|
|
1003
|
-
session_id, "session-status.json"
|
|
1004
|
-
)
|
|
1005
|
-
data, err = load_json_file(session_status_path)
|
|
1006
|
-
if err:
|
|
1007
|
-
return None, err
|
|
1008
|
-
return data, None
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
651
|
# ---------------------------------------------------------------------------
|
|
1012
652
|
# Action: status
|
|
1013
653
|
# ---------------------------------------------------------------------------
|
|
@@ -1317,25 +957,7 @@ def action_clean(args, bug_list_path, state_dir):
|
|
|
1317
957
|
# ---------------------------------------------------------------------------
|
|
1318
958
|
|
|
1319
959
|
def action_pause(state_dir):
|
|
1320
|
-
|
|
1321
|
-
data, err = load_json_file(pipeline_path)
|
|
1322
|
-
if err:
|
|
1323
|
-
data = {"status": "paused", "paused_at": now_iso()}
|
|
1324
|
-
else:
|
|
1325
|
-
data["status"] = "paused"
|
|
1326
|
-
data["paused_at"] = now_iso()
|
|
1327
|
-
|
|
1328
|
-
err = write_json_file(pipeline_path, data)
|
|
1329
|
-
if err:
|
|
1330
|
-
error_out("Failed to write pipeline.json: {}".format(err))
|
|
1331
|
-
return
|
|
1332
|
-
|
|
1333
|
-
result = {
|
|
1334
|
-
"action": "pause",
|
|
1335
|
-
"status": "paused",
|
|
1336
|
-
"paused_at": data["paused_at"],
|
|
1337
|
-
}
|
|
1338
|
-
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
960
|
+
return _common_action_pause(state_dir, write_json_fn=write_json_file)
|
|
1339
961
|
|
|
1340
962
|
|
|
1341
963
|
# ---------------------------------------------------------------------------
|