Skip to content

Add agent context budget gate and blocker graph fixes - #486

Merged
unbraind merged 5 commits into
mainfrom
agent-context-budget-search-blockers
Jul 9, 2026
Merged

unbraind merged 5 commits into
mainfrom
agent-context-budget-search-blockers

Conversation

@unbraind

@unbraind unbraind commented Jul 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a deterministic token-budget release gate over 14 agent-facing CLI surfaces and wire it into quality:static plus release readiness contracts
  • preserve pm search inline field:value tokens so quoted and unquoted hybrid queries keep residual keywords
  • make repeated pm update --blocked-by append resolved blocked_by dependency edges while the scalar tracks the latest blocker
  • update SDK contract descriptions, command docs, pm tracker evidence, and generated changelog

Tracked pm items: pm-cu1i, pm-q6gx, pm-2ldo.

Verification

  • node scripts/run-tests.mjs test -- tests/unit/cli/bootstrap-args.spec.ts tests/unit/commands/update-command.spec.ts
  • node scripts/run-tests.mjs test -- tests/unit/scripts/release/token-budget-gate.spec.ts && pnpm quality:token-budget
  • node scripts/run-tests.mjs test -- tests/integration/release-automation-contract.spec.ts tests/integration/release-readiness-runtime.spec.ts
  • isolated temp PM_PATH manual proof for search status:all, update --blocked-by append semantics, and compact context output
  • pnpm test:coverage (267 files, 5480 tests, 100% statements/branches/functions/lines)
  • pnpm version:check && pnpm changelog:pm:check && pnpm contracts:check && pnpm security:scan && pnpm lint && npm pack --dry-run
  • greptile review --branch main --agent (final pass: confidence 5/5, no review comments)

Summary by cubic

Adds a deterministic token-budget gate for 14 agent-facing CLI surfaces and fixes search parsing and blocker graph updates. Hardens the gate with manifest entry validation, builds the CLI before measuring, and makes tests platform-safe to keep agent context output small and reliable.

  • New Features

    • Added scripts/release/token-budget-gate.mjs with a checked-in manifest scripts/release/token-budgets.json; measures UTF-8 bytes and blocks regressions with optional --update. (pm-cu1i)
    • Wired the gate into quality:static (now runs pnpm build first) and added quality:token-budget; release automation/readiness tests pin this gate.
  • Bug Fixes

    • Search: preserved inline field:value tokens in pm search so quoted/unquoted hybrids keep residual keywords (e.g., "status:all scene"). (pm-2ldo)
    • Blockers: pm update --blocked-by now appends resolved blocked_by edges, dedupes repeats, preserves existing edges when the new value is unresolved, and clears all on --unset blocked-by; scalar keeps the latest blocker. (pm-q6gx)
    • Token-budget gate hardening: kept child-process env; validated manifest shape and each entry (string id, non-negative max_bytes); bare --manifest uses the default path; built CLI before measuring; made missing-CLI path/tests Windows-safe; isolated tests (restored process.argv/process.exitCode, cleared env). Updated SDK command contracts, command docs, and changelog.

Written for commit c532d14. Summary will update on new commits.

Review in cubic

Implement a wide pm SDK/CLI bundle across pm-cu1i, pm-q6gx, and pm-2ldo.

- add a deterministic token-budget gate for 14 agent-facing command surfaces and wire it into quality:static and release readiness contracts

- preserve search inline field:value tokens so unquoted and quoted status:all hybrid queries keep residual keywords

- make update --blocked-by append resolved blocker dependency edges while keeping the latest scalar blocker for compatibility

- update SDK command contract descriptions, command docs, generated changelog, tracker metadata, and regression tests

Verification: pnpm test:coverage; pnpm version:check && pnpm changelog:pm:check && pnpm contracts:check && pnpm security:scan && pnpm lint && npm pack --dry-run

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@greptileai
/gemini review
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

@unbraind, I'll go ahead and do a full review of the PR.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a token-budget regression gate and manifest, changes pm update --blocked-by to preserve and append dependency edges, and keeps pm search inline field:value tokens intact during bootstrap normalization. It also updates docs, tests, changelog entries, and PM issue/task records.

Changes

Token-budget regression gate

Layer / File(s) Summary
Token budget measurement and manifest logic
scripts/release/token-budget-gate.mjs, scripts/release/token-budgets.json
Adds command execution, fixture seeding, measurement, manifest generation, budget comparison, and direct-entry gating for the token-budget check.
Quality script and release test wiring
package.json, tests/integration/release-automation-contract.spec.ts, tests/integration/release-readiness-runtime.spec.ts
Chains the gate into quality:static, adds quality:token-budget, and updates release contract expectations.
Token-budget gate tests
tests/unit/scripts/release/token-budget-gate.spec.ts
Covers measurement helpers, manifest generation, update/check modes, and error paths.
PM task history
.agents/pm/history/pm-cu1i.jsonl, .agents/pm/tasks/pm-cu1i.toon
Records task progress, verification, closure, and supporting evidence for the gate work.

Blocked-by dependency accumulation

Layer / File(s) Summary
Dependency reconciliation and contract text
src/cli/commands/update.ts, src/sdk/cli-contracts/commander-mutation-options.ts, docs/COMMANDS.md
--blocked-by now preserves existing blocked_by edges, clears them only on unset, and the option/docs text matches the updated behavior.
Update-command blocker tests
tests/unit/commands/update-command.spec.ts
Adds coverage for edge accumulation, deduplication, and manual edge preservation.
GH-484 issue history
.agents/pm/history/pm-q6gx.jsonl, .agents/pm/issues/pm-q6gx.toon
Records issue progress, verification, and closure metadata for the blocked-by change.

Inline search token preservation

Layer / File(s) Summary
Bootstrap normalization and docs
src/cli/bootstrap-args.ts, docs/COMMANDS.md
search invocations now preserve bare key=value tokens during normalization, and the docs clarify inline-filter precedence.
Search normalization tests
tests/unit/cli/bootstrap-args.spec.ts
Adds regression tests for unquoted and quoted inline filter cases.
GH-485 issue history
.agents/pm/history/pm-2ldo.jsonl, .agents/pm/issues/pm-2ldo.toon
Records issue claim, verification, closure, and linked artifacts for the search fix.

Metadata

Layer / File(s) Summary
Changelog and extension timestamp
CHANGELOG.md, .agents/pm/extensions/.managed-extensions.json
Adds unreleased fixed entries and refreshes the managed-extensions timestamp.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant token-budget-gate.mjs
  participant dist/cli.js
  participant token-budgets.json
  token-budget-gate.mjs->>dist/cli.js: seed fixture + run command corpus
  dist/cli.js-->>token-budget-gate.mjs: stdout per command
  token-budget-gate.mjs->>token-budget-gate.mjs: measureOutput and compareBudgets
  token-budget-gate.mjs->>token-budgets.json: buildManifest or validate existing budgets
  token-budgets.json-->>token-budget-gate.mjs: pass or violation data
Loading
sequenceDiagram
  participant update.ts
  participant reconcileBlockedByDependency
  participant dependencies
  update.ts->>reconcileBlockedByDependency: blockedBy value
  alt nextBlockedById undefined
    reconcileBlockedByDependency->>dependencies: remove all blocked_by edges
  else nextBlockedById set
    reconcileBlockedByDependency->>dependencies: check existing blocked_by edge
    dependencies-->>reconcileBlockedByDependency: exists or missing
    reconcileBlockedByDependency->>dependencies: add edge if missing
  end
  reconcileBlockedByDependency-->>update.ts: updated dependencies
Loading

Possibly related PRs

  • unbraind/pm-cli#37: Related blocked_by dependency-edge derivation work in the same CLI area.
  • unbraind/pm-cli#45: Directly related pm update --blocked-by dependency-graph reconciliation changes in src/cli/commands/update.ts.
  • unbraind/pm-cli#383: Related quality:static script wiring that also touches the same package script entry.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly names the two main changes: the agent context budget gate and blocker graph fixes.
Description check ✅ Passed The description accurately summarizes the gate, search parsing, blocked-by behavior, docs, and verification.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deterministic token-budget regression gate to monitor and enforce token efficiency across 14 CLI surfaces, integrating it into the static quality checks. It also fixes two major issues: GH-484, by ensuring that repeated --blocked-by updates append to the dependency graph rather than overwriting previous blockers, and GH-485, by preserving inline search filter tokens (like status:all) during argument normalization. The reviewer provided valuable feedback on the token-budget gate script, noting that runCli should explicitly check the exit status of executed commands to prevent silent failures from bypassing the gate.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/release/token-budget-gate.mjs Resolved
@greptile-apps

greptile-apps Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds a token-budget gate and fixes two agent-facing CLI workflows. The main changes are:

  • Adds scripts/release/token-budget-gate.mjs and a checked-in budget manifest for 14 CLI surfaces.
  • Wires the token-budget check into quality:static and adds quality:token-budget.
  • Preserves field:value search tokens so pm search status:all keywords keeps residual keywords.
  • Updates pm update --blocked-by to append resolved blocked_by dependency edges while keeping the scalar as the latest blocker.
  • Updates command docs, SDK contract descriptions, release readiness tests, PM tracker evidence, and the changelog.

Confidence Score: 5/5

Safe to merge with minimal risk.

The runtime changes are focused and covered by targeted tests for search token handling, blocked-by graph updates, and token-budget manifest behavior.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • An initial harness attempt produced a pipefail error before running the PR command.
  • The command was rerun under bash and completed successfully.
  • The token budget gate execution was logged with its command, working directory, unit test counts, quality command, tested surfaces, and an exit code of 0.
  • The release integration tests ran for the named files and passed, showing pass counts, runtime duration, and exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
package.json Wires quality:static to build then run static and token-budget gates, and adds a standalone token-budget script.
scripts/release/token-budget-gate.mjs Adds deterministic CLI-output budget measurement over seeded PM fixtures with manifest validation and update mode.
scripts/release/token-budgets.json Adds checked-in byte/token ceilings for the 14 agent-facing CLI surfaces measured by the gate.
src/cli/bootstrap-args.ts Preserves field:value tokens for pm search so the search command can parse inline filters and residual keywords itself.
src/cli/commands/update.ts Updates --blocked-by handling to append and dedupe resolved blocked_by dependency edges while preserving unresolved scalar values and existing edges.
tests/unit/cli/bootstrap-args.spec.ts Adds tests for quoted and unquoted search inline-filter tokens remaining positional.
tests/unit/commands/update-command.spec.ts Adds tests for blocked-by edge creation, clearing, appending, deduping, unresolved preservation, and manual edge preservation.
tests/unit/scripts/release/token-budget-gate.spec.ts Covers token-budget measurement, manifest building and comparison, fixture command execution, path portability, and malformed manifest failures.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
  participant CI as quality:static / quality:token-budget
  participant Build as pnpm build
  participant Gate as token-budget-gate.mjs
  participant CLI as dist/cli.js
  participant Manifest as token-budgets.json

  CI->>Build: build dist CLI (quality:static)
  CI->>Gate: run token budget gate
  Gate->>Manifest: read checked budgets
  Gate->>CLI: init isolated PM workspace
  Gate->>CLI: seed deterministic parent/blocker/child/comment
  loop 14 agent-facing surfaces
    Gate->>CLI: execute command corpus entry
    CLI-->>Gate: stdout
    Gate->>Gate: measure UTF-8 bytes and estimated tokens
  end
  Gate->>Manifest: compare measured bytes to max_bytes
  Gate-->>CI: pass or fail with offending surface and delta
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
  participant CI as quality:static / quality:token-budget
  participant Build as pnpm build
  participant Gate as token-budget-gate.mjs
  participant CLI as dist/cli.js
  participant Manifest as token-budgets.json

  CI->>Build: build dist CLI (quality:static)
  CI->>Gate: run token budget gate
  Gate->>Manifest: read checked budgets
  Gate->>CLI: init isolated PM workspace
  Gate->>CLI: seed deterministic parent/blocker/child/comment
  loop 14 agent-facing surfaces
    Gate->>CLI: execute command corpus entry
    CLI-->>Gate: stdout
    Gate->>Gate: measure UTF-8 bytes and estimated tokens
  end
  Gate->>Manifest: compare measured bytes to max_bytes
  Gate-->>CI: pass or fail with offending surface and delta
Loading

Reviews (9): Last reviewed commit: "fix(review): validate token budgets and ..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds release gating and fixes several agent-facing CLI behaviors. The main changes are:

  • Adds a deterministic token-budget gate for 14 CLI output surfaces.
  • Wires the new budget gate into quality:static and release readiness checks.
  • Preserves pm search inline field:value tokens so residual keywords are retained.
  • Updates pm update --blocked-by to append resolved blocker edges while keeping scalar compatibility.
  • Updates docs, SDK contract text, tracker evidence, tests, and changelog entries.

Confidence Score: 4/5

This PR has one contained blocker-graph bug to fix before merging.

The token-budget gate and search parsing changes are well-contained. The remaining issue can remove existing blocked_by dependency edges when an unresolved blocker value is passed.

src/cli/commands/update.ts; tests/unit/commands/update-command.spec.ts

T-Rex T-Rex Logs

What T-Rex did

  • I reproduced the blocker graph preservation workflow by running a generated Node harness against the built CLI and observed the creation of a blocker and a blocked item with an initial blocked_by dependency; updating the blocked item with --blocked-by missing-typo emitted blocked_by_unresolved:missing-typo and changed the scalar blocked_by to missing-typo, after which the persisted item no longer contained the prior blocked_by edge.
  • Artifacts were captured to support the verification, including the Repro: generated CLI harness that creates real PM items and performs the unresolved blocked-by update and the verbose command output showing the before dependency edge, unresolved warning, scalar mutation, and missing after edge.
  • I ran unit tests, token-budget checks, and release-readiness integrations; all targeted tests passed (197 unit tests, token budget gate passed, and 49 release-readiness tests), and a prior shell wrapper issue observed in an earlier run was resolved by re-running under bash.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
package.json Wires token budget gating into quality:static and exposes a standalone quality:token-budget script.
scripts/release/token-budget-gate.mjs Adds deterministic fixture seeding, CLI corpus measurement, manifest update, and budget comparison logic.
scripts/release/token-budgets.json Adds checked-in byte and estimated-token budgets for 14 agent-facing CLI surfaces.
src/cli/bootstrap-args.ts Preserves search bare field:value tokens so runSearch can parse inline filters without losing residual keywords.
src/cli/commands/update.ts Appends resolved blocked_by dependency edges while keeping scalar compatibility; unresolved blocked-by updates can clear existing blocker graph edges.
tests/unit/commands/update-command.spec.ts Adds tests for append, dedupe, and clear blocked-by behavior, but not the unresolved-blocker preservation path.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Dev as Developer/CI
participant Script as quality:static
participant Gate as token-budget-gate.mjs
participant CLI as dist/cli.js
participant Fixture as Isolated PM_PATH
participant Manifest as token-budgets.json

Dev->>Script: pnpm quality:static
Script->>Gate: node scripts/release/token-budget-gate.mjs
Gate->>Fixture: create temp workspace
Gate->>CLI: init/create fixture items/comments
CLI-->>Gate: stdout per command
Gate->>Manifest: load checked-in byte budgets
Gate->>Gate: compare measured bytes to max_bytes
Gate-->>Script: pass or fail with offending command deltas
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Dev as Developer/CI
participant Script as quality:static
participant Gate as token-budget-gate.mjs
participant CLI as dist/cli.js
participant Fixture as Isolated PM_PATH
participant Manifest as token-budgets.json

Dev->>Script: pnpm quality:static
Script->>Gate: node scripts/release/token-budget-gate.mjs
Gate->>Fixture: create temp workspace
Gate->>CLI: init/create fixture items/comments
CLI-->>Gate: stdout per command
Gate->>Manifest: load checked-in byte budgets
Gate->>Gate: compare measured bytes to max_bytes
Gate-->>Script: pass or fail with offending command deltas
Loading

Comments Outside Diff (1)

  1. src/cli/commands/update.ts, line 1857-1863 (link)

    P1 Preserve blocker graph
    resolvedBlockedByDependencyId is undefined both for --unset blocked-by and for an unresolved --blocked-by value. In the unresolved case lines 1851-1855 still store the new scalar, but this call sends undefined into reconcileBlockedByDependency, which removes every existing blocked_by dependency edge, so a typo or missing item silently corrupts the blocker graph while only emitting blocked_by_unresolved.

    Artifacts

    Repro: generated CLI harness that creates real PM items and performs the unresolved blocked-by update

    • Contains supporting evidence from the run (text/javascript; charset=utf-8).

    Repro: verbose command output showing before dependency edge, unresolved warning, scalar mutation, and missing after edge

    • Keeps the command output available without making the summary code-heavy.

    View artifacts

    T-Rex Ran code and verified through T-Rex

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/cli/commands/update.ts
    Line: 1857-1863
    
    Comment:
    **Preserve blocker graph**
    `resolvedBlockedByDependencyId` is `undefined` both for `--unset blocked-by` and for an unresolved `--blocked-by` value. In the unresolved case lines 1851-1855 still store the new scalar, but this call sends `undefined` into `reconcileBlockedByDependency`, which removes every existing `blocked_by` dependency edge, so a typo or missing item silently corrupts the blocker graph while only emitting `blocked_by_unresolved`.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/cli/commands/update.ts:1857-1863
**Preserve blocker graph**
`resolvedBlockedByDependencyId` is `undefined` both for `--unset blocked-by` and for an unresolved `--blocked-by` value. In the unresolved case lines 1851-1855 still store the new scalar, but this call sends `undefined` into `reconcileBlockedByDependency`, which removes every existing `blocked_by` dependency edge, so a typo or missing item silently corrupts the blocker graph while only emitting `blocked_by_unresolved`.

Reviews (2): Last reviewed commit: "feat(agent-context): add token budget ga..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cli/commands/update.ts (1)

668-699: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Prevent unresolved --blocked-by from clearing existing edges
context.resolvedBlockedByDependencyId is undefined for unresolved free-text, so applyBlockedByDependencyEdge() treats it like an explicit unset and removes all existing blocked_by edges. Guard this call so only --unset blocked-by clears edges.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands/update.ts` around lines 668 - 699, The `--blocked-by`
handling is treating unresolved free-text the same as an explicit unset, which
causes existing `blocked_by` edges to be removed; update the call path in
`applyBlockedByDependencyEdge`/`reconcileBlockedByDependency` so only an
explicit `--unset blocked-by` clears edges. Add a guard before passing
`context.resolvedBlockedByDependencyId` into the dependency reconciliation logic
so `undefined` from unresolved input does not trigger the removal branch, while
preserving the existing behavior for real resolved IDs and explicit unsets.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 7-9: The changelog entries currently expose internal
`.agents/pm/...` tracker-artifact links, which should not appear in public docs.
Update the affected bullets in the changelog to remove those private links and
replace them with neutral public references (for example, issue or docs
references) while keeping the release note text intact. Use the existing bullet
entries in the changelog as the location to edit.

In `@package.json`:
- Around line 83-84: The token-budget gate used by quality:static now depends on
build output being present, so update the CI and local workflow that invokes
quality:static to run pnpm build first. Make sure the workflow around the
package.json scripts and any related docs or automation clearly sequences pnpm
build before node scripts/release/static-quality-gate.mjs so dist/cli.js exists
when the chained token-budget check runs.

In `@scripts/release/token-budget-gate.mjs`:
- Around line 213-215: The manifest parsing in token-budget-gate.mjs handles a
bare --manifest incorrectly by treating true as a path, so update the
manifestPath logic to mirror the existing headroom guard and fall back to
DEFAULT_MANIFEST_PATH when flags.get("manifest") is undefined or true. Keep the
behavior consistent with the multiplier handling on multiplierValue/multiplier,
and ensure the path.resolve call only runs when a real manifest value is
provided.

---

Outside diff comments:
In `@src/cli/commands/update.ts`:
- Around line 668-699: The `--blocked-by` handling is treating unresolved
free-text the same as an explicit unset, which causes existing `blocked_by`
edges to be removed; update the call path in
`applyBlockedByDependencyEdge`/`reconcileBlockedByDependency` so only an
explicit `--unset blocked-by` clears edges. Add a guard before passing
`context.resolvedBlockedByDependencyId` into the dependency reconciliation logic
so `undefined` from unresolved input does not trigger the removal branch, while
preserving the existing behavior for real resolved IDs and explicit unsets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 68a92aa6-3921-4b5f-b40a-34e98d9ccc9f

📥 Commits

Reviewing files that changed from the base of the PR and between 51608ce and e6bc725.

📒 Files selected for processing (20)
  • .agents/pm/extensions/.managed-extensions.json
  • .agents/pm/history/pm-2ldo.jsonl
  • .agents/pm/history/pm-cu1i.jsonl
  • .agents/pm/history/pm-q6gx.jsonl
  • .agents/pm/issues/pm-2ldo.toon
  • .agents/pm/issues/pm-q6gx.toon
  • .agents/pm/tasks/pm-cu1i.toon
  • CHANGELOG.md
  • docs/COMMANDS.md
  • package.json
  • scripts/release/token-budget-gate.mjs
  • scripts/release/token-budgets.json
  • src/cli/bootstrap-args.ts
  • src/cli/commands/update.ts
  • src/sdk/cli-contracts/commander-mutation-options.ts
  • tests/integration/release-automation-contract.spec.ts
  • tests/integration/release-readiness-runtime.spec.ts
  • tests/unit/cli/bootstrap-args.spec.ts
  • tests/unit/commands/update-command.spec.ts
  • tests/unit/scripts/release/token-budget-gate.spec.ts

Comment thread CHANGELOG.md Resolved
Comment thread package.json Resolved
Comment thread scripts/release/token-budget-gate.mjs Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deterministic token-budget gate to enforce byte limits on CLI outputs, resolves an issue where pm update --blocked-by overwrote prior blockers instead of appending them (GH-484), and fixes a bug where pm search dropped keywords when parsing inline filters (GH-485). It also updates the corresponding documentation, command contracts, and test suites. Feedback on the changes highlights a high-severity issue in the new token-budget-gate.mjs script, where runCli fails to verify the exit status of executed commands, potentially allowing crashing commands with empty outputs to silently pass the budget check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/release/token-budget-gate.mjs Resolved
Address PR review feedback and CI fallout.

- preserve existing blocked_by dependency edges when update --blocked-by receives an unresolved item id

- add regression coverage for valid blocker edge followed by unresolved blocker typo

- make the token-budget missing-CLI test path-safe on Windows

- record review-loop evidence on pm-q6gx and pm-cu1i

Verification: focused update/token-budget tests; pnpm quality:token-budget; pnpm lint; pnpm test:coverage; pnpm version:check && pnpm changelog:pm:check && pnpm contracts:check && pnpm security:scan && pnpm lint && npm pack --dry-run
@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

Review-loop update pushed in 3444e608:

  • fixed Greptile P1 by preserving existing blocked_by dependency edges when a new --blocked-by value is unresolved
  • added regression coverage for valid blocker edge followed by unresolved blocker typo
  • fixed the Windows regression by making the token-budget missing-CLI test path-safe
  • reviewed Gemini subprocess-status feedback: token-budget CLI calls use runCommand, which already fails on non-zero status unless allowFailure is set

Verification after the fix: focused update/token-budget tests, pnpm quality:token-budget, pnpm lint, pnpm test:coverage (5481 tests, 100/100/100/100), and the CI-style static sequence including npm pack --dry-run.

@greptileai
/gemini review
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

@unbraind, thanks for the update. I'll review the latest changes from 3444e608, including the fix for preserving blocked_by edges on unresolved blockers, the new regression coverage, and the Windows path-safety fix for the token-budget test.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deterministic token-cost regression gate to enforce output byte budgets across 14 agent-facing CLI surfaces, integrated directly into the static quality checks. It also resolves two major CLI issues: GH-485, by preserving search inline filter tokens to prevent dropping keywords in hybrid queries, and GH-484, by ensuring that repeated --blocked-by updates append to the blocker dependency graph rather than overwriting prior blockers. Feedback on the new token budget gate script recommends merging process.env to preserve critical system environment variables across different OS/CI environments, and using optional chaining on manifest.budgets to gracefully handle malformed or empty manifests.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/release/token-budget-gate.mjs Resolved
Comment thread scripts/release/token-budget-gate.mjs Resolved
@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@greptileai
/gemini review
@coderabbitai full review

Review follow-up pushed in a2a7a97. Please review the current head.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

@unbraind, got it — I'll do a full review of the current head at a2a7a97a, covering the fix for preserving blocked_by edges on unresolved blockers, the new regression coverage, and the Windows path-safety fix for the token-budget test.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 16 minutes.

@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

Review acknowledgements for the previous head are complete:

  • CodeRabbit review: actionable build sequencing and bare-manifest findings fixed; public generated tracker links retained with rationale.
  • Gemini reviews: environment and manifest-shape findings fixed; duplicate exit-status findings declined because the shared helper already fails nonzero exits.
  • Sourcery review: rate-limit-only response recorded; no actionable finding was available.
  • Greptile and Codecov summaries acknowledged.

Every inline finding was voted and answered in its thread.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deterministic token-cost regression gate for 14 agent-facing CLI surfaces, wiring it into the static quality checks and release contracts. It also fixes two major issues: GH-484, where pm update --blocked-by now appends and deduplicates blocker dependency edges instead of overwriting them, and GH-485, which prevents pm search from dropping keywords when inline filters are used. Feedback on the changes highlights potential test failures on Windows due to hardcoded Unix-style path separators in the new token-budget gate tests, suggesting the use of path.join to ensure platform-agnostic paths.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@greptileai
/gemini review
@coderabbitai full review

Windows portability fix pushed in e9fe2e7. Please review the current head.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

@unbraind, understood — I'll do a full review of the current head at e9fe2e78, covering the Windows portability fix for the token-budget test path handling.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a token budget regression gate to monitor and control the size of CLI output, preventing silent regressions in token usage. It also fixes two bugs: one where 'pm search' incorrectly rewrote quoted hybrid queries, and another where 'pm update --blocked-by' silently overwrote existing dependency edges instead of appending them. The PR includes comprehensive regression tests, updated documentation, and improved defensive validation for the new token budget manifest. My feedback focuses on enhancing the robustness of the manifest parsing and ensuring proper test state management.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread scripts/release/token-budget-gate.mjs Resolved
@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@greptileai
/gemini review
@coderabbitai full review

Manifest validation and test-isolation fixes pushed in c532d14. Please review the current head.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

@unbraind, understood — I'll do a full review of the current head at c532d141, covering the manifest validation and test-isolation fixes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a deterministic token-cost regression gate to enforce byte and token limits on 14 agent-facing CLI surfaces, wired into the static quality checks. It also resolves GH-484 by ensuring pm update --blocked-by appends resolved blocker dependency edges to the graph instead of overwriting previous ones, and resolves GH-485 by preserving inline search filter tokens as query input to prevent keywords from being dropped during argument normalization. Comprehensive unit and integration tests, along with documentation updates, have been added to support these changes. No review comments were provided, and I have no feedback to add.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@unbraind

unbraind commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

Gemini current-head review acknowledged: no comments or additional feedback on c532d14. Manifest entry validation, process-global test isolation, Windows portability, and the focused/static gates are all green.

@unbraind
unbraind merged commit 3a4cd2c into main Jul 9, 2026
25 checks passed
@unbraind

unbraind commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Tracked in PM: pm-2ldo, pm-cu1i, pm-q6gx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant