Repository navigation
Description
Problem
Reasoning effort (low/medium/high/xhigh/max/...) is not a column in any table. It exists only in llm_logs.metadata.reasoningLevel (per call) and in tasks.initial_job_data.reasoningLevel (only when a level-* label overrode it). As a result nothing can report cost or quality by effort, and "cost per merged PR" exists per implementer model only.
Goal
Persist the effective reasoning level of each agent execution and of the implementation behind each review score, so later reporting (cost per merged PR by model and effort, anomaly baselines, escalation policies) can query it directly. This issue adds and populates the columns only; it does not change any report.
Acceptance criteria
- A new knex migration adds a nullable
reasoning_levelcolumn tollm_executionsand a nullableimplementer_reasoning_levelcolumn toreview_scores. The migration is reversible and safe on existing SQLite databases; existing rows stay null. recordLLMMetricsaccepts the effective reasoning level andpersistToDatabasewrites it. Every existing caller passes the level actually used for that execution (the value already resolved by the agent and available asAgentExecutionResult.reasoningLevel), including the failure-path callers.- The stored value is the effective level after precedence resolution (job label override, then per-model agent config, then the instance setting), not just the label override.
autoor unknown is stored as-is or null, never guessed. review_scores.implementer_reasoning_levelis set at write time in the same place the implementer agent/model are resolved (resolveImplementationTask), from the implementation task's execution row; null when unknown.- Agents that encode effort in the model id or do not support effort store null without error.
- No existing API response shape, CSV column set or UI changes in this issue.
- Tests: migration test (up/down, existing rows),
recordLLMMetricspersistence with and without a level, and review-score persistence carrying the implementer level.
Out of scope
- Backfilling historical rows.
- Adding effort to analytics endpoints, the review-scores CSV, the CLI or the UI (separate follow-up).
Implementation
Key files:
- Migrations:
packages/core/src/db/migrations/(see20261006000000_create_review_scores.jsand thellm_executionsextensions20260204000000,20260415000000,20261008000000for style). packages/core/src/utils/llmMetrics.ts:recordLLMMetrics,persistToDatabase,PersistMetrics.- Callers of
recordLLMMetrics:src/jobs/issueJob/agent.ts,src/jobs/processPullRequestCommentJob.ts,src/jobs/reviewResultMetrics.ts,src/jobs/mergeConflictAgentRunner.ts,src/jobs/processGoalJob.ts, and failure paths insrc/jobs/errorHandlers.tsandsrc/jobs/prCommentJobUtils.ts. - Effective level resolution:
resolveEffectiveReasoningLevelinpackages/core/src/agents/impl/ClaudeAgent.tsandCodexAgent.ts; levels inpackages/shared/src/reasoningLevels.ts. packages/core/src/services/reviewScoreStore.ts:resolveImplementationTask,recordReviewScores; writersrc/jobs/reviewScorePersistence.ts.
Approach: add the migration; extend the metrics input type and insert; thread the level from the agent result at each caller; extend the review-score store to read the implementation task's llm_executions.reasoning_level when resolving the implementer.
Tests: test/llmMetrics.test.ts, test/llmMetricsRecording.test.ts, test/reviewScorePersistence.test.ts, test/reviewScoresMigration.test.ts (add a sibling for the new migration).
Verification: npm run test:prepare, npm run typecheck, node scripts/run-test-suite.mjs <changed test files>, and eslint --max-warnings 0 in each touched package.
Activity
propr-dev commentedon Nov 11, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53430/claude-opus-5-5-record-reasoning-effort-a-20261111-1911-tknmainissue-3430-20261111-1911-claude-opus-5-5-tkn🔍 Track Task Execution