Skip to content

Commit ca8359f

Browse files
authored
Merge pull request #11 from QUSETIONS/codex/minicode-lite-productization
Productize minicode-lite runtime and provider surfaces
2 parents e5b4599 + 1169330 commit ca8359f

88 files changed

Lines changed: 20106 additions & 600 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benchmarks/release_readiness.py

Lines changed: 300 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,300 @@
1+
from __future__ import annotations
2+
3+
import json
4+
import subprocess
5+
from datetime import datetime, timezone
6+
from pathlib import Path
7+
import sys
8+
9+
if __package__ in (None, ""):
10+
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
11+
12+
from minicode.release_readiness import (
13+
ReleaseCheck,
14+
classify_provider_outcome,
15+
release_readiness_as_dict,
16+
release_readiness_as_markdown,
17+
summarize_release_status,
18+
)
19+
from minicode.product_surfaces import build_readiness_report
20+
from minicode.session import create_file_checkpoint, create_new_session, save_session
21+
22+
23+
REPO_ROOT = Path(__file__).resolve().parents[1]
24+
BENCHMARKS_DIR = REPO_ROOT / "benchmarks"
25+
26+
27+
def _run_command(label: str, command: list[str], *, cwd: Path, timeout: int = 1800) -> ReleaseCheck:
28+
try:
29+
completed = subprocess.run(
30+
command,
31+
cwd=cwd,
32+
capture_output=True,
33+
text=True,
34+
encoding="utf-8",
35+
errors="replace",
36+
timeout=timeout,
37+
check=False,
38+
)
39+
stdout = completed.stdout.strip()
40+
stderr = completed.stderr.strip()
41+
summary_source = stdout or stderr
42+
summary = summary_source.splitlines()[-1].strip() if summary_source else f"{label} completed."
43+
status = "passed" if completed.returncode == 0 else "failed"
44+
return ReleaseCheck(
45+
label=label,
46+
command=" ".join(command),
47+
exit_code=completed.returncode,
48+
status=status,
49+
summary=summary,
50+
stdout=stdout,
51+
stderr=stderr,
52+
)
53+
except subprocess.TimeoutExpired as exc:
54+
stdout = exc.stdout or ""
55+
stderr = exc.stderr or ""
56+
return ReleaseCheck(
57+
label=label,
58+
command=" ".join(command),
59+
exit_code=124,
60+
status="failed",
61+
summary=f"{label} timed out.",
62+
stdout=stdout if isinstance(stdout, str) else "",
63+
stderr=stderr if isinstance(stderr, str) else "",
64+
)
65+
66+
67+
def _prepare_saved_session(workspace: Path) -> None:
68+
workspace.mkdir(parents=True, exist_ok=True)
69+
target = workspace / "demo.txt"
70+
target.write_text("after", encoding="utf-8")
71+
extension_dir = workspace / ".mini-code" / "extensions" / "git-helpers"
72+
extension_dir.mkdir(parents=True, exist_ok=True)
73+
(extension_dir / "extension.json").write_text(
74+
json.dumps(
75+
{
76+
"name": "git-helpers",
77+
"version": "1.0.0",
78+
"description": "Local helper bundle",
79+
"enabled": True,
80+
"entrypoint": "bundle.py",
81+
},
82+
indent=2,
83+
)
84+
+ "\n",
85+
encoding="utf-8",
86+
)
87+
(extension_dir / "bundle.py").write_text("print('ok')\n", encoding="utf-8")
88+
89+
session = create_new_session(workspace=str(workspace))
90+
session.history = ["continue with runtime trace"]
91+
session.transcript_entries = [
92+
{
93+
"id": 1,
94+
"kind": "progress",
95+
"category": "runtime",
96+
"runtimeKind": "phase",
97+
"runtimeStep": 2,
98+
"runtimePhase": "verify",
99+
"body": "Runtime phase: verify.",
100+
},
101+
{
102+
"id": 2,
103+
"kind": "tool",
104+
"toolName": "edit_file",
105+
"status": "success",
106+
"body": "Patched demo.txt",
107+
},
108+
]
109+
session.instruction_layers = [
110+
{
111+
"name": "project-managed",
112+
"scope": "project",
113+
"kind": "managed",
114+
"path": str(workspace / ".mini-code" / "MANAGED.md"),
115+
"exists": True,
116+
"preview": "Prefer verification-first delivery.",
117+
}
118+
]
119+
session.hook_status = {
120+
"total_hooks": 1,
121+
"enabled_hooks": 1,
122+
"total_calls": 1,
123+
"total_duration_ms": 8,
124+
"failure_count": 0,
125+
"last_status": "success",
126+
}
127+
session.delegated_tasks = [{"label": "lint-worker", "status": "running"}]
128+
session.delegation_status = {
129+
"running_tasks": 1,
130+
"total_tracked": 1,
131+
"max_slots": 4,
132+
"available_slots": 3,
133+
"active_labels": ["lint-worker"],
134+
}
135+
session.extension_manifests = [
136+
{
137+
"name": "git-helpers",
138+
"scope": "project",
139+
"enabled": True,
140+
"version": "1.0.0",
141+
"description": "Local helper bundle",
142+
"entrypoint": "bundle.py",
143+
}
144+
]
145+
session.readiness_report = {
146+
"status": "ready",
147+
"provider": "anthropic-compatible",
148+
"provider_ready": True,
149+
"issues": [],
150+
}
151+
create_file_checkpoint(
152+
session,
153+
file_path=str(target),
154+
existed=True,
155+
previous_content="before",
156+
)
157+
save_session(session)
158+
159+
160+
def main() -> None:
161+
generated_at = datetime.now(timezone.utc).isoformat()
162+
workspace = REPO_ROOT / "outputs" / "release_smoke_workspace"
163+
_prepare_saved_session(workspace)
164+
165+
compile_check = _run_command(
166+
"compileall",
167+
[sys.executable, "-m", "compileall", "-q", "minicode", "tests", "benchmarks"],
168+
cwd=REPO_ROOT,
169+
timeout=600,
170+
)
171+
test_check = _run_command(
172+
"pytest-q",
173+
[sys.executable, "-m", "pytest", "-q"],
174+
cwd=REPO_ROOT,
175+
timeout=2400,
176+
)
177+
runtime_eval_check = _run_command(
178+
"runtime-profile-eval",
179+
[sys.executable, "benchmarks/runtime_profile_eval.py"],
180+
cwd=REPO_ROOT,
181+
timeout=600,
182+
)
183+
184+
smoke_checks = [
185+
_run_command(
186+
"list-sessions",
187+
[sys.executable, "-m", "minicode.main", "--list-sessions"],
188+
cwd=workspace,
189+
timeout=120,
190+
),
191+
_run_command(
192+
"inspect-session",
193+
[sys.executable, "-m", "minicode.main", "--inspect-session", "latest"],
194+
cwd=workspace,
195+
timeout=120,
196+
),
197+
_run_command(
198+
"replay-session",
199+
[sys.executable, "-m", "minicode.main", "--replay-session", "latest"],
200+
cwd=workspace,
201+
timeout=120,
202+
),
203+
_run_command(
204+
"preview-rewind",
205+
[sys.executable, "-m", "minicode.main", "--preview-rewind", "latest"],
206+
cwd=workspace,
207+
timeout=120,
208+
),
209+
]
210+
211+
runtime_profile_json = BENCHMARKS_DIR / "runtime_profile_eval_results.json"
212+
provider_diagnostics: list[dict[str, object]] = []
213+
if runtime_profile_json.exists():
214+
payload = json.loads(runtime_profile_json.read_text(encoding="utf-8"))
215+
provider_diagnostics = list(payload.get("provider_diagnostics", []) or [])
216+
217+
if not provider_diagnostics:
218+
fallback_check = _run_command(
219+
"headless-provider-smoke",
220+
[sys.executable, "-m", "minicode.headless", "Reply with exactly OK."],
221+
cwd=REPO_ROOT,
222+
timeout=180,
223+
)
224+
outcome, summary = classify_provider_outcome(
225+
exit_code=fallback_check.exit_code,
226+
stdout=fallback_check.stdout,
227+
stderr=fallback_check.stderr,
228+
)
229+
provider_diagnostics = [
230+
{
231+
"label": fallback_check.label,
232+
"outcome": outcome,
233+
"command": fallback_check.command,
234+
"exit_code": fallback_check.exit_code,
235+
"summary": summary,
236+
"stdout": fallback_check.stdout,
237+
"stderr": fallback_check.stderr,
238+
}
239+
]
240+
241+
readiness_report = build_readiness_report(REPO_ROOT)
242+
243+
readiness_snapshot = {
244+
"provider": readiness_report.provider,
245+
"provider_ready": readiness_report.provider_ready,
246+
"provider_channel": readiness_report.provider_channel,
247+
"fallback_ready": readiness_report.fallback_ready,
248+
"fallback_candidates": readiness_report.fallback_candidates,
249+
"viable_fallbacks": readiness_report.viable_fallbacks,
250+
"fallback_guidance": readiness_report.fallback_guidance,
251+
"issues": readiness_report.issues,
252+
"summary": readiness_report.summary,
253+
}
254+
255+
status = summarize_release_status(
256+
compile_check=compile_check,
257+
test_check=test_check,
258+
runtime_eval_check=runtime_eval_check,
259+
smoke_checks=smoke_checks,
260+
provider_outcomes=[str(item.get("outcome", "error")) for item in provider_diagnostics],
261+
readiness_report=readiness_snapshot,
262+
)
263+
264+
runtime_profile_artifacts = {
265+
"json": str(runtime_profile_json),
266+
"markdown": str(BENCHMARKS_DIR / "runtime_profile_eval_results.md"),
267+
}
268+
payload = release_readiness_as_dict(
269+
generated_at=generated_at,
270+
status=status,
271+
compile_check=compile_check,
272+
test_check=test_check,
273+
runtime_eval_check=runtime_eval_check,
274+
smoke_checks=smoke_checks,
275+
provider_diagnostics=provider_diagnostics,
276+
runtime_profile_artifacts=runtime_profile_artifacts,
277+
readiness_report=readiness_snapshot,
278+
)
279+
markdown = release_readiness_as_markdown(
280+
generated_at=generated_at,
281+
status=status,
282+
compile_check=compile_check,
283+
test_check=test_check,
284+
runtime_eval_check=runtime_eval_check,
285+
smoke_checks=smoke_checks,
286+
provider_diagnostics=provider_diagnostics,
287+
runtime_profile_artifacts=runtime_profile_artifacts,
288+
readiness_report=readiness_snapshot,
289+
)
290+
291+
json_path = BENCHMARKS_DIR / "release_readiness_results.json"
292+
markdown_path = BENCHMARKS_DIR / "release_readiness_results.md"
293+
json_path.write_text(json.dumps(payload, indent=2), encoding="utf-8")
294+
markdown_path.write_text(markdown, encoding="utf-8")
295+
print(json_path)
296+
print(markdown_path)
297+
298+
299+
if __name__ == "__main__":
300+
main()

benchmarks/release_readiness_results.json

Lines changed: 101 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# MiniCode Release Readiness
2+
3+
- Generated at: 2026-06-06T03:46:02.433983+00:00
4+
- Status: at-risk
5+
6+
## Core Gate
7+
8+
| check | status | exit_code | summary |
9+
| --- | --- | ---: | --- |
10+
| compileall | passed | 0 | compileall completed. |
11+
| pytest-q | passed | 0 | 1027 passed, 2 skipped, 3 warnings in 18.88s |
12+
| runtime-profile-eval | passed | 0 | benchmarks\runtime_profile_eval_results.md |
13+
14+
## Product Smokes
15+
16+
| check | status | exit_code | summary |
17+
| --- | --- | ---: | --- |
18+
| list-sessions | passed | 0 | Total: 1231 session(s) |
19+
| inspect-session | passed | 0 | - [tool:edit_file/success] Patched demo.txt |
20+
| replay-session | passed | 0 | - [tool:edit_file/success] Patched demo.txt |
21+
| preview-rewind | passed | 0 | Type: edit |
22+
23+
## Provider Diagnostics
24+
25+
| label | outcome | exit_code | summary |
26+
| --- | --- | ---: | --- |
27+
| headless-smoke | provider_outage | 0 | Provider availability failure: deepseek-v4-pro[1m] failed and all viable fallback models were unavailable. Remaining blocker is upstream provider/channel availability, not a local retry loop. Active channel: anthropic-compatible via baseUrl/authToken. Last error (RuntimeError): No available channel for model deepseek-v4-pro[1m] under group cc (distributor) (request id: 202606060346468033683028268d9d66QHAvNlc) Next step: Primary runtime is using a single anthropic-compatible channel from baseUrl/authToken. |
28+
29+
## Provider Fallback Coverage
30+
31+
- Provider: anthropic
32+
- Provider ready: yes
33+
- Channel: anthropic-compatible via baseUrl/authToken
34+
- Fallback ready: no
35+
- Summary: readiness: warning (anthropic) [Primary provider is ready, but no configured or default fallback models are available.]
36+
- Guidance:
37+
- Primary runtime is using a single anthropic-compatible channel from baseUrl/authToken.
38+
- Add fallbackModels or anthropicFallbackModels to enable model failover.
39+
- No local fallback credentials are configured for OpenAI, OpenRouter, or custom providers.
40+
41+
## Runtime Profile Artifacts
42+
43+
- JSON: D:\Desktop\minicode\benchmarks\runtime_profile_eval_results.json
44+
- Markdown: D:\Desktop\minicode\benchmarks\runtime_profile_eval_results.md

0 commit comments

Comments
 (0)