Repository navigation
OpenConceptLab/ocl_online#641 | The Mapper's chip shows the usage the OCL AI Assistant reports - #132
Conversation
…ope and capability, and shows the usage the OCL AI Assistant reports Rebuilt on main from the Oct 29 branch reviewed on OpenConceptLab/ocl_online#614. - A 403 with a string error_code and a string capability opens the limit dialog, even with a code the Mapper doesn't know; the dialog asks /billing/plan/ about that capability. - The AI step skips the row on scope "request" and stops otherwise. The Mapper reads no limit, used or renews_at from a refusal. - The Preview chip's tooltip shows {meter, used} from GET /match/usage/, fetched with axios (not APIService, so a throttled refresh never blocks the Mapper) and kept per person; without a report it keeps its call line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…voke reply reports, and a chip shows it where there's no Preview chip
- A reply's metadata.usage ({meter, used}) is kept as a /match/usage/
refresh would keep it, also during a run, so the Mapper asks
/match/usage/ only for first paint and after a refusal or error.
- What a project stores of a reply (its analysis history and log) leaves
out metadata.usage: it's the person's own count, and a project can be an
organization's.
- Where the Mapper shows no Preview chip, a chip shows the OCL AI
Assistant's report: "OCL AI Assistant: 1.2M tokens used", the exact
count in its tooltip. USAGE_CHIP_METERS says which units get it.
- Copy in en, es, pt-BR and zh.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…ort, a refresh can't overwrite a newer one, and storage errors cost only the report Codex pass 1: - F1.1: a /match/usage/ refresh sent before an $invoke reply kept its report no longer overwrites that report with the older count. - F1.2: reports are kept under one key per person, so another account signing in on the same browser doesn't evict them. - F1.4: a reply's report is kept for the person signed in when the request was sent. - F1.6: a full or blocked storage no longer throws out of the success path, so the recommendation is still saved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…hile it was in flight; refusals keep their capability everywhere Codex pass 2: - F2.1: a /match/usage/ refresh compares what's kept for the person before and after, so a report kept by another tab is no longer overwritten by an older count. - F2.3: a superseded run's late request-scoped refusal leaves the current run's dialog and skip flag alone. - F2.4: the save and AutoMatch run handlers pass the refusal's capability to the dialog. - F2.5: a candidate-matching refusal without a detail is handled as a refusal, not as an empty match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…ce the permissions are fresh Codex pass 3, F3.3 (P2): the usage refresh is limited to people with the OCL AI Assistant permission, so it now runs after the permissions refresh lands rather than beside it, and a stale cached permission no longer skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…e chip and the Preview tooltip, one test for what's read From the simplification review: S3 (the usage line built once, in UsageLine, for both places) and S2 (the extra-fields check joins the first toAIAssistantUsage test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…, the last one asks for the current usage Codex pass 3, F3.1 (P1): each reply's usage is a snapshot, and overlapping calls can land out of order, so the chip could keep an older count. The reports carry no time to order them by, so when single-row calls overlap, the last to finish refreshes from /match/usage/ instead of trusting its own reply. An AutoMatch run already refreshes when it ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…ions again, and one refresh at a time per person Final Codex check of 95dfe6e..b470e4d: - FC.1 (P1): chaining the usage refresh after the permissions refresh skipped it whenever /user/ failed. refreshCapabilitiesAndAIAssistantUsage asks for both side by side again, and asks for usage once more when the fresh permissions newly grant the OCL AI Assistant (pass 3's F3.3). - FC.2 (P2): a refresh asked for while one is in flight waits for it, and those requests share one more, so a refresh can't overtake another and discard its newer count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…ueue test passes CI's lint Final Codex check of b470e4d..9f040df: - FC.1 (P1): the new test used setImmediate, which CI's ESLint rejects (no-undef); it waits with setTimeout instead. - FC.2 (P2): the per-person refresh queue was a plain object, so a username such as "constructor" found an inherited property; it's a Map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
… no dialog of its own The row is still skipped and a run still goes on. What the person is told, and its wording, is left to OpenConceptLab/ocl_online#702, which designs these notices. This drops the dialog's title and text in each language, and the test that checked them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…s usage without saying whose count it is A reply's usage can be counted for more than the person who sent it, so the comment gives the reason that holds either way: it's a running count, not part of the project's work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP
…re than the project, not whose it is Answers the Codex check of 5892a6d: "for whoever sent the request" read as if the count were the sender's alone. 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 1238cac)Verdict: findings, 7 findings.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "full",
"commit": "1238cac",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "F1.1",
"severity": "P1",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 56,
"claim": "A delayed usage refresh can overwrite a newer report from a successful invocation.",
"scenario": "The project opens and the usage endpoint reads 100 tokens. Its response is delayed while a single-row invocation reports 300. The chip updates to 300, then drops back to 100 when the older response arrives and stays there until another refresh.",
"action": "Version each user's cache writes and discard a refresh result if a newer report was accepted while it was in flight.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.2",
"severity": "P1",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 12,
"claim": "The cache has one shared slot, so a report for one account evicts the report for another.",
"scenario": "Alice's usage is cached on a shared browser. Bob signs in and gets his own report. When Alice returns and her refresh gets a 429, her chip has lost the last report it should retain.",
"action": "Key storage reads, writes, and removals by username. Test that both accounts retain their reports when a refresh fails.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.3",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapperQuotaChip.jsx",
"line": 75,
"claim": "The Preview chip still displays an OCL AI Assistant limit when the usage service has supplied no report.",
"scenario": "On a capped project with no cached usage report, the tooltip falls back to the legacy capabilities counter and can show “3 of 10 used” while the usage endpoint is unavailable or returns no meter. The user sees an AI usage figure and a limit that the OCL AI Assistant's usage report did not supply.",
"action": "Render the OCL AI Assistant usage line only when the usage cache contains a supported service report.",
"lines_delta": null,
"confidence": "medium"
},
{
"id": "F1.4",
"severity": "P2",
"tag": null,
"file": "src/common/utils.js",
"line": 294,
"claim": "A successful invocation can put one account's usage under another account's name.",
"scenario": "A tab sends an invocation using Alice's token. A sign-in in another tab replaces the shared user record with Bob's before the invocation finishes. The reply handler rereads the current username and stores Alice's count as Bob's, which Bob's chip can display.",
"action": "Bind the usage write to the username associated with the token used for the invocation. Discard an update if its request identity cannot be established.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.5",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/previewLimits.js",
"line": 41,
"claim": "The new capability-shaped refusal check ignores the HTTP status.",
"scenario": "A custom AutoMatch algorithm returns HTTP 400 with `error_code: \"validation_error\"` and a string `capability` for an invalid batch. The shared detector treats it as a limit refusal, so AutoMatch stops sending later match batches and suppresses its normal batch-failure notice.",
"action": "Require HTTP 403 for the new unknown-code path and preserve the response status through adapters that unwrap error bodies. Test the same payload with both 400 and 403.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.6",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6186,
"claim": "A usage-cache write failure discards a successful AI recommendation.",
"scenario": "An invocation succeeds and includes usage, but the browser rejects the localStorage write because the origin has run out of storage. The exception reaches the invocation failure handler before the analysis and row log are saved, so the user loses the recommendation even though the service processed it.",
"action": "Handle usage-cache write failures independently so the sanitized recommendation and row log are still saved.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F1.7",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 4086,
"claim": "A match-limit dialog can suppress the first AI refusal dialog in the same AutoMatch run.",
"scenario": "AutoMatch gets candidates for some rows, hits a match limit, and opens its dialog. It then runs AI on the rows that have candidates. An AI invocation returns a request-scoped 403 with its own capability. The shared dialog flag suppresses the AI dialog, so the user gets no explanation for that skip and the Mapper never asks online-api about the AI capability.",
"action": "Deduplicate repeated refusals by phase and capability so a prior match refusal cannot suppress the first AI refusal.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex review, pass 2 (codex-cli 0.169.0, commit 9a72acd)Verdict: findings, 5 findings. Earlier findings: F1.1 unresolved, F1.2 resolved, F1.3 unresolved, F1.4 regressed, F1.5 unresolved, F1.6 resolved, F1.7 unresolved.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "9a72acd",
"verdict": "findings",
"prior": [
{
"id": "F1.1",
"status": "unresolved"
},
{
"id": "F1.2",
"status": "resolved"
},
{
"id": "F1.3",
"status": "unresolved"
},
{
"id": "F1.4",
"status": "regressed"
},
{
"id": "F1.5",
"status": "unresolved"
},
{
"id": "F1.6",
"status": "resolved"
},
{
"id": "F1.7",
"status": "unresolved"
}
],
"findings": [
{
"id": "F2.1",
"severity": "P1",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 75,
"claim": "A delayed usage refresh can still overwrite a newer report saved by another tab.",
"scenario": "The same user has two Mapper tabs open. One tab's usage GET captures 100 tokens and its response is delayed. An invoke in the other tab saves 300 tokens. The first tab's module counter never sees that write, so the delayed GET replaces the shared report with 100.",
"action": "Track report revisions per username in shared storage and discard a refresh if that user's report changed while it was pending.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.2",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6146,
"claim": "An invoke retry can use a different account's token while retaining the first attempt's username.",
"scenario": "Alice's first invoke attempt fails with a transient network error. Another tab replaces the session with Bob's during backoff. The retry reads Bob's token from localStorage, but a successful reply stores Bob's usage under Alice's key.",
"action": "Bind the invoke's username and token to the same session and cancel pending retries when that session changes.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.3",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 4088,
"claim": "A request-scoped refusal from a stopped run can suppress the next run's first request-scoped refusal dialog.",
"scenario": "The user stops run A with an invoke pending and starts run B. A's late request-scoped 403 arrives after B resets its dialog flag. The late response sets B's flag to 'skip' even though it has no current row. B's own first request-scoped refusal then never opens its dialog or looks up its capability.",
"action": "Keep late request-scoped refusals from superseded runs out of the current run's dialog state.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.4",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 2104,
"claim": "The AutoMatch run-creation and project-save handlers drop the capability carried by a refusal.",
"scenario": "Creating an AutoMatch run or saving at line 1857 returns a 403 with an unknown string error code and a string capability. The dialog opens, but its billing request omits the capability because these handlers pass only the error code and the fallback table has no entry.",
"action": "Forward the response's capability when setting dialog state in both handlers.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F2.5",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 4251,
"claim": "Single-row candidate matching treats a recognized 403 as a successful empty match when the body has no detail field.",
"scenario": "The match endpoint replies with a 403 containing an unknown string error code and a string capability, with no detail. The request adapter recognizes the refusal and passes the body through. The row handler skips its error branch, marks the algorithm done and opens no dialog.",
"action": "Handle recognized refusals before testing for detail, or pass the adapter's refusal classification through to the row handler.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex review, pass 3 (codex-cli 0.169.0, commit 95dfe6e)Verdict: findings, 4 findings. Earlier findings: F1.1 regressed, F1.2 resolved, F1.3 unresolved, F1.4 resolved, F1.5 unresolved, F1.6 resolved, F1.7 unresolved, F2.1 unresolved, F2.2 unresolved, F2.3 resolved, F2.4 resolved, F2.5 resolved.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "verify",
"commit": "95dfe6e",
"verdict": "findings",
"prior": [
{
"id": "F1.1",
"status": "regressed"
},
{
"id": "F1.2",
"status": "resolved"
},
{
"id": "F1.3",
"status": "unresolved"
},
{
"id": "F1.4",
"status": "resolved"
},
{
"id": "F1.5",
"status": "unresolved"
},
{
"id": "F1.6",
"status": "resolved"
},
{
"id": "F1.7",
"status": "unresolved"
},
{
"id": "F2.1",
"status": "unresolved"
},
{
"id": "F2.2",
"status": "unresolved"
},
{
"id": "F2.3",
"status": "resolved"
},
{
"id": "F2.4",
"status": "resolved"
},
{
"id": "F2.5",
"status": "resolved"
}
],
"findings": [
{
"id": "F3.1",
"severity": "P1",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 54,
"claim": "A slower invocation can overwrite a newer usage snapshot.",
"scenario": "A user requests analysis for two rows in quick succession. The service counts the calls before running the model, so the first request carries 200 and the second carries 201. If the second finishes first, the chip shows 201 and then drops to 200 when the first finishes. Both replies skip the follow-up refresh, so the stale count stays cached.",
"action": "Use a service-supplied snapshot revision to order overlapping replies. Add a test that delivers two successful invocations in reverse order.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F3.2",
"severity": "P2",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 81,
"claim": "Comparing the cached report by value can miss an intervening write or discard a fresher refresh.",
"scenario": "The cache holds 10,000 tokens from an earlier period. A refresh reads 9,000 in the current period, then stalls. An invocation reports 10,000 and writes the same cached value, so the delayed refresh overwrites it with 9,000. Conversely, when two refreshes start from the same cache value, the first one to write can suppress the second even when the second sampled a newer count.",
"action": "Track a per-user revision for every report write across tabs and order overlapping refresh results. Cover identical intervening writes and overlapping refreshes in tests.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F3.3",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 165,
"claim": "Opening a project can miss the usage refresh when the cached permissions are stale.",
"scenario": "A returning user has been granted OCL AI Assistant access again and has usage on the service. The project opens with cached permissions that predate the grant. The usage refresh exits immediately, then the permissions refresh enables the assistant UI. With no cached report, the chip stays absent until another action refreshes usage or an invocation supplies it.",
"action": "Check eligibility for the usage refresh after the permissions refresh completes, while preserving the skip after a reply that carries usage.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "F3.4",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 4086,
"claim": "A request-scoped refusal leaves the consecutive AI failure count intact.",
"scenario": "In AutoMatch, row 1 fails after retries, row 2 receives a request-scoped refusal, and row 3 fails after retries. The two-failure cutoff then stops the AI step before row 4, although the request-scoped skip separated the two failed rows.",
"action": "Clear the consecutive failure count when the current run skips a row for a request-scoped refusal.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Simplification review (Claude subagent, commit 7fc52c8)
|
Codex check of commits 95dfe6e..b470e4d (codex-cli 0.169.0)Verdict: findings, 2 findings. Earlier findings: F3.3 regressed, F3.1 regressed.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "b470e4d",
"verdict": "findings",
"prior": [
{
"id": "F3.3",
"status": "regressed"
},
{
"id": "F3.1",
"status": "regressed"
}
],
"findings": [
{
"id": "FC.1",
"severity": "P1",
"tag": null,
"file": "src/components/map-projects/MapProjects.jsx",
"line": 73,
"claim": "A failed permissions refresh now suppresses the usage fetch on both Mapper pages.",
"scenario": "A user with cached AI Assistant permission opens the project list without a cached usage report. The permissions endpoint returns 503 while the AI Assistant usage endpoint is healthy. The permissions helper calls back only on 200, so the usage request is never sent and the chip stays absent. The previous code fetched and displayed the usage independently.",
"action": "Use fresh permissions when the lookup succeeds. If it fails or times out, let the usage refresh use the cached permission for the same signed-in user.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.2",
"severity": "P2",
"tag": null,
"file": "src/components/map-projects/MapProject.jsx",
"line": 6250,
"claim": "The new reconciliation request can cause a later usage refresh to discard a newer count.",
"scenario": "Two overlapping replies leave 100 in the cache, and the new reconciliation fetch reads 200. Before it returns, another row call consumes more usage but returns no usage report, so its fallback fetch reads 300. Both fetches started with 100 cached. When the reconciliation response writes 200 first, the fallback discards 300 because storage changed while it was in flight. Before this change, the fallback would have stored 300.",
"action": "Serialize usage fetches per user and queue a follow-up fetch when another refresh is requested in flight. Keep the protection against overwriting a newer invocation report.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex check of commits b470e4d..9f040df (codex-cli 0.169.0)Verdict: findings, 2 findings. Earlier findings: FC.1 resolved, FC.2 resolved.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "9f040df",
"verdict": "findings",
"prior": [
{
"id": "FC.1",
"status": "resolved"
},
{
"id": "FC.2",
"status": "resolved"
}
],
"findings": [
{
"id": "FC.1",
"severity": "P1",
"tag": null,
"file": "src/common/__tests__/aiAssistantUsage.test.js",
"line": 161,
"claim": "The new test fails the lint step in both the PR and build workflows.",
"scenario": "All 688 tests pass, but the specified ESLint command exits 1 because `setImmediate` is undefined under the repo's lint configuration. CI stops before running its tests, and the build job is skipped.",
"action": "Import `setImmediate` from `node:timers/promises` and call it directly.",
"lines_delta": null,
"confidence": "high"
},
{
"id": "FC.2",
"severity": "P2",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 96,
"claim": "Usage refresh throws for valid usernames that match inherited object properties.",
"scenario": "When an account named `constructor` opens the Mapper with OCL AI Assistant access, the queue lookup returns the inherited `Object` constructor. Reading `running.promise.then` throws before the usage request is sent. The same refresh succeeds on `b470e4d`.",
"action": "Use a `Map` for the per-user queue and add a regression test with the username `constructor`.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex check of commit 9f040df..0037e49 (codex-cli 0.169.0)Verdict: clean. Earlier findings: FC.1 resolved, FC.2 resolved. findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "0037e49c918ab1da40b05027c949e50730f3a5c6",
"verdict": "clean",
"prior": [
{
"id": "FC.1",
"status": "resolved"
},
{
"id": "FC.2",
"status": "resolved"
}
],
"findings": []
} |
Codex check of commit 0037e49..e63a65d (codex-cli 0.169.0)Verdict: clean. e63a65d keeps refusal and limit wording out of this PR, for OpenConceptLab/ocl_online#702: a refusal scoped to its request still skips only its row, but opens no dialog of its own. That also removes the second findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "e63a65da093aba8922e1a0b3e8b9559977f7fd05",
"verdict": "clean",
"prior": [],
"findings": []
} |
Codex check of commit e63a65d..5892a6d (codex-cli 0.169.0)Verdict: findings, 1 finding.
findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "5892a6dbcf531b6ef0eaa0e35b0d346f0dbb1af4",
"verdict": "findings",
"prior": [],
"findings": [
{
"id": "FC.1",
"severity": "P1",
"tag": null,
"file": "src/common/aiAssistantUsage.js",
"line": 59,
"claim": "The commit changes only this comment, but it still describes the running usage count as specific to the request sender.",
"scenario": "When two members request recommendations on an organization-owned project, a reply can report the organization's shared total, including usage from both members. The comment suggests that the total covers only the sender.",
"action": "Explain that the saved reply omits the service's running usage total because it can include activity outside the project.",
"lines_delta": null,
"confidence": "high"
}
]
} |
Codex check of commit 5892a6d..54ee227 (codex-cli 0.169.0)Verdict: clean. Earlier findings: FC.1 resolved. findings.json{
"reviewer": "codex-cli 0.169.0",
"perspective": "defects",
"mode": "final",
"commit": "54ee227815db105d903489930cf150a30f187adf",
"verdict": "clean",
"prior": [
{
"id": "FC.1",
"status": "resolved"
}
],
"findings": []
} |
snyaggarwal
left a comment
There was a problem hiding this comment.
Approved at 54ee227.
Checked:
- Refusals:
- A 403 with a string
error_codeandcapabilitycounts as one. scope: "request"skips only that row's AI step, and a run goes on without a dialog.- Any other scope stops the AI step and opens the existing dialog, which asks
/billing/plan/about thatcapabilityand shows only the next step it sends. - Nothing reads
limit,usedorrenews_atfrom a refusal.
- A 403 with a string
- Usage:
{meter, used}fromGET /match/usage/and from$invoke'smetadata.usageis saved per person. A late refresh never overwrites a newer report, across tabs too. What a project stores (its history and the row log) leavesmetadata.usageout. - The chip shows only the unit and the count the OCL AI Assistant sends. Without a report, nothing changes. The copy in en, es, pt-BR and zh shows usage only.
P3, not blocking: the new locale keys continue the preview_quota_ prefix (preview_quota_ai_tokens, preview_quota_used), which belongs to the debt noted on OpenConceptLab/ocl_online#532. Neutral names such as ai_assistant_usage_tokens would keep new keys out of it, if this is touched again.
F3.1's mitigation (the last of overlapping calls fetches the current count again) is fine for now. A read time from the service would close it.
Merge this, then retarget #134 to main. Deploy after the OCL AI Assistant release with OpenConceptLab/ocl-ai-assistant#256.
Part of OpenConceptLab/ocl_online#641: users see the usage the OCL AI Assistant reports on the Mapper's chip.
What it does
error_codeand a stringcapabilitycounts as a refusal, even with a code the Mapper doesn't know. The existing dialog asks online-api's/billing/plan/about that capability, and shows only the next step it sends.scope: "request": only that row's AI step is skipped, and AutoMatch goes on to the next rows. It opens no dialog and adds no wording: what the person is told is left to OpenConceptLab/ocl_online#702.limit,usedorrenews_atfrom a refusal.{meter, used}comes from the OCL AI Assistant'sGET /match/usage/for first paint and after a refusal or error, and frommetadata.usageon each$invokereply, so the chip follows a run as it goes. It's kept per person. The request uses axios, not APIService, so a throttled refresh keeps the last report and never blocks the Mapper.USAGE_CHIP_METERSsays which units get it. Without a report, there's no chip.metadata.usage: it's the service's running count, which covers more than this project's work.What the Mapper shows is only what the connected service sends: a unit and a count. It never shows or works out a limit or what's left. Without an OCL AI Assistant, or one that sends no report, nothing changes.
Open: on some projects, a reply's report counts something different from
GET /match/usage/, so the chip shows whichever arrived last. Whether the two should agree is open on OpenConceptLab/ocl_online#641; if they should, the change lands in the service.Tests
npm test: 688 pass. New tests cover the report's shape, keeping it per person, keeping a reply's report, leaving it out of what a project stores, the chip's units, the refusal's scope and capability, and the copy in every language.Review
Lean loop (codex-cli 0.169.0); each pass and check is posted below.
maintoday, existing debt noted on OpenConceptLab/ocl_online#532), F1.5, F1.7, F2.2, F3.2 (same root as F3.1) and F3.4. Each has its reason in the pass comments.🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qVq1YwJv43QFnQSLDP