Skip to content

feat(judge): trace-aware LLM judge via includeCommandTrace - #175

Open
sanchitmehtagit wants to merge 2 commits into
mainfrom
feat/trace-aware-judge
Open

feat(judge): trace-aware LLM judge via includeCommandTrace#175
sanchitmehtagit wants to merge 2 commits into
mainfrom
feat/trace-aware-judge

Conversation

@sanchitmehtagit

@sanchitmehtagit sanchitmehtagit commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

✏️ Changes

This ports the trace-aware LLM judge from #82 (the plumbing branch) in isolation, rebased onto latest main. None of #82's mock-CLI, route-file, loader, or docker machinery comes with it. This is purely the judge change, so it can land independently of that larger infrastructure.

judge() gains an opt-in third argument: judge(question, level?, { includeCommandTrace }). When includeCommandTrace is true, the agent's successful shell commands are appended to the judge input under a // COMMAND TRACE header, alongside the workspace files. This gives a judgeable artifact to evals whose work is entirely CLI invocations with no files to inspect, such as tenant configuration via the Auth0 CLI. Errored commands are dropped so the judge sees only what actually took effect.

The flag defaults to false, so every existing file-based judge is unchanged. ctx.toolCalls is already plumbed through GraderContext to the judge executor on main (event-based graders rely on it), so no wiring changes were needed.

What changed, by package:

  • evals-graders: added GraderDef.includeCommandTrace?: boolean and a JudgeOptions argument on judge() that defaults the flag to false.

  • evals-core: added formatCommandTrace(), which renders successful run_command / bash calls under the header; the judge executor appends the trace to the file corpus only when the grader opts in.

  • Tests: judge() option default and opt-in; formatCommandTrace behaviour covering the header, the bash alias, dropping errored calls, ignoring non-shell tool calls, and empty input.

  • Docs: a trace-aware judge note in AGENTS.md and an updated judge primitive row in docs/ADDING_EVALS.md.

  • I described the changes on this PR.

🔮 Type of Change

  • Standard
  • Emergency
  • Significant

🔗 References

📖 Documentation

Updated AGENTS.md (trace-aware judge subsection under the judge exclusion prose) and the judge primitive row in docs/ADDING_EVALS.md to document the new optional argument.

  • I reflected this change in the (internal and/or user-facing) documentation, or explained why no update is needed.

🎯 Testing

npm run build, npm test, npm run lint, and npm run format all pass locally. The full suite is green (503 tests in evals-core).

New unit coverage: formatCommandTrace behaviour in packages/evals-core/tests/graders/executors.test.ts, and judge() option handling in packages/evals-graders/tests/primitives.test.ts.

  • I described how I tested these changes, or explained why I did not.
  • This change has integration, unit, or performance test coverage, or I explained why it does not.

🚀 Deployment

Additive and backward-compatible: the new field is optional and off by default, so existing judges keep their current behaviour. No ordering constraints.

  • This change can support multiple releases of the code serving traffic at the same time.
  • This can be deployed at any time. If there are prerequisites, I listed them below and will ensure they are met before merging.

🔥 Rollback

Revert the single commit on this branch. The change is isolated to the judge primitive and executor, so a revert restores prior behaviour with no data or migration concerns.

  • I explained what rollback for this change looks like and how we recover quickly.

judge() gains an opt-in { includeCommandTrace }. When set, the agent's
successful shell commands are appended to the judge input (under a
// COMMAND TRACE header) alongside workspace files, so a file-less CLI
eval has a judgeable artifact. Errored commands are dropped so the judge
sees only what took effect. Off by default — every file-based judge is
unchanged. ctx.toolCalls is already plumbed to the judge executor.

Ported from #82 (plumbing) in isolation — no mock CLI / routes / loader
changes. Adapted to the current evals-* package naming.

- eval-graders: GraderDef.includeCommandTrace; judge() JudgeOptions arg
- eval-core: formatCommandTrace() + append-when-opted-in in llm-judge
- tests: judge option defaults/opt-in; formatCommandTrace behaviour
- docs: AGENTS.md trace-aware judge note; ADDING_EVALS.md judge row
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@sanchitmehtagit, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 674db516-8f57-4ae7-a2bb-ccacce2001e1

📥 Commits

Reviewing files that changed from the base of the PR and between 97ec011 and 6fdc61b.

📒 Files selected for processing (2)
  • AGENTS.md
  • packages/evals-core/tests/graders/executors.test.ts
📝 Walkthrough

Walkthrough

The judge grader now accepts an optional includeCommandTrace setting. When enabled, successful run_command and bash calls are formatted and appended to judge input. Errored and unsupported tool calls are excluded. The default remains disabled.

Changes

Trace-aware judge

Layer / File(s) Summary
Judge option contract
packages/evals-graders/src/types.ts, packages/evals-graders/src/primitives.ts, packages/evals-graders/tests/primitives.test.ts, docs/ADDING_EVALS.md, AGENTS.md
The judge primitive accepts includeCommandTrace. The flag is stored in GraderDef, defaults to false, and is documented and tested.
Command trace formatting and judge integration
packages/evals-core/src/graders/executors/llm-judge.ts, packages/evals-core/tests/graders/executors.test.ts
The executor formats successful shell commands from run_command and bash calls, excludes errored or unsupported calls, and appends the result when enabled. Tests cover these cases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant JudgeOptions
  participant LLMJudgeExecutor
  participant EventToolCalls
  JudgeOptions->>LLMJudgeExecutor: includeCommandTrace=true
  LLMJudgeExecutor->>EventToolCalls: read successful run_command and bash calls
  EventToolCalls-->>LLMJudgeExecutor: command trace
  LLMJudgeExecutor-->>LLMJudgeExecutor: append trace to file content
Loading

Possibly related PRs

  • auth0/auth0-evals#174: Its AXIS transcript adapter supplies EventToolCall data consumed by command-trace formatting.

Suggested reviewers: frederikprijck

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the opt-in trace-aware LLM judge feature implemented by the pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/trace-aware-judge

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.

@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: 2

🤖 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 `@docs/ADDING_EVALS.md`:
- Line 98: The documentation describes an outdated judge() options contract. In
docs/ADDING_EVALS.md lines 98-98, update the adjacent options description to
state that options are primitive-specific and that judge() supports
includeCommandTrace; in AGENTS.md lines 121-123, change the grader-primitives
signature from judge(question, framework?) to judge(question, level?, options?).

In `@packages/evals-core/src/graders/executors/llm-judge.ts`:
- Around line 90-94: Add Vitest executor coverage for the includeCommandTrace
gate in JudgeExecutor.execute: with includeCommandTrace false, assert the
llmJudge input excludes the formatted command trace; with it true, assert the
input includes the formatted trace. Exercise the integration path through
execute rather than testing formatCommandTrace directly.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eb2bab3e-3808-4309-b53d-66e8c561e6b0

📥 Commits

Reviewing files that changed from the base of the PR and between 0a530eb and 97ec011.

📒 Files selected for processing (7)
  • AGENTS.md
  • docs/ADDING_EVALS.md
  • packages/evals-core/src/graders/executors/llm-judge.ts
  • packages/evals-core/tests/graders/executors.test.ts
  • packages/evals-graders/src/primitives.ts
  • packages/evals-graders/src/types.ts
  • packages/evals-graders/tests/primitives.test.ts

Comment thread docs/ADDING_EVALS.md
Comment thread packages/evals-core/src/graders/executors/llm-judge.ts
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.

4 participants