Repository navigation
AI Fix for Issue #72: Epic (1/2): Store AI Usage Metrics (Cost, Model, Turns) in Redis for Dashboard Aggregation - #81
Merged
integry merged 1 commit intoSep 18, 2025
Conversation
…, Model, T Implemented by Claude Code using claude-opus-4-20250514 model. Implementation completed successfully.
integry
deleted the
ai-fix/72-epic-1-2-store-ai-usage-m-20250918-1511-claude-opus-4-20250514-8lx
branch
September 18, 2025 22:45
propr-dev Bot
pushed a commit
that referenced
this pull request
Sep 17, 2026
…ications are the only group left, and cards are titled by their actual PR or issue title. The type checks, lint (zero warnings), 124 UI notification tests, the server notification tests and 7 browser tests all pass. The Inbox is now one plain list, newest first. System notifications are the only group left, and cards are titled by their actual PR or issue title. The type checks, lint (zero warnings), 124 UI notification tests, the server notification tests and 7 browser tests all pass. **Layout** - The "Needs attention", "Ready for review" and "Completed" groups are gone. Everything except system updates is in one list sorted by time, newest on top. - System and indexing updates stay in one collapsed "System" section above the list. Its header is plain grey text with a count and a chevron. - Cards no longer have colored backgrounds, including the teal fill on unread ones. Every card is white with a grey border. Unread is shown only by the small dot and a bold title. **Titles and IDs** - The title is now the PR or issue title. For example, "Review completed for PR #81" becomes "Guard Inbox recaps against empty metadata". The server gets it from the title stored with the task, stripping prefixes like "Follow-up PR #42:" and "New Issue:". - If a task has no stored title, the old wording is used. - Plan notifications are titled by the plan name, with "Ready for review with 4 planned tasks." underneath. - The PR or issue number is still shown, as a small grey `PR81` or `#12` chip. The chips and dot separators are copied from the metadata row on the task details page (the one in your screenshot), so no new element styles were added. - The event type (e.g. "Review completed", "Fix completed") is plain grey text in that same row. Notifications already stored keep their old titles; only new ones get the PR/issue title. I updated the existing unit and browser tests for the flat list. I also added one server test checking that merge and failed-issue notifications use the real title. PR: #2441 Comment by: @integry (ID: 5711992010) Model: claude-opus-5
propr-dev Bot
pushed a commit
that referenced
this pull request
Nov 27, 2026
The failing check was at fault, not the runtime. Issue #80's agent did launch from the derived image. I fixed the check without weakening it, and the cap-mode summary now says which image the queued run used. **What happened in 45982542980:** the step searched only `flyctl logs --no-tail`, which keeps just the most recent lines. When it ran at 10:44:22, the oldest line it had was from 10:43:16. Both runs had built and started around 10:41, and issue #81 (the queued one) finished at 10:43:18, before #80. So the build line had already dropped out of the buffer when the step looked. The worker process was the same one throughout (pid 20), so it wasn't a restart either. **What I found in the code:** there was a real gap, though it isn't what failed this run. The build line is logged once per shared build, under whichever run started it. In cap mode that can be #81's run. A run that reuses the worker's cached image logged nothing at all, so the queued run's image couldn't be shown. **Changes:** - **Runtime (`fly/derivedImage.ts`):** every agent Machine created from a derived image now logs `Launched the agent Fly Machine from the derived image`, with `run`, `machine`, `image` and the package-list digest. That covers a run that built the image, one that found the registry tag, one that used the cache, and the retry after Fly refuses a create. I added a sentence about it to `agent-runtime.md`. - **Workflow, "Observe idle stop…":** the full log stream (`$OUT/app-logs.jsonl`) now starts at the idle stop in every mode, not only MCP or cap mode. - **Workflow, "Verify the linked PR…":** - It reads the stream plus the `--no-tail` buffer, filtered to after the idle stop. - It still requires the `Installed agent runtime packages in a derived Fly Machine image` line, with the same digest, count and `registry.fly.io/$AGENT_APP@sha256:` checks. - It now also requires a launch line whose run name matches `issue-$ISSUE-` (the format is `<agent>-issue-<n>-<task id>`), with the same image as the build. - **Workflow, cap step:** - It requires a launch line for the run of `$ISSUE2` with the same `DERIVED_IMAGE`. - It requires exactly one build line since the idle stop. - The step summary now shows the queued run's name, its Machine, the image it launched from, and the build count. **Testing:** - I added a test where one run builds and a second run reuses the cached image; both log a launch line with the same image and the build is logged once. The derived-image, capacity and Fly runtime suites pass (117 tests). - Core typecheck and zero-warning lint pass. - The three changed steps parse with `bash -n`. - I ran the new jq selection on logs shaped like this run's. The old query comes back empty, and the new one finds the build and matches the launch line to `issue-80` (and not to `issue-8`). - I couldn't confirm the exact run-name format from real logs, because the failure dump redacts `run` as `<long>`. The `issue-<n>` match is based on the code (`buildClaudeContainerName`). If your cap run fails with "No 'Launched the agent Fly Machine…' record for the run of …", that match is the place to look. Because this touches runtime code (one new log line, no behaviour change), you may want to run default mode once more along with cap mode. Default mode now also runs the new launch-line check for its first issue. PR: #3825 Comment by: @integry (ID: 7216310644) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI Implementation Summary
Closes #72
Model Used: claude-opus-4-20250514
Status: ✅ Implementation Completed
Branch:
ai-fix/72-epic-1-2-store-ai-usage-m-20250918-1511-claude-opus-4-20250514-8lxCommits: ✅ Changes committed (2c0b3dd)
🤖 AI Processing Completed
Execution Details:
Summary:
Summary
I have successfully implemented the solution for GitHub issue #72. Here's what I did:
Changes Made to
/home/node/workspace/src/queue/taskQueue.js:Modified the
worker.on('completed', ...)handler to:job.data.repositoryor by combiningjob.data.repoOwnerandjob.data.repoNameresult.claudeResultwhen availableaiMetricsobject containing:timestamp: Job start time (used as score for sorted set)cost: Extracted from various possible fields (claudeCostUsd,costUsd,finalResult.cost_usd)model: The AI model usedturns: Number of conversation turnsexecutionTimeMs: Execution time in millisecondsissueNumber: Issue numberrepo: Repository full namestatus: 'success'correlationId: Correlation ID for trackingmetrics:ai:log:v1usingzaddwith timestamp as the scoreModified the
worker.on('failed', ...)handler to:aiMetricsobject for failed jobs containing:cost: Set to 0 for failed jobsturns: Set to 0 for failed jobsexecutionTimeMs: Calculated from job timestampsstatus: 'failed'error: First 100 characters of the error messageKey Implementation Details:
metrics:ai:log:v1as the key for storing AI metrics with job timestamps as scores, enabling efficient time-range queriesclaudeCostUsd,costUsd,finalResult.cost_usd) to ensure compatibilityjob.data.repository) and new format (job.data.repoOwner+job.data.repoName)The implementation follows the exact specifications in the issue and the suggested diff, storing comprehensive AI usage metrics that can be queried by time range for dashboard aggregation.
Claude Code Results:
11c85aef-8c3b-4681-9797-ba226b22e6f8📁 Detailed Logs:
Execution logs generated:
11c85aef-8c3b-4681-9797-ba226b22e6f8Log files stored at:
/tmp/claude-logs/issue-72-2025-09-18T15-14-15-826Z-conversation.json/tmp/claude-logs/issue-72-2025-09-18T15-14-15-826Z-output.txt💬 Latest Conversation Messages
Powered by Claude Code v1.0.0
This PR was created automatically by Claude Code after processing issue #72.