Repository navigation
OpenConceptLab/ocl_online#641 | The usage chip shows the count for the open map project - #134
Conversation
…ject, and each project keeps its own report The OCL AI Assistant reports the count for the map project a call names. The Mapper's $invoke calls already name it in X-OCL-Event-Metadata, but GET /match/usage/ named none, so the chip could switch between two counts on one project. The read now names the project the same way, and the report is kept per person and project (none for a project not saved yet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…he query string, and a first save asks once the route has the id The usage read names the map project as `map_project` in the query string rather than in the attribution header, which attributes a call: the OCL AI Assistant reports the count the calls on that project are charged to. A project's first save refreshed the usage before the route had the new project's id, so its report was never asked for. The save now refreshes only the capabilities, and the route gaining a project id asks for that project's report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…r another project asks for the open one's report F1.3: a call made before a project's first save keeps its reply's report for no project, and skipped the refresh because the reply carried one, so the saved project's report could miss that call. When the reply's project isn't the open one, the open one's report is asked for. F1.4: the route gaining a project id refreshes the capabilities with the usage, so a permission granted only now still asks for the report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
Codex review, pass 1 (codex-cli 0.169.0, commit cf38d73)Verdict: findings, 4 findings.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "full",
"commit": "cf38d73de0bed2fb2da404d1bf88f721adbf4d28",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapperQuotaChip.jsx",
"line": 38,
"claim": "A project cache miss makes the Preview tooltip show the AI Assistant call limit.",
"scenario": "A Preview user with a cached personal usage report opens a project for the first time. The new project key has no report, so the tooltip falls back to displaying calls used out of the call limit. A failed usage request leaves that limit visible.",
"action": "Omit the AI Assistant line until a supported usage report is available for the project.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.2",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6173,
"claim": "A recommendation can send a personal invocation after the project has been saved to an organization.",
"scenario": "A member requests a recommendation on an unsaved project. The first save navigates to the organization's project URL while the prompt template request is pending. When that request completes, both the invocation and its cache write still use the old render's missing project ID. The invocation is charged to the member while the chip reads the organization's count.",
"action": "Capture the current project ID when the invocation is first sent and use that same ID for attribution, retries, and the reply cache key.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.3",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6270,
"claim": "A recommendation sent before the first save can leave the saved personal project's count stale.",
"scenario": "A member sends a single recommendation on an unsaved personal project and saves while the invocation is pending. The first-save usage read returns before the service charges the invocation. The later reply contains the updated personal count but writes it to the no-project key. Because the reply carried usage, completion skips the refresh for the saved project, and the chip keeps showing the earlier count.",
"action": "Refresh the displayed project's usage when a completed invocation wrote its report to a different key during first-save navigation.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.4",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 855,
"claim": "The first-save usage read can be skipped when the capability refresh discovers a newly granted permission.",
"scenario": "A member can save projects, but their cached permissions lack the newly granted AI Assistant permission. The route effect runs before the save's capability refresh completes and skips the usage read. The capability response then grants access locally, but the save refresh disabled its usage callback and the route ID has already been recorded. The chip has no project report until another action refreshes it.",
"action": "Coordinate the first-save usage read with the capability refresh and add a lifecycle test that delays the capability response until after navigation.",
"lines_delta": null,
"confidence": "high"
}
]
} |
…h reply for another project asks for the open one's report F2.1: an AutoMatch reply that lands after the project was saved is kept for no project, and a run leaves the usage to its end, which had passed. It now asks for the open project's report too. F2.2: the source test also pins that the usage read names the route's project, the same id the calls name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
Codex review, pass 2 (codex-cli 0.169.0, commit c335c17)Verdict: findings, 2 findings. Earlier findings: FC.1 resolved, FC.2 resolved, F1.1 unresolved, F1.2 unresolved, F1.3 unresolved, F1.4 resolved. F1.1 and F1.2 stand as answered in pass 1. Codex left F1.3 open because of the AutoMatch path, which is F2.1's fix.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "c335c17e834549e825e83ff5e130d1ca9f1569f5",
"verdict": "findings",
"prior": [
{
"id": "FC.1",
"status": "resolved"
},
{
"id": "FC.2",
"status": "resolved"
},
{
"id": "F1.1",
"status": "unresolved"
},
{
"id": "F1.2",
"status": "unresolved"
},
{
"id": "F1.3",
"status": "unresolved"
},
{
"id": "F1.4",
"status": "resolved"
}
],
"findings": [
{
"id": "F2.1",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6266,
"claim": "The follow-up refresh for a reply kept under a different project key only runs for single-row calls.",
"scenario": "Stop Auto Match on an unsaved personal project while an AI row is still running, then save before its reply arrives. The saved project's usage read can capture the provisional token count. When the final reply arrives, it updates only the unsaved entry, leaving the saved project's chip stale until another refresh.",
"action": "Apply the project-change refresh to late Auto Match replies too. Keep each reply under the key for the project its request named.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.2",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/__tests__/usageRouteProject.test.js",
"line": 37,
"claim": "The first-save test checks the callback's source text without verifying that the usage request names the saved project.",
"scenario": "Replacing `project: usageProjectIdRef.current` with `project: undefined` leaves all three source assertions green. After the first save, the request would read the member's own count and the saved project's chip would receive no report.",
"action": "Use the repository's React integration harness to exercise the first-save route transition and assert that the usage request sends the new project ID exactly once.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
Simplification review (Claude subagent, commit 9d60f10)2 items: 1 applied in 5f5614f, 1 declined.
Tests: |
…oject asks only for the open one's report Codex's check of c335c17..5f5614f on #134 (FC.1): the refresh also asked for the account, and a throttled reply to that could hold up the Mapper. A run's own refresh already did the capabilities, so this asks only for the report, which never blocks the Mapper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
Codex check of commits c335c17..5f5614f (codex-cli 0.169.0)Verdict: findings, 1 finding. F2.1 and F2.2 are resolved.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "5f5614fcb5e04f75b099ac48c4061896c7ca4cb2",
"verdict": "findings",
"prior": [
{
"id": "F2.1",
"status": "resolved"
},
{
"id": "F2.2",
"status": "resolved"
}
],
"findings": [
{
"id": "FC.1",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6276,
"claim": "A late AutoMatch reply can block the Mapper by starting an unnecessary account refresh.",
"scenario": "Stop AutoMatch on an unsaved project while an AI request is pending, then save the project. When the reply arrives, this branch sends an extra GET /user/. If that request returns HTTP 429 with a Retry-After header, the app-wide countdown blocks the Mapper even though the save succeeded.",
"action": "Use the existing usage-only refresh for the open project in this branch. Keep the account refreshes at run completion and route change.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex check of commits 5f5614f..800f5f5 (codex-cli 0.169.0)Verdict: clean. FC.1 is resolved. #134 is ready for review at 800f5f5, with CI green. Summary of the loop:
Merge #132 first, then retarget this PR to findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "800f5f5f02a9894e54f751659e89de2e75d88975",
"verdict": "clean",
"prior": [
{
"id": "FC.1",
"status": "resolved"
}
],
"findings": []
} |
snyaggarwal
left a comment
There was a problem hiding this comment.
Approved at 800f5f5.
Checked:
- Saved reports are per person and project (
ai_assistant_usage:<user>:project:<id>), and a project that isn't saved yet keeps the plain key. - The usage read sends
map_projectonly when there's a project. Only one refresh runs per person and project at a time. - The ids match: a reply is kept for the project its
$invokenamed (params.projectIdat send time). If that's no longer the open project, the open project's report is fetched again, both for a single row and for a run. - First save: the save's own refresh skips the report. The route effect fetches the new project's report once the id is in the URL, and does the same on any change of project.
- The Mapper only shows what the OCL AI Assistant reports. It never decides whose count it is. It's safe before the service is deployed: an older service ignores the parameter.
P3, not blocking: saved reports for old projects are never pruned from localStorage.
Merge order: #132 first, then retarget this to main. Deploy after the OCL AI Assistant release that reads map_project (OpenConceptLab/ocl-ai-assistant#256).
|
Thanks, Sunny. The P3 is recorded and left as is: each saved report is one small Merge order noted: #132 first, then this goes to |
Part of OpenConceptLab/ocl_online#641. Stacked on #132 (base
ocl_online#641): merge #132 first, then retarget this tomain.What it does
map_projectin the query string. The OCL AI Assistant reports the count that calls on that project are charged to, the same count each$invokereply carries. So the chip no longer switches between two counts on one project.Needs the OCL AI Assistant change that reads
map_project(OpenConceptLab/ocl_online#641) to be deployed first. Until then, the service ignores the parameter and the chip behaves as it does with #132.Tests
npm test: 693 pass. New tests cover the query parameter, the per-project reports and the first save.Review
Codex lean loop; each pass is posted below.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP