Repository navigation
[codex] add v0.11 context engine - #22
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57b0efa173
ℹ️ 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".
| let target = request | ||
| .target_tokens | ||
| .unwrap_or(DEFAULT_WORKER_CONTEXT_TARGET_TOKENS) | ||
| .min(request.budget_limit.unwrap_or(u64::MAX)) | ||
| .max(512); |
There was a problem hiding this comment.
Respect hard context limits when compiling prompt targets
The target-budget calculation applies .max(512) after clamping to budget_limit, so any request with budget_limit (or explicit target_tokens) below 512 is silently raised to 512. That violates the documented “hard provider/model context limit” contract and can select context that cannot fit in constrained windows, especially for small-model or test configurations. Clamp the floor before applying the hard limit (or skip the floor when a lower explicit limit is provided).
Useful? React with 👍 / 👎.
| $metadata = Read-JsonFile $_.FullName | ||
| $usage = Read-JsonFile (Join-Path $runDir "token-usage.json") | ||
| $review = Read-JsonFile (Join-Path $runDir "quality-review.json") | ||
| $tool = if ($metadata -and $metadata.tool) { [string]$metadata.tool } else { Split-Path (Split-Path $runDir -Parent) -Leaf } |
There was a problem hiding this comment.
Compute fallback benchmark tool key from the correct directory
When metadata.tool is absent, this fallback extracts the parent-of-run parent leaf, which is the task segment for the documented layout benchmarks/runs/<suite>/<tool>/<task>/<run>/..., not the tool segment. As a result, summary grouping is keyed by task name instead of tool name for those runs, producing incorrect score tables whenever metadata is incomplete.
Useful? React with 👍 / 👎.
Summary
Adds the v0.11.0 Context Engine work for Phonton CLI: a token-budgeted worker context compiler, richer prompt manifests, dynamic provider output ceilings, and a benchmark scorer centered on verified success per 10k provider-reported tokens.
This PR also includes the prior CLI active-focus extraction commit from this branch line, so review should consider both the focus-surface refactor and the context-engine commit.
What changed
ContextPlan,ContextPlanItem, and prompt-manifest budget fields inphonton-types.phonton-contextto build compact repo maps, select bounded code slices, and record omitted candidate tokens./context,/why-tokens, Flight Log prompt lines, README, changelog, and v0.11.0 release notes.scripts/score-benchmark-runs.ps1forverified_success_per_10k_tokensbenchmark scoring.Validation
cargo fmt --all -- --checkcargo test --locked -p phonton-cli -p phonton-context -p phonton-worker -p phonton-providers -p phonton-typescargo test --locked --workspacecargo clippy --locked --workspace --all-targets -- -D warningscargo build --release --locked -p phonton-clitarget\release\phonton.exe versiontarget\release\phonton.exe --helpnpm run test:npm-wrappernpm pack --dry-runscripts\score-benchmark-runs.ps1smoke fixture: 1 verified run / 5000 tokens => score2Notes
No public superiority claim is added. This adds the architecture and benchmark metric needed to test token efficiency against other ADEs with reproducible artifacts.