Datasets:
Download keys/dev10.md from QuickchatAI/quickreview-bench: direct link, hf CLI and curl.
- Browser
- Download file 122 kB
-
https://huggingface.co/datasets/QuickchatAI/quickreview-bench/resolve/refs%2Fpr%2F2/keys/dev10.md
- Command line
-
hf download hf://datasets/QuickchatAI/quickreview-bench@refs/pr/2/keys/dev10.md
-
curl -L -o dev10.md https://huggingface.co/datasets/QuickchatAI/quickreview-bench/resolve/refs%2Fpr%2F2/keys/dev10.md
Ground truth — dev10 (v2)
37 real defects in 10 PRs. Generated from dev10.json — edit the JSON, bump version, regenerate. Per PR: a blind expert hunt from the diff and code; every candidate (the hunt, the AACR references with hand labels, and every comment any reviewer posted in our runs, anonymised) checked against the code, merged and graded, exclusions recorded; an adversarial critic per set spot-checked inclusions, exclusions and merges, and its 12 corrections were applied (2026-09-26). v2 (2026-09-26): the judge's 44 new-defect candidates from 12 judged runs were checked against the code — 1 added, 2 restated existing defects, 41 rejected (added to each PR's excluded list, which the judge now reads).
bitcoin__bitcoin@724546e
bitcoin-cli -netinfo now reports the node's local services. At level 0, which is the default, a new "Local services: network, bloom, witness, ..." line is printed before "Local addresses". It is built by the new ServicesList() helper, which lower-cases the names, turns '_' into spaces and joins them with ", ". At detail levels 1-4 the report header instead gets " - services ", built with the existing FormatServices(). The PR touches one file, src/bitcoin-cli.cpp.
D1 · high · bug — std::string_view services dangles: it is bound to the temporary std::string from strprintf, then read on the next line
services is declared as const std::string_view and initialized from a conditional expression. Because strprintf returns std::string, the expression is a temporary std::string (the "" branch converts to std::string too), and that temporary is destroyed at the end of the declaration. The next statement passes the dangling view to strprintf to build the report header. On every -netinfo 1..4 the header therefore reads freed memory: " - services nbwcl2" is too long for the small-string buffer, so this is a heap use-after-free that can garble the header, fail under ASan, or trigger clang -Wdangling-gsl. The fix is to own the string (const std::string services{...}).
- Sites:
src/bitcoin-cli.cpp:585(cause);src/bitcoin-cli.cpp:586(symptom) - Evidence: src/bitcoin-cli.cpp:585 at head:
const std::string_view services{DetailsRequested() ? strprintf(" - services %s", FormatServices(networkinfo["localservicesnames"])) : ""};and :586:std::string result{strprintf("%s client %s%s - server %i%s%s\n\n", CLIENT_NAME, FormatFullVersion(), ChainToString(), networkinfo["protocolversion"].getInt<int>(), networkinfo["subversion"].get_str(), services)};. The ?: expression mixes std::string with const char[1], so its common type is a std::string prvalue, and the string_view is built through std::string::operator string_view. The temporary dies at the end of line 585's full-expression. How it is reached: NetinfoRequestHandler::ProcessReply runs on everybitcoin-cli -netinfo N. For N in 1..4,DetailsRequested()(line 407:m_details_level > 0 && m_details_level < 5) is true, so the heap-allocated string is created, destroyed, and then read at line 586. At level 0 the view also dangles, but its length is 0, so nothing is read. - Counts if: To count, a comment must say that the string_view
servicesat line 585 refers to a temporary std::string (the result of strprintf or the ternary) that is destroyed before line 586 uses it: a dangling view, use-after-free or UB. It counts with or without the fixstd::string services. Near-misses that do not count: a generic remark that string_view is risky with no lifetime or temporary argument; a comment about FormatServices' output format; a comment that the level-0 empty-string branch is inefficient.
Checked and rejected (5)
- ref 0 — Incorrect. The different formatting (lower-case words vs FormatServices' letters) is the intended level-0 output shown in the PR description. localservicesnames is always a server-built array of strings (rpc/net.cpp:687, GetServicesNames via serviceFlagsToStr), and the existing FormatServices already calls get_str() on it the same way, so the defensive-typing concern has no reachable path.
- ref 1 — Incorrect. The order is not arbitrary: serviceFlagsToStr (protocol.cpp:108-118) walks the service bits in ascending order, so the output is deterministic and matches bit order and the letter order of FormatServices.
- ref 2 — Incorrect. The project requires C++20 (CMakeLists.txt:68
set(CMAKE_CXX_STANDARD 20), STANDARD_REQUIRED ON), and is already included, so std::ranges::replace cannot break the build. - R6, R8, R9, R10 — These are requests to add functional-test coverage for the new output modes. Test requests are not defects.
- R7 — This asks to update the
-netinfo helplevel descriptions (the level-1 help still says "Like 0" although the new services line appears only at level 0). It is a documentation request about a human-readable dashboard whose help explicitly says the output "will change regularly". It has no functional consequence, so it is not a defect under this benchmark's rules.
FreeCAD__FreeCAD@699b45c
This PR cleans up MSVC warnings across 16 files, with 33 additions and 27 deletions. It adds float literals and casts where values narrow from double to float: View3DInventor(Viewer), ViewProviderPlane, DAGRectItem, Tools.h fromPercent, and three angle-wrap lines in SoDatumLabel. It changes printf-style specifiers: StackWalker %d becomes %ld for DWORD arguments, and pyarea on Windows goes from %Iu to %zu. It adds case NumSymTypes and default: break for enumerators the switches did not handle, drops unused catch variables and an unused lambda capture, and marks a debug-only local [[maybe_unused]]. FemVTKTools' countScaPos changes from int to size_t. PropertySheet::getLinksTo now passes std::string instead of .c_str() to the ObjectIdentifier ctor. The old const char* argument silently picked the (owner, bool localProperty) overload, so this is a latent fix, and the vector-identifier getLinksTo has no in-tree callers. Two test tweaks are included. Almost every hunk keeps behaviour the same. Two changes do not fully do what they intend. The SoDatumLabel angle wraps still multiply by a double literal, so the float += double narrowing remains. The StackWalker DWORD specifiers become the signed %ld instead of %lu.
D1 · low · incomplete-fix — SoDatumLabel angle-wrap casts leave the right-hand side double, so the float += double narrowing (C4244) the PR targets remains
The PR rewrites range += 2.0 * M_PI and endangle += 2. * M_PI as 2.0 * static_cast<float>(M_PI) and 2. * static_cast<float>(M_PI). Because 2.0 and 2. are double literals, double * float still produces a double. Each compound assignment is still float += double with an implicit narrowing, so the MSVC C4244 warning this PR is meant to silence still fires in all three places. The cast only lowers the precision of the constant. The warning-free form is 2.0F * (float)M_PI, which the same file already uses at line 1541.
- Sites:
src/Gui/SoDatumLabel.cpp:82-85(cause);src/Gui/SoDatumLabel.cpp:551-553(other-site);src/Gui/SoDatumLabel.cpp:694-696(other-site) - Evidence: The head has
float range = endAngle - startAngle; if (range < 0.) { range += 2.0 * static_cast<float>(M_PI); }at SoDatumLabel.cpp:82-84. At :552 and :695 it hasfloat endangle = atan2f(...); if (endangle < startangle) { endangle += 2. * static_cast<float>(M_PI); }. Under the usual arithmetic conversions, a double literal times a float gives a double, sofloat += doublestill narrows. The file's correct form is at :1541,endangle += 2.0F * (float)M_PI;, and float-only forms appear at :1199/:1201 asangle -= (float)M_PI;. The code runs on every glDrawArc call with a negative range and on every arc/angle datum label render where endangle < startangle. The impact is a compile warning that stays, plus a sub-ulp change to the constant. There is no functional breakage. - Counts if: To count, a comment must say that
2.0/2.is a double literal, so the expression stays double. It must also say either that the double-to-float conversion/warning is not fixed, or that2.0F/2.0fis needed. Pointing at any of the three sites counts. Near-misses that do not count: comments only about float vs double performance with no mention that the narrowing or warning remains (the dataset framed it as 'performance'; accept that framing only if it says the arithmetic is still double); comments about the default argumentendAngle=2.0*M_PIat :81, which the PR did not touch; and generic advice to prefer float literals elsewhere.
D2 · low · incomplete-fix — StackWalker prints DWORD (unsigned long) arguments with the signed %ld specifier instead of %lu
The PR replaces %d with %ld in every StackWalker diagnostic format that takes DWORD arguments: module size and result, the file-version words v1..v4, entry.lineNumber, GetLastError gle, symOptions, and the OS-version fields. DWORD is unsigned long, so the matching specifier is %lu. As written, specifier and argument still disagree in signedness. Any value with the high bit set prints as a negative number, for example SYMOPT_DEBUG 0x80000000 in symOptions or an HRESULT-style GetLastError code. The PR's own goal of making specifiers match their types is therefore only half done.
- Sites:
src/Base/StackWalker.cpp:1473(cause);src/Base/StackWalker.cpp:1489-1490(other-site);src/Base/StackWalker.cpp:1540(other-site);src/Base/StackWalker.cpp:1559(other-site);src/Base/StackWalker.cpp:1576(other-site);src/Base/StackWalker.cpp:1609(other-site) - Evidence: StackWalker.cpp:1455-1462 has
void StackWalker::OnLoadModule(..., DWORD size, DWORD result, ...), and :1473 formats them with"... size: %ld (result: %ld) ...". At :1483-1486,DWORD v4 = (DWORD)(fileVersion & 0xFFFF); ...is printed with"%ld.%ld.%ld.%ld"at :1490.entry.lineNumber(DWORD) uses%ldat :1540.OnDbgHelpErr(LPCSTR, DWORD gle, DWORD64)usesGetLastError: %ldat :1559.OnSymInit(LPCSTR, DWORD symOptions, ...)usessymOptions: %ldat :1576.ver.dwMajorVersionand the other OS-version DWORDs use%ldat :1609. DWORD is typedef'dunsigned longon Windows, and%ldexpects a signedlong. This is not a regression, since the old%dwas signed too. The impact is only cosmetic diagnostic output, and only for values >= 2^31. - Counts if: To count, a comment must say that the new
%ldis signed while the DWORD argument is unsigned (unsigned long), and that%luor another unsigned conversion is the right specifier. Any one of the listed lines counts. Near-misses that do not count: claims that%ldis the wrong size, since long and DWORD are both 32-bit on Windows; comments about the%por0x%xconversions; and comments about thecase NumSymTypesaddition.
Checked and rejected (13)
- ref 0 — This is a style preference.
case NumSymTypes: break;exists only to satisfy C4062. An assert(false) or a future std::unreachable in a crash-reporting path, where SymType comes from dbghelp at runtime, is not a needed fix, and adding one could be harmful. - ref 7 — The redundant
std::roundfon an integral long predates the PR, which only added the cast. It is harmless and has no behavioural consequence. This is a nit. - ref 8 — The long-to-float precision concern is speculative. float is exact up to 2^24, and callers pass 0-100 percentages. The suggested double rewrite is equally redundant.
- ref 9 — The premise is wrong or harmless. On Qt6
QColor::setAlphaFtakes a float, so0.15fremoves a double-to-float truncation, which is the PR's purpose. On Qt5 the float-to-double widening is lossless. - ref 12 — Making
nearClippingPlaneconst is pure style. It is a local used once. - ref 13 —
nverticesis std::size_t, so%zuis correct. The project requires C++20, which implies an MSVC with a UCRT that supports %zu (VS2015+). The 'older MSVC' concern does not apply. - ref 14 — This is generic advice to log exception details. The PR dropped an unused catch variable to fix a warning, and the existing message is adequate. Not a defect.
- ref 15 — Returning the incoming dimType for every other geometry is the function's documented, pre-existing behaviour. The PR only made the fallthrough explicit with
default: break;. Nothing is newly ignored. - R10, R11, R12 — Tools.h:148 redundant roundf. The redundancy predates the PR and has no consequence, so this is a simplification nit (same as ref 7).
- R13, R14, R15 — pyarea.cpp: collapsing the three-way #if into a single %zu is a cleanup suggestion. The 32-bit
%dbranch's signedness mismatch predates the PR and was not touched. The PR's Windows change is correct. - R16 — DimensionValidators: the duplicated 2D/3D switch predates the PR. The PR only added identical
default: break;arms to silence C4062, so asking to consolidate is a refactor request, not a defect. - hunt: PropertySheet::getLinksTo ObjectIdentifier overload change — This is not a defect. Passing std::string makes emplace_back select the intended (owner, property) ctor. The old const char* argument silently chose (owner, bool localProperty=true) and produced an empty identifier. The change fixes that, and the vector-identifier getLinksTo overloads have no in-tree callers, so no caller relied on the old behaviour.
- hunt: FemVTKTools countScaPos int->size_t — This is correct. countScaPos is only compared against the size_t elements of scalarPos via std::find, and it is only reset to 0 or incremented. The uninitialised use when a -2 line precedes any -1 line predates the PR, which did not change it.
CherryHQ__cherry-studio@83a2594
PR #5540 ("feat: 支持自定义助手地址") adds a custom assistant-list URL setting: a settings.defaultaides field (initial value 'settings.defaultaides', reducer setefaultAides), a new Data Settings panel (DefaultaidesSettings.tsx plus a menu entry with an inline star icon), and locale strings. The strings are nested settings.data.default_aides.* in zh-CN only; the other locales get a flat settings.defaultaides. useSystemAgents now reads the setting from store.getState() during render. If the value starts with 'http' it calls a new useRemoteSystemAgents, which waits 500 ms, fetches the URL and casts the JSON to Agent[]. Otherwise it calls the original local hook, now named useLocalSystemAgents, which reads the bundled agents.json.
Defects found:
- Hooks are called conditionally, which breaks the repo's rules-of-hooks lint, and CI runs that lint.
- The UI strings only resolve in zh-CN.
- The default value is a raw i18n key.
- A failed remote load does not fall back to the bundled agents.
- The remote payload is not validated.
- The source setting is read without subscribing to the store.
- Every mount pays the 500 ms delay and a re-fetch, with no caching.
- There is no persist migration.
- The exported action name is misspelled.
D1 · high · build — useSystemAgents / useRemoteSystemAgents call hooks conditionally (rules-of-hooks violation): CI lint fails, and hook order differs between the local and remote sources
useSystemAgents returns useLocalSystemAgents() or useRemoteSystemAgents() from different if branches. The two hooks call different hook sequences: local calls useState, then useRuntime (a selector hook), then useEffect; remote calls useState, then useEffect. useRemoteSystemAgents also calls useEffect after an early return agents. The repo's ESLint config enables reactHooks.configs['recommended-latest'], where rules-of-hooks is an error that --fix cannot repair, so the PR CI yarn lint step fails. At runtime, a mounted consumer that re-renders after the setting crosses the http/non-http boundary would render a different hook sequence, which is React's hook-order error.
- Sites:
src/renderer/src/pages/agents/index.ts:19-30(cause);src/renderer/src/pages/agents/index.ts:32-40(cause);src/renderer/src/pages/agents/index.ts:61-63(other-site);eslint.config.mjs:15(other-site);.github/workflows/pr-ci.yml:45-46(symptom) - Evidence: index.ts:20-29
const { defaultaides } = store.getState().settings; if (defaultaides === null || defaultaides === undefined) { ...; return useLocalSystemAgents(); } if (!defaultaides.startsWith('http')) { return useLocalSystemAgents(); } else { return useRemoteSystemAgents(); }. index.ts:36-40if (defaultaides === null || defaultaides === undefined) { ... return agents; } useEffect(() => {puts a hook after an early return. useLocalSystemAgents (61-63) calls useState, thenuseRuntime()(=useAppSelector(...), useRuntime.ts:4-6), then useEffect; the remote hook calls only useState and useEffect. eslint.config.mjs:15reactHooks.configs['recommended-latest']sets rules-of-hooks to error. The repo already has to opt out of this rule explicitly: useKnowledge.ts:1/* eslint-disable react-hooks/rules-of-hooks */. pr-ci.yml:45-46- name: Lint Check / run: yarn lint. package.json"lint": "eslint . ... --fix": --fix cannot repair rules-of-hooks, so the step exits non-zero. Runtime reachability is narrow today, because both consumers (the AgentsPage route and the AddAssistantPopup modal) normally remount after a settings change. The lint break is the concrete consequence. - Counts if: To count, a comment must say one of these: the local and remote hooks are selected/called conditionally; the two branches have different hook sequences, so hook order changes and React can throw a hook-order error; useEffect is called after an early return; or this violates the Rules of Hooks / fails react-hooks lint. These do NOT count on their own: saying only that store.getState() is non-reactive or should be useSelector (that is D6); saying only that the null check is duplicated or dead; generic 'refactor this hook'.
D2 · medium · bug — New settings UI strings exist only in zh-CN; en-US (fallback), ja, ru, zh-TW and the machine-translated locales show raw i18n keys
The new menu entry and panel call t('settings.data.default_aides.title'), '...repo_url' and '...repo_url_placeholder'. Only zh-cn.json defines settings.data.default_aides. en-us, ja-jp, ru-ru and zh-tw instead add a flat, unused settings.defaultaides string at the wrong path under a different name. en-US is the fallbackLng, so every non-zh-CN user sees the literal key strings in the Data Settings menu, the section title, the row label and the placeholder. This contradicts the PR's claim that multi-language support was updated.
- Sites:
src/renderer/src/i18n/locales/en-us.json:1391(cause);src/renderer/src/i18n/locales/ja-jp.json:1391(other-site);src/renderer/src/i18n/locales/ru-ru.json:1391(other-site);src/renderer/src/i18n/locales/zh-tw.json:1391(other-site);src/renderer/src/i18n/locales/zh-cn.json:970-974(other-site);src/renderer/src/pages/settings/DataSettings/DataSettings.tsx:114-118(symptom);src/renderer/src/pages/settings/DataSettings/DefaultaidesSettings.tsx:26-36(symptom) - Evidence: DataSettings.tsx:116
title: 'settings.data.default_aides.title', rendered at :180title={t(item.title || '')}. DefaultaidesSettings.tsx:26/29/36 uset('settings.data.default_aides.title' | '.repo_url' | '.repo_url_placeholder'). Parsing the head JSON gives: en-us/ja-jp havesettings.defaultaides= 'Built-in'/'内蔵' and nosettings.data.default_aides; zh-cn hassettings.data.default_aides= {repo_url, repo_url_placeholder, title} and nosettings.defaultaides. i18n/index.ts:40fallbackLng: defaultLanguage; packages/shared/config/constant.ts:164defaultLanguage = 'en-US'. The translate/{el-gr,es-es,fr-fr,pt-pt}.json files are untouched, so they fall back to en-US, which also lacks the keys. No t('settings.defaultaides') call exists anywhere. - Counts if: To count, a comment must say that the keys used by the new UI (
settings.data.default_aides.*) are missing from the non-zh-CN locales, or that en/ja/ru/zh-TW definedefaultaidesat a different name/path, so users of those languages (and the en-US fallback) see raw keys or untranslated labels. Pointing at any one of the locale files or at the t() call sites is enough. Does NOT count: a comment that says zh-cn.json is the wrong one and should be renamed to 'defaultaides' (backwards). Also does NOT count: a pure casing or naming-style remark about 'default_aides' vs other keys with no mention of lookup failure.
D3 · medium · incomplete-fix — A failed remote load leaves the system assistant list empty; no fallback to the bundled agents despite the PR's 'fallback mechanism' claim
With an http URL configured, useRemoteSystemAgents starts from []. Any failure (offline, non-2xx, invalid JSON) is caught and only console.error'd. The bundled resources/data/agents.json is never read. The Agents page and the Add Assistant popup then show no built-in assistants at all, and the user gets no indication why. The PR body advertises 'Add fallback mechanism for assistant loading', but the only fallback applies to non-http values.
- Sites:
src/renderer/src/pages/agents/index.ts:50-52(cause);src/renderer/src/pages/agents/index.ts:33(other-site);src/renderer/src/pages/agents/AgentsPage.tsx:29-33(symptom);src/renderer/src/components/Popups/AddAssistantPopup.tsx:32-38(symptom) - Evidence: index.ts:33
const [agents, setAgents] = useState<Agent[]>([]);; :45-47if (!response.ok) { throw new Error(...) }; :50-52} catch (error) { console.error("Failed to load agents:", error); }; :58return agents;. There is no call into the local loader or_agentson failure. Compare useLocalSystemAgents at :61-74, which readsresourcesPath + '/data/agents.json'. The PR body says: 'Add fallback mechanism for assistant loading'. - Counts if: To count, a comment must say that when the remote fetch/parse fails, the built-in/bundled assistants are not used as a fallback and the system agent list stays empty. Does NOT count: a generic 'handle errors / show an error toast' comment that does not mention losing the bundled list; payload validation (D4); abort/cleanup requests.
D4 · medium · bug — Remote JSON is cast to Agent[] without runtime validation; a wrongly shaped payload crashes the Agents page and the Add Assistant popup
await response.json() as Agent[] publishes whatever the user-configured URL returns. If it is a JSON object (for example a wrapped {agents:[...]} or an API response), AgentsPage's effect calls groupByCategories(systemAgents), and data.forEach throws. AddAssistantPopup spreads ...systemAgents inside useMemo during render, which throws on a non-iterable. Entries without name, or with a non-array group, throw in agent.name.toLowerCase() or item.group?.forEach. There is no error boundary around these consumers, so the renderer tree crashes. The bad URL is persisted, so the crash repeats every time the Agents page or the popup opens.
- Sites:
src/renderer/src/pages/agents/index.ts:48-49(cause);src/renderer/src/pages/agents/index.ts:77-80(symptom);src/renderer/src/pages/agents/AgentsPage.tsx:32-33(symptom);src/renderer/src/components/Popups/AddAssistantPopup.tsx:37-41(symptom) - Evidence: index.ts:48-49
const agentsData = await response.json() as Agent[]; setAgents(agentsData);. AgentsPage.tsx:33const systemAgentsGroupList = groupByCategories(systemAgents)leads to index.ts:79-80data.forEach((item) => { item.group?.forEach(. AddAssistantPopup.tsx:38const allAgents = [...userAgents, ...systemAgents] as Agent[], and :40agent.name.toLowerCase(). App.tsx has no top-level ErrorBoundary around the routes or TopView. - Counts if: To count, a comment must say that the fetched remote JSON is trusted/cast as Agent[] without checking its shape, and that a non-array or malformed payload breaks the consumers (a crash in groupByCategories/forEach/spread/name access) or should be treated as a load error. Does NOT count: the no-fallback-on-failure point (D3); 'use a stricter type than any' on getAgentsFromSystemAgents (pre-existing).
D5 · low · bug — The new setting's initial value is the raw i18n key 'settings.defaultaides', shown verbatim in the URL input
initialState sets defaultaides: 'settings.defaultaides': a translation key stored as the setting's value and never passed through t(). On a fresh install the Assistant URL input binds directly to it and displays the literal 'settings.defaultaides'. The 'Built-in' strings added to the locales are never rendered. The value means 'use built-in' only by accident, because it does not start with 'http'.
- Sites:
src/renderer/src/store/settings.ts:209-210(cause);src/renderer/src/pages/settings/DataSettings/DefaultaidesSettings.tsx:16-37(symptom) - Evidence: settings.ts:210
defaultaides: 'settings.defaultaides', // 默认智能体. DefaultaidesSettings.tsx:16const Aides = useSelector((state: RootState) => state.settings.defaultaides)and :33value={Aides || ''}, with no t(). index.ts:25if (!defaultaides.startsWith('http')) { return useLocalSystemAgents(); }. - Counts if: To count, a comment must say that the default/initial value is an i18n key (or an internal-looking literal) instead of an empty/null/real value, and that it is shown to users in the input or only works because it is not http. Does NOT count: comments about the missing
settings.data.default_aidestranslations (D2); a pure naming/casing remark on the field.
D6 · low · maintainability — useSystemAgents reads the source setting via store.getState() during render: consumers never subscribe to changes
The source selection reads store.getState().settings.defaultaides instead of subscribing via useSelector/useAppSelector. A change to the setting therefore never re-renders the hook's consumers, and a mounted consumer keeps the old source until something unrelated re-renders it. This is latent today, because the two current consumers remount after a settings visit. It bypasses react-redux and is exactly what makes the conditional hook dispatch (D1) look safe.
- Sites:
src/renderer/src/pages/agents/index.ts:20(cause);src/renderer/src/pages/agents/index.ts:34-35(other-site) - Evidence: index.ts:20
const { defaultaides } = store.getState().settingsand :34 the same again inside useRemoteSystemAgents. The writer is DefaultaidesSettings.tsx:18-19dispatch(setefaultAides(e.target.value)). Consumers are AgentsPage.tsx:29 and AddAssistantPopup.tsx:32. App.tsx routes have no keep-alive, so AgentsPage remounts on navigation, which keeps this latent today. - Counts if: To count, a comment must say that store.getState() is a non-reactive snapshot, so consumers do not update/re-fetch when the URL setting changes, and should use useSelector/useAppSelector. Does NOT count: a comment that only flags the conditional hook calls or hook order (that is D1). A comment that makes both points counts for both.
- Bot-derived reference (not scored): ref 6 is a reworded Sourcery comment from the original PR (). The defect was checked against the code and found by the blind hunt.
D7 · low · performance — Remote agents are fetched on every mount after a hard-coded 500 ms sleep and are never cached
Unlike the local path, which caches in the module-level _agents, useRemoteSystemAgents starts from [], sleeps 500 ms for no reason, and re-fetches the URL every time AgentsPage mounts or the Add Assistant popup opens. Each open costs at least 500 ms plus a network round-trip, during which the list holds only user agents and then jumps.
- Sites:
src/renderer/src/pages/agents/index.ts:41-56(cause) - Evidence: index.ts:33
useState<Agent[]>([]); :43await new Promise(resolve => setTimeout(resolve, 500));; :44await fetch(resourcesPath). Nothing writes_agents. Compare :67if (!resourcesPath || _agents.length > 0) returnin the local hook. - Counts if: To count, a comment must say that the artificial 500 ms delay slows every load, or that the remote list is refetched on every mount with no caching (unlike the local
_agentscache). Does NOT count: a comment that only asks for an AbortController/cleanup or warns about setState after unmount (in React 19 that is a no-op).
D8 · low · compat — No redux-persist migration for the new settings field: upgraded installs get undefined and log console.error on every render
The store persists settings with redux-persist's default level-1 merge, so a rehydrated settings object replaces initialState.settings. The repo adds each new settings field through a numbered migration in migrate.ts plus a version bump. This PR adds neither, so every existing install has defaultaides === undefined, outside its declared string | null type. useSystemAgents then logs console.error('defaultaides is null or undefined') on every render of AgentsPage and AddAssistantPopup, and existing users get a different default from new users ('' vs 'settings.defaultaides').
- Sites:
src/renderer/src/store/index.ts:41-50(cause);src/renderer/src/store/migrate.ts:1232-1242(other-site);src/renderer/src/pages/agents/index.ts:21-23(symptom) - Evidence: store/index.ts:41-47
persistReducer({ key: 'cherry-studio', storage, version: 96, blacklist: ['runtime', 'messages'], migrate }, rootReducer)has no stateReconciler, so it uses the default autoMergeLevel1. migrate.ts has no entry settingstate.settings.defaultaides; repo convention is shown by e.g. '94':state.settings.enableQuickPanelTriggers = false. index.ts:21-22if (defaultaides === null || defaultaides === undefined) { console.error('defaultaides is null or undefined');. - Counts if: To count, a comment must say that there is no migration/persist version bump for
defaultaides, so existing users' persisted settings lack it (undefined), with any consequence such as the error log or an inconsistent default. Does NOT count: the raw-i18n-key default value (D5); the duplicated null check (ref 7).
D9 · low · maintainability — The exported Redux action is misspelled setefaultAides
The new reducer and exported action creator are named setefaultAides, missing the 'D' of Default. It becomes part of the settings slice's public API. Anyone searching for or importing setDefaultAides will not find it, and renaming it after merge means churn across consumers.
- Sites:
src/renderer/src/store/settings.ts:459-461(cause);src/renderer/src/store/settings.ts:576(other-site);src/renderer/src/pages/settings/DataSettings/DefaultaidesSettings.tsx:4(other-site) - Evidence: settings.ts:459
setefaultAides: (state, action: PayloadAction<string>) => {; :576setefaultAides,in the export list; DefaultaidesSettings.tsx:4import { setefaultAides } from '@renderer/store/settings'. - Counts if: To count, a comment must point out the
setefaultAidestypo (missing D) in the action/reducer name. Does NOT count: casing preferences fordefaultaides/DefaultaidesSettings(taste, excluded). - Bot-derived reference (not scored): ref 17 is a reworded Sourcery comment from the original PR (). The defect was checked against the code.
Checked and rejected (14)
- ref 3 — Backwards. zh-cn.json is the only locale that matches the keys the code uses (
settings.data.default_aides.*). Renaming it to 'defaultaides' as proposed would break zh-CN too. The claim that the code uses 'defaultaides' is false. - ref 5 —
getAgentsFromSystemAgents(systemAgents: any)is pre-existing code the PR does not touch, and the advice is generic typing. The repo also turns off @typescript-eslint/no-explicit-any. - ref 7 — Suggests extracting the small duplicated null guard into a helper, which is taste. The only concrete problem in that block is that useEffect is called after its early return, which is D1, and this ref does not identify it.
- ref 8 — The repo is on React 19, which removed the setState-on-unmounted warning, so the stated consequence does not exist. A URL change while mounted is not reachable (consumers remount). A missing abort is at most a nit.
- ref 9 — Identifier casing ('DefaultaidesSettings' vs 'DefaultAidesSettings') is naming taste with no behavioural impact.
- ref 10 — The inner
AidesIconfollows the file's existing JoplinIcon/SiyuanIcon pattern. The repo explicitly disables '@eslint-react/no-nested-component-definitions', and a static 16px SVG costs nothing measurable. - ref 11 — False premise. Underscore keys are already the norm in this menu (export_menu, markdown_export, divider_0), and 'default_aides' matches the i18n namespace.
- ref 13 —
React.ChangeEventin a type position resolves through @types/react's UMD global namespace. The repo does this widely without importing React, so there is no TS error. - ref 14 — Blank-line formatting only.
- ref 15 — Field-name casing (
defaultaidesvsdefaultAides) is naming taste. - R19 — Request to add tests. Not a defect.
- R28 — Same as ref 10: the inner icon component follows the existing pattern, and the rule is disabled in eslint.config.mjs.
- R34 — Inline static style width is a style nit and matches sibling settings panels.
- R20 (abort/stale-result half) — The 500 ms delay part of R20 is credited to D7. Its abort/stale-request half has no reachable consequence: a URL change while mounted does not happen in the current UI, and React 19 ignores setState after unmount.
bluewave-labs__Checkmate@29e03a6
Adds a GitHub Actions workflow (.github/workflows/poeditor-sync.yml) that runs by hand or nightly, a Node script (.github/scripts/download-translations.js) and a README. For each requested language the script exports translations from POEditor (key_value_json by default, or json, which it converts from an array into a flat map) and writes temp/.json. The workflow checks each file is non-empty, valid JSON, copies it over src/locales/, commits, and pushes with GITHUB_TOKEN to the checked-out branch. The app (src/Utils/i18n.js) globs src/locales/*.json into i18next resources. It uses "gb" as the primary and fallback language, and every locale file becomes an entry in the LanguageSelector.
D1 · medium · bug — Manual and scheduled runs use different English codes (en vs gb); one default path writes a stray en.json and leaves gb.json stale, the other asks POEditor for 'gb'
The workflow_dispatch input defaults to "tr,en", but the env fallback that applies on the nightly schedule is 'tr,gb'. The script's own default is 'tr,en' and the README says the default is tr and gb. The script writes temp/.json verbatim and the workflow copies it into src/locales, while the app is keyed on "gb" (primaryLanguage and fallbackLng). So a default manual run adds a new en.json, which becomes an extra "EN" language in the selector with no flag, and never refreshes gb.json. The nightly run instead requests 'gb'. Whichever code the POEditor project uses, one of the two default triggers is wrong: it either syncs the wrong English file or fails the export and exits 1.
- Sites:
.github/workflows/poeditor-sync.yml:7-10 (cause); .github/workflows/poeditor-sync.yml:60 (other-site); .github/scripts/download-translations.js:12 (other-site); .github/workflows/README.md:25 (other-site); .github/scripts/download-translations.js:64-65 (symptom)
- Evidence: poeditor-sync.yml:10
default: "tr,en" vs :60 LANGUAGES: ${{ github.event.inputs.languages || 'tr,gb' }}. The fallback applies only when the input is empty, which is always the case on schedule. download-translations.js:12 (process.env.LANGUAGES || 'tr,en').split(','); :64 path.join(process.cwd(), 'temp', ${language}.json); workflow:83 cp -r temp/* src/locales/. README.md:25 says "the default languages tr and gb", and the PR body says "tr and en". App side: src/Utils/i18n.js:6 const primaryLanguage = "gb";, :8 import.meta.glob("../locales/*.json"), :24 fallbackLng: primaryLanguage. src/Components/LanguageSelector.jsx Object.keys(i18n.options.resources) and fi fi-${lang}. Existing locale files are gb.json and tr.json. Script:37-39 throws, and it exits 1 at :72-73, on a non-success export.
- Counts if: To count, a comment must point out the en-vs-gb language-code mismatch between any two of: the manual input default (tr,en), the scheduled fallback (tr,gb), the script default (tr,en) and the README (tr,gb). Stronger hits add the consequence: the app uses gb.json, so the manual default writes en.json and leaves gb stale, or the nightly run requests an unsupported code. A comment that only says the README contradicts the manual default counts, because it is the same inconsistency. Near-misses that do not count: generic advice to validate language input, or the whitespace-trimming issue (D5).
- Bot-derived reference (not scored): refs 6 and 7 are reworded CodeRabbit comments from the original PR (). The defect was checked against the code and found by the blind hunt.
D2 · medium · bug — key_value_json export is written unfiltered, so untranslated terms land in tr.json as "" and render blank instead of falling back to gb
The default key_value_json path saves POEditor's export exactly as received. The export request passes no filters or fallback_language, and POEditor includes untranslated terms with empty-string values. Today tr.json holds only the translated subset (105 lines vs 178 in gb.json), so missing Turkish keys fall back to gb. After a sync those keys become "", and i18next (24.x, returnEmptyString left at its default of true) treats an empty string as a valid translation, so Turkish users see blank labels. The array path does drop empty definitions; the default path does not.
- Sites:
.github/scripts/download-translations.js:30-35 (cause); .github/scripts/download-translations.js:49-65 (symptom)
- Evidence: The export body is only
{api_token, id, language, type} (script:29-35): no filters: 'translated' and no fallback_language. Script:50 let formattedTranslations = translations;. Only the Array.isArray branch (:53-60) filters, via if (item.term && item.definition), and :65 writes the object unchanged. src/Utils/i18n.js init sets no returnEmptyString: false; package-lock pins i18next 24.2.2. src/locales/tr.json is 105 lines vs gb.json's 178 (tr lacks the notifications block and the #1889 auth strings). A default manual run (tr,en) exports tr successfully and pushes it.
- Counts if: To count, a comment must say that untranslated terms come back from POEditor as empty strings, are written into the locale file, and show blank text instead of falling back to gb/English. Acceptable fixes it might propose: filter empty values, or use filters=translated or fallback_language. A near-miss that does not count is R3, which argues the opposite: keep empty definitions in the array path. Generic 'validate the export' comments do not count either.
D3 · low · data — One-way download sync overwrites locale files wholesale, deleting keys developers add in the repo before they reach POEditor
The workflow only downloads. It replaces src/locales/.json with POEditor's export (cp temp/* src/locales/) and pushes the result straight to the branch. The script does no merge with the existing file and no upload. Developers in this repo add strings by editing gb.json and tr.json directly in PRs, so every sync deletes any key not yet entered in POEditor and pushes that deletion. The affected components then show raw keys, and for gb, the fallback language, there is no fallback left.
- Sites:
.github/workflows/poeditor-sync.yml:80-92 (cause); .github/scripts/download-translations.js:63-65 (other-site)
- Evidence: poeditor-sync.yml:83
cp -r temp/* src/locales/, :90-92 git add src/locales/*.json / git commit / git push. script:65 fs.writeJson(outputPath, formattedTranslations, ...) writes only what POEditor returned. History at the merge base shows direct locale edits: d40507e (+30 gb.json), 93462d7 (+34 gb.json), a72d002 (gb.json + tr.json). i18n.js:24 fallbackLng: primaryLanguage ("gb").
- Counts if: To count, a comment must say the sync replaces the repo's locale files with the POEditor export, with no merge and no upload of repo-side terms, so keys added directly in the repo are lost or reverted on the next run. Near-misses that do not count: the 'empty {} export' comments (R13-R16), which are about an empty export rather than repo-side keys being overwritten, and formatting or ordering churn.
D4 · low · build — Workflow pushes with GITHUB_TOKEN but requests no contents: write permission
The Commit step runs git push with the checkout's GITHUB_TOKEN, but the workflow and job declare no permissions: block. On a repo or org whose default workflow token is read-only (GitHub's default for newer orgs and repos), the job downloads and commits and then fails on the push with a 403. Translations are never published.
- Sites:
.github/workflows/poeditor-sync.yml:20-28 (cause); .github/workflows/poeditor-sync.yml:86-92 (symptom)
- Evidence: poeditor-sync.yml has no
permissions: key anywhere. Line 28 is token: ${{ secrets.GITHUB_TOKEN }} and line 92 is git push. There are no other workflows in the repo at the merge base, so nothing shows the repo's default token setting.
- Counts if: To count, a comment must say the workflow needs
permissions: contents: write, or equivalent, for the push, because the default GITHUB_TOKEN may be read-only. Near-misses that do not count: comments about which branch is pushed to (R19-R22), and token-exposure or supply-chain comments (R11).
D5 · low · bug — LANGUAGES is split on ',' without trimming or dropping empties, so 'tr, en' or a trailing comma requests ' en' or ''
The workflow_dispatch languages input is free text, and the script only splits it on ','. An operator who types 'tr, en' or leaves a trailing comma sends ' en' or '' as the POEditor language. That either fails the whole run (exit 1 after the first bad export) or writes an oddly named temp/' en'.json, which is copied into src/locales and loaded by the i18n glob as a new language.
- Sites:
.github/scripts/download-translations.js:12 (cause); .github/workflows/poeditor-sync.yml:7-10 (other-site)
- Evidence: script:12
const LANGUAGES = (process.env.LANGUAGES || 'tr,en').split(','); with no .map(s => s.trim()).filter(Boolean). The values are used verbatim at :38 language: language and :64 `${language}.json`. The input at workflow:7-10 is free text described as 'comma separated'.
- Counts if: To count, a comment must say the language list is not trimmed or filtered, so spaces or empty entries produce invalid or oddly named language codes. Near-misses that do not count: the en/gb default mismatch (D1) and generic 'validate env vars' comments (dataset ref 1).
D6 · low · bug — json (array) export conversion keys on item.term only, ignoring context, so nested keys collapse and collide
The workflow offers format=json as a supported input. For the array that export returns, the script builds a flat map keyed only by item.term and ignores item.context. POEditor stores the repo's nested keys (notifications.slack.label, notifications.discord.label, ...) as a term plus a parent-path context. Terms like label, description, webhookLabel and webhookPlaceholder therefore overwrite each other, and the nesting that t('notifications.slack.label') needs is lost. That breaks the notification-modal strings for any locale synced with format=json.
- Sites:
.github/scripts/download-translations.js:53-60 (cause); .github/workflows/poeditor-sync.yml:11-14 (other-site)
- Evidence: script:56-58
translations.forEach(item => { if (item.term && item.definition) { formattedTranslations[item.term] = item.definition; } }), which never reads context. workflow:12 description: "Export format (key_value_json or json)". src/locales/gb.json nests "notifications": { "slack": { "label" ... }, "discord": { "label" ... } }, and NotificationIntegrationModal.jsx:33 calls t('notifications.slack.label').
- Counts if: To count, a comment must say the array/json conversion drops context or nesting, so nested keys are flattened or terms collide and the locale no longer matches the nested lookups. A near-miss that does not count is R2, which only asks whether definitions can be objects (plurals). Comments about dropping empty definitions (R3) do not count either.
Checked and rejected (17)
- ref 0 — Wrong. Network and HTTP errors are already caught and logged, and the script exits 1 (script:71-73, 91-93). A global axios interceptor adds nothing to a 90-line CI script.
- ref 1 — Nit. With unset secrets POEditor returns a non-success status, and the script throws with the response body and exits 1, so the run already fails loudly. A pre-check would only improve the message.
- ref 4 — Already handled. An unexpected response shape throws a TypeError inside the try block, which is caught at :71-73 and exits 1. Optional chaining would only change the error text.
- ref 5 — Formatting nit (missing trailing newline).
- ref 8 — Factually wrong: jq is preinstalled on GitHub's ubuntu-latest runner images.
- R1 — Nit: an unused
__filename variable and import, with negligible future cost.
- R2 — Speculative. For non-plural terms POEditor's json export has string definitions, and the repo has no plural terms. It also does not identify the context/nesting loss that is the real problem in D6.
- R3 — Wrong direction. Dropping empty definitions lets i18next fall back to gb. Keeping them would render blank strings (the D2 problem), so the suggestion is harmful.
- R4 — No real leak. The token appears verbatim, since POEditor tokens are hex and URL encoding leaves them unchanged, and GitHub masks registered secrets in logs. POEditor API failures come back as status 'fail' in the body, and that path logs only response data.
- R10 — Hardening or reproducibility preference, not a concrete defect: caret-ranged axios/fs-extra with no lockfile, and no stated breakage.
- R11 — Speculative supply-chain hardening: a compromised dependency lifecycle script. No concrete reachable path in this PR.
- R13, R14, R15, R16 — Speculative. This needs POEditor to return an empty map ({}) for a language with existing translations, which is not realistic: key_value_json includes all terms, and an empty array export only happens for a language with no translations at all.
- R19, R20, R21, R22 — Not a defect. A manual dispatch runs on the branch the operator picks, and pushing back to that branch is normal GitHub Actions behaviour. The README's 'main branch' wording is a doc inaccuracy with no concrete harm.
- **judge candidate: Manual runs on another branch leave the intended branch unsynchronized A successful manual run selected on a non-main branch will push the translations to that ** — This was already excluded as R19-R22. poeditor-sync.yml:25-28
uses: actions/checkout@v3 with: token: ... checks out the ref the run was triggered on, and :92 runs a bare git push. So a manual dispatch pushes back to the branch the operator picked in the Actions UI. That is normal, operator-chosen GitHub Actions behaviour, and nothing breaks. The schedule trigger (:17-18) always runs on the default branch. The only thing that differs is prose: README/PR body item 3 says "pushed to the main branch" (the base_ref is develop). That is a doc inaccuracy with no concrete consequence, and the exclusion rationale still holds.
- judge candidate: Reject exports that would erase a populated locale An export of
{} passes both the nonempty-file check and jq validation, then replaces an existing locale f — This was already excluded as R13-R16. It is true that poeditor-sync.yml:71 [ ! -s "$file" ] and :76 jq . accept a file containing {}, and that :83 cp -r temp/* src/locales/ would copy it. But the default key_value_json path writes POEditor's map as received (download-translations.js:50,65), and that map contains every project term (the D2 premise), so it is {} only for a project with no terms. On the json path (:53-60), {} requires that no term have a non-empty definition, which means a language with zero translations in POEditor. N8's array-conversion variant is exactly that case. A realistic version of 'the repo locale is replaced by what POEditor has' is D3's one-way overwrite, not an empty-map scenario. The exclusion rationale stands.
- judge candidate: Keep the publishing credential away from dependency installation Checkout persists its token before
npm install, which can run package lifecycle scripts. Once — This was already excluded as R11. checkout@v3 persists GITHUB_TOKEN (:25-28) before npm install of two pinned-by-caret, well-known packages, axios and fs-extra (:44-47, :54). Exploiting it requires a compromised axios or fs-extra release that runs a malicious lifecycle script. That is generic supply-chain hardening advice with no concrete reachable path this PR creates. The job also declares no permissions: block (D4), so it is not even established that the token is write-scoped.
- judge candidate: Avoid logging a credential-bearing request error The export request includes
POEDITOR_API_TOKEN in its POST body, and this catch logs the complete Axios error — This was already excluded as R4. download-translations.js:72 console.error('...', error) would print an AxiosError's config, including the urlencoded body api_token=... from :29-34, only when axios itself throws (network error or non-2xx). POEditor reports API failures as HTTP 200 with response.status: 'fail', which goes to the :37-38 throw and logs only exportResponse.data. Even on the axios-throw path, a POEditor API token is a hex string that URL encoding leaves unchanged, so the value appears verbatim and GitHub's registered-secret masking redacts it (POEDITOR_API_TOKEN comes from secrets. at workflow:58). The comment's own premise, an "encoded token that masking does not catch", does not hold.
mudler__LocalAI@e466450
The PR adds two double timing fields in milliseconds, timing_prompt_processing and timing_token_generation, to the gRPC Reply proto. The llama.cpp grpc-server fills them from llama.cpp's final-response timings object (prompt_ms / predicted_ms), and they flow through backend.TokenUsage and ComputeChoices into schema.OpenAIUsage as omitempty JSON fields. Chat, completion and edit copy them into the response only when the request carries a LocalAI-Extra-Usage header. The PR also adds a LOCALAI_MACHINE_TAG run option. When the option is unset, WithMachineTag falls back to os.Hostname(). About 30 individual HTTP handlers send the tag back in a LocalAI-Machine-Tag response header, each with its own hand-written c.Set line. ListModelsEndpoint gains an appConfig parameter for this. While refactoring the non-streaming /v1/completions loop, the PR replaced the prompt/completion token accumulation with timing accumulation, so every non-streaming completion now reports zero token usage.
D1 · high · bug — Non-streaming /v1/completions now always reports 0 prompt/completion/total tokens
In CompletionEndpoint's non-streaming loop, the PR deleted totalTokenUsage.Prompt += tokenUsage.Prompt and totalTokenUsage.Completion += tokenUsage.Completion and put the two timing accumulations in their place. totalTokenUsage's token fields therefore stay at their zero value, and the response's usage.prompt_tokens, completion_tokens and total_tokens are always 0. This happens on every non-streaming completion, whether or not the LocalAI-Extra-Usage header is sent, and breaks token accounting for OpenAI-compatible clients.
- Sites:
core/http/endpoints/openai/completion.go:183-184 (cause); core/http/endpoints/openai/completion.go:188-192 (symptom); core/http/endpoints/openai/completion.go:163 (other-site)
- Evidence: Merge base completion.go (non-streaming loop) had
totalTokenUsage.Prompt += tokenUsage.Prompt / totalTokenUsage.Completion += tokenUsage.Completion. At head, lines 183-184 are only totalTokenUsage.TimingTokenGeneration += tokenUsage.TimingTokenGeneration / totalTokenUsage.TimingPromptProcessing += tokenUsage.TimingPromptProcessing. totalTokenUsage is backend.TokenUsage{} (line 163) and nothing else writes Prompt/Completion. Lines 188-192 then build usage := schema.OpenAIUsage{PromptTokens: totalTokenUsage.Prompt, CompletionTokens: totalTokenUsage.Completion, TotalTokens: totalTokenUsage.Prompt + totalTokenUsage.Completion}. ComputeChoices (inference.go:53-56) does return populated counts, so they are simply dropped. edit.go:66-70 in the same PR keeps both accumulations and adds the timing lines, which shows the intended pattern. Reached by POST /v1/completions, /completions or /v1/engines/:model/completions with stream=false (routes/openai.go:85-110).
- Counts if: To count, a comment must say that the non-streaming completion path no longer accumulates Prompt/Completion token counts, because the timing lines replaced them, so the reported prompt_tokens/completion_tokens/total_tokens are 0 (or wrong). Pointing at completion.go ~183-184 or the usage block at 188-192 with that mechanism is sufficient. Near-misses that do NOT count: a generic 'add tests for token counts' (R13 mentions the regression only as a reason to add tests and does not identify it on its own); comments about the streaming completion path; comments that only say the timings are summed across prompts.
D2 · low · security — Machine tag defaults to the server hostname and is sent to every client on most endpoints
WithMachineTag falls back to os.Hostname() whenever LOCALAI_MACHINE_TAG is unset, and the CLI always applies it. About 30 handlers then emit it unconditionally as the LocalAI-Machine-Tag response header. As a result, every LocalAI deployment, not only P2P users who opt in, discloses its internal hostname to any API client, including unauthenticated ones under the default no-API-key configuration. The header should be opt-in: sent only when a tag is explicitly configured.
- Sites:
core/config/application_config.go:100-108 (cause); core/cli/run.go:111 (other-site); core/http/endpoints/openai/chat.go:174 (symptom); core/http/endpoints/openai/files.go:125 (symptom)
- Evidence: application_config.go:100-107:
func WithMachineTag(tag string) AppOption { return func(o *ApplicationConfig) { if tag == "" { hostname, _ := os.Hostname(); tag = hostname }; o.MachineTag = tag } }. run.go:111 always calls config.WithMachineTag(r.MachineTag). Handlers such as chat.go:174 c.Set("LocalAI-Machine-Tag", startupOptions.MachineTag), completion.go:66, list.go:17 and files.go:26/86/125/148/186 set the header with no condition. GET /v1/models (list.go:17) is therefore enough for any client that can reach the port to learn the host's hostname.
- Counts if: To count, a comment must say that the hostname (os.Hostname default) is exposed to clients by default or unconditionally in a response header, as information disclosure, and/or that the machine-tag header should be opt-in or omitted when no tag is configured. Near-misses that do NOT count: 'the os.Hostname error is ignored' (ref 7); 'skip the header when MachineTag is empty', which is about empty values, not disclosure; a nil-appConfig guard; claims that the header should go on outbound backend requests.
D3 · low · maintainability — Machine-tag header set by hand in each handler instead of a middleware; coverage already inconsistent
Instead of one middleware, the LocalAI-Machine-Tag response header is set by a hand-copied c.Set(...) line at the top of about 30 individual handlers. Coverage is already inconsistent. The ElevenLabs text-to-speech and sound-generation inference endpoints, /v1/tokenize, /stores/*, the gallery, backend-monitor, /system and /version routes never send it, while ChatEndpoint sets it twice. Clients that use the tag to identify which P2P machine served a request get no tag from those routes. Every future endpoint must also remember the line or silently lose the tag.
- Sites:
core/http/endpoints/openai/assistant.go:79 (cause); core/http/endpoints/openai/files.go:86 (other-site); core/http/endpoints/openai/list.go:17 (other-site); core/http/endpoints/openai/chat.go:174 (other-site); core/http/endpoints/openai/chat.go:330 (other-site); core/http/routes/elevenlabs.go:16-18 (symptom); core/http/routes/localai.go:36-44 (symptom); core/http/routes/localai.go:70 (symptom)
- Evidence:
git grep LocalAI-Machine-Tag at head matches assistant.go (9 times: 79, 141, 251, 284, 314, 361, 419, 459, 514), files.go (5 times), chat.go (twice: 174 and 330), and rerank.go, localai/tts.go, vad.go, completion.go, edit.go, embeddings.go, image.go, list.go and transcription.go (once each). It has no match in core/http/endpoints/elevenlabs/* or in the tokenize/stores handlers. Those are registered at routes/elevenlabs.go:16 (/v1/text-to-speech/:voice-id) and :18 (/v1/sound-generation), and at routes/localai.go:41-44 (/stores/*) and :70 (/v1/tokenize). core/http/app.go:138-168 registers no shared middleware for the header.
- Counts if: To count, a comment must say one of two things. Either: the header is duplicated per handler and belongs in one shared middleware or route scope, with the drift risk. Or: specific routes (ElevenLabs TTS/sound-generation, tokenize, stores, etc.) are missing the machine-tag header, so coverage is inconsistent. Either half counts. Near-misses that do NOT count: a comment only about the redundant second
c.Set at chat.go:330 (ref 10 / R17), since that is an idempotent nit; CORS ExposeHeaders comments; nil-appConfig comments.
D4 · low · maintainability — New --machine-tag CLI flag ships with placeholder help text 'TODO: write a help string'
The new MachineTag option on RunCMD has the literal help text "TODO: write a help string" and no group: tag. local-ai run --help therefore shows a placeholder to operators, and the flag's purpose is undocumented. Unlike its neighbours, it also lacks the un-prefixed env alias, a MACHINE_TAG alongside LOCALAI_MACHINE_TAG.
- Sites:
core/cli/run.go:74 (cause)
- Evidence: run.go:74:
MachineTag string env:"LOCALAI_MACHINE_TAG" help:"TODO: write a help string". Neighbouring flags, e.g. run.go:73 `LoadToMemory []string `env:"LOCALAI_LOAD_TO_MEMORY,LOAD_TO_MEMORY" help:"A list of models to load into memory at startup" group:"models", all carry a real help string, a group and an alias.
- Counts if: To count, a comment must point out that the new MachineTag flag's help string is a TODO placeholder (user-visible in --help) or that it is otherwise undocumented or unfinished. A comment only about the missing group or env alias, without the placeholder, is a weak match. Near-misses: general 'document the timing units' comments (ref 0 / R1-R3), which are about the proto fields, not this flag.
Checked and rejected (20)
- ref 0 — Doc nit: asks for a unit comment on the proto fields. The values are milliseconds straight from llama.cpp prompt_ms/predicted_ms; nothing breaks.
- R1, R2, R3 — Same as ref 0: requests to document or rename the timing fields with their unit. This is a naming/doc request, not a defect.
- ref 1 — Style: suggests a helper for the 6-line timings block duplicated in PredictStream and Predict. The surrounding token extraction is duplicated the same way already, and there is no concrete future cost.
- ref 2, ref 4 — Negligible micro-optimisation: two
at("timings") lookups on a small per-reply JSON object.
- ref 3, ref 5 — Unreachable.
timings is only ever written as {"timings", slot.get_formated_timings()} in send_final_response (grpc-server.cpp:1291), and get_formated_timings() (305-317) always returns a JSON object, so .at("timings").value(...) cannot throw on null or non-object.
- ref 7 — Trivial:
hostname, _ := os.Hostname() ignores an error that essentially never occurs, and the only effect is an empty tag. The real hostname concern is disclosure (D2), not error handling.
- ref 8, ref 9, ref 14, ref 18, ref 19 — Unfounded nil-appConfig panic. Every route wires application.ApplicationConfig() or the non-nil appConfig (routes/openai.go:133-134, routes/localai.go:36-37), and the same handlers already dereference appConfig unguarded (e.g. rerank.go appConfig.ModelPath, transcription.go/embeddings.go readRequest with appConfig.Debug).
- ref 10, R17 — Nit: the second
c.Set("LocalAI-Machine-Tag", ...) at chat.go:330 is redundant but idempotent, with no behavioural effect. The underlying per-handler duplication is covered by D3.
- ref 11, ref 13 — Design choice, not a defect.
c.Get("LocalAI-Extra-Usage", "") != "" is a presence-based opt-in flag (the same semantics upstream kept). The only effect of sending 'false' is two extra omitempty, non-standard usage fields that OpenAI clients ignore, and no client contract depends on parsing the value.
- ref 17 — Wrong premise: the header is intentionally a response header telling the client which machine served it, per the PR body. It is not meant for outbound backend requests, and MachineTag defaults to the hostname so it is effectively never empty.
- ref 20 — Cosmetic typo ('is't') in a comment at core/schema/openai.go:26.
- R8, R12, R14, R15, R16 — CORS concerns are speculative or wrong. With AllowHeaders empty, Fiber v2.52.5's cors middleware reflects Access-Control-Request-Headers, so a preflight with LocalAI-Extra-Usage is allowed. The missing ExposeHeaders affects only browser JS reading an operational P2P header, which is not the feature's use case, and is identical to the pre-existing X-Correlation-ID header. This is an enhancement, not a defect this PR introduces.
- R9, R10 — Refactor suggestion. The OpenAIUsage literal was already built separately at each response site before the PR, which only adds two conditional lines per site. There is no concrete drift defect.
- R11, R18, R19, R20 — Pre-existing. At the merge base, the tool-call (default) branch of processTools already emitted chunks with no Usage at all (token counts included), and the stream writer copied the last chunk's zero usage. The PR does not touch that branch, and timings merely inherit the existing gap.
- R21 — Pre-existing and out of scope: handleQuestion's fallback ModelInference (chat.go:545-556) was never counted in usage, token counts included, before the PR. Not introduced or exposed here.
- R13, R28 — Test requests ('add endpoint tests'). R13 mentions the completion regression only as a reason to add tests, so the defect itself is D1.
- judge candidate: Include opted-in timings in streaming tool-call responses? When
processTools selects a tool call, its emitted chunks carry zero usage even though inference pr — Already excluded as R11/R18/R19/R20 (pre-existing). This is the same gap: at head, the tool-call default: branch of processTools (chat.go:120-167) sends initialMessage and the arguments chunk with no Usage field. The stream writer (chat.go:345-383) does usage = &ev.Usage and puts Usage: *usage on the finish chunk. The diff shows the PR left that branch alone and changed only the no-action branch (adding the usage literal at lines 99-107) and the process callback. At the merge base the tool-call branch already dropped all usage, prompt/completion token counts included, so the missing timings come from a gap that was already there. The PR did not introduce or newly expose it.
- judge candidate: Expose the machine tag to cross-origin clients When CORS is enabled,
core/http/app.go:138-146 does not configure ExposeHeaders; browsers cannot read this no — Already excluded as R8/R12/R14/R15/R16 (CORS). The PR does not touch app.go:138-146 (cors.New() / cors.New(cors.Config{AllowOrigins: ...})). With AllowHeaders empty, Fiber's cors middleware reflects Access-Control-Request-Headers, so a preflight carrying LocalAI-Extra-Usage passes. The missing ExposeHeaders only stops browser JS from reading an operational P2P response header. The pre-existing X-Correlation-ID header (chat.go:184) has the same limitation. This is an enhancement request, not a defect the PR introduces.
- judge candidate: Account for a second inference in chat timings When
handleQuestion gets a no-action response without a usable message, it performs another ModelInference at — Already excluded as R21 (pre-existing, out of scope). handleQuestion's fallback ModelInference (chat.go ~545-556) was never counted in usage, and before the PR the reported token counts left it out too. The PR only copies the first ComputeChoices tokenUsage into the new timing fields (chat.go:99-107, 469-477), the same way the existing token counts are taken, so it neither introduces nor newly exposes this gap.
- judge candidate: Clarify the timing units in the public field names The new protobuf fields and JSON fields omit units, although the llama backend fills them from
prompt_ms an — Already excluded as ref 0 and R1-R3: a request to put units in the names or docs. The fields at backend.proto:162-163 and core/schema/openai.go:27-28 carry llama.cpp's prompt_ms/predicted_ms unchanged, the PR body says the timings are 'in ms', and nothing breaks. This is a naming/doc nit, not a defect.
alibaba__spring-ai-alibaba@4bc7305
Hotfix to spring-ai-alibaba-jmanus with five changes. (1) The module version goes from 0.1.0 to 0.1.1. (2) Agent save is fixed by giving the deprecated DynamicAgentEntity.systemPrompt a " " default, dropping nullable=false, and having AgentServiceImpl.mergePrompts write " " instead of null. That avoids the NPE and the NOT NULL violation on create, scan and update, but the inverted != null || !trim().isEmpty() guard is left in place. (3) InputTextAction now uses Locator.fill("") + pressSequentially(delay 100). If that fails it falls back to fill(text), then to a raw JS el.value = ...; dispatchEvent('input'), and reports success in every case. (4) MoveToAndClickAction now does window.scrollTo(x - vw/2, y - vh/2) before mouse.click(x, y). In debug mode it also injects and removes a red marker dot. (5) NavigateAction adds "https://" to any URL that does not start with lowercase http:// or https://.
D1 · high · bug — move_to_and_click scrolls the page, then clicks the unadjusted (x,y), so it hits the wrong element
The action now calls window.scrollTo(x - viewportWidth/2, y - viewportHeight/2) and then still clicks at the original (x, y). Playwright's mouse.click uses viewport coordinates, and callers get (x, y) from get_element_position, which is Locator.boundingBox() and so also viewport-relative. Whenever the scroll moves the page, the click lands on different content. That covers any target right of or below the viewport centre on a scrollable page. It also covers any page that was already scrolled, because scrollTo is absolute and snaps it back. The merge base clicked (x, y) without scrolling, which was correct for this flow.
- Sites:
spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/MoveToAndClickAction.java:48-52 (cause); spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/MoveToAndClickAction.java:68-70 (symptom); spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/GetElementPositionByNameAction.java:122-131 (other-site)
- Evidence: MoveToAndClickAction.java:49-52
int scrollX = Math.max(0, x - page.viewportSize().width / 2); int scrollY = Math.max(0, y - page.viewportSize().height / 2); page.evaluate("(args) => window.scrollTo({left: args[0], top: args[1], behavior: 'instant'})", new Object[] { scrollX, scrollY }); then :69-70 page.mouse().move(x, y); page.mouse().click(x, y);, and no scroll offset is subtracted. The coordinates come from GetElementPositionByNameAction.java:124-131 box = nthLocator.boundingBox(); int x = (int) (box.x + box.width / 2); int y = (int) (box.y + box.height / 2);. That value is viewport-relative, and the action's own highlight uses position = 'fixed', which confirms it. Example 1: default 1280x720 viewport, page at scroll 0, target at (1000,600). The code scrolls to (360,240), so the target moves to viewport (640,360), and the click at (1000,600) hits something else. Example 2: the agent has scrolled down 1000px and the target is at (500,300). scrollTo(0,0) jumps back to the top of the page, and the click at (500,300) hits top-of-page content. Path: BrowserUseTool.run -> case "move_to_and_click" -> MoveToAndClickAction.execute. If the coordinates were read as document coordinates the click would still be wrong, because the target would then sit at the viewport centre, not at (x,y).
- Counts if: To count, a comment must say that the new scroll moves the page before the click, but the click still uses the same (x,y), which are viewport coordinates from boundingBox/get_element_position. The click therefore lands on the wrong element (or the coordinates are not adjusted by the scroll offset). It is enough to note the mismatch between the scroll and the unadjusted click coordinates. Near-misses that do not count: a viewportSize() null-check comment (ref 5); comments only about the debug marker's position:absolute placement; generic 'scrolling may be unnecessary' remarks that never say the click target shifts.
D2 · medium · bug — input_text falls back to a raw JS el.value assignment and reports success for fields that rejected input
When both Playwright fill attempts fail, the action runs el.value = value; el.dispatchEvent(new Event('input')) and returns "成功输入" (success). Fill fails on disabled, readonly and hidden fields and on non-text types such as checkbox or radio. The JS fallback skips the editability and type checks, so it forces a value into a field the user could not edit, and the agent is told the input succeeded. The typing and change events some form handlers or controlled inputs need are also skipped. Both earlier exceptions are dropped without logging. At the merge base these cases threw and were reported as "Browser action 'input_text' failed". Now they wait through up to two 30s actionability timeouts and then report a false success.
- Sites:
spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/InputTextAction.java:76-88 (cause); spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/InputTextAction.java:54-57 (other-site)
- Evidence: InputTextAction.java:62-75
try { elementLocator.fill(""); ... elementLocator.pressSequentially(text, options); } catch (Exception e) { try { elementLocator.fill(""); elementLocator.fill(text); } catch (Exception e2) { ... elementLocator.evaluate("(el, value) => { el.value = value; el.dispatchEvent(new Event('input', { bubbles: true })); }", text); and :88 return new ToolExecuteResult("成功输入: '" + text + ...). The only type check is the tag name at :55 (!"input".equals(tagName) && !"textarea".equals(tagName)). The registry indexes every a, button, input, select, textarea with no visibility or enabled filter (InteractiveElementRegistry.java:42, :100-112), so disabled, readonly, hidden and checkbox inputs can be selected. At the merge base, handle.click(); handle.fill(""); threw for these, and BrowserUseTool.run:272-274 returned a failure result.
- Counts if: To count, a comment must say that the JS
el.value fallback bypasses Playwright's editability/actionability (or type) checks and still returns success. The result is a false success for disabled, readonly or hidden inputs, or input that is not accepted, or form handlers that never see the change. Near-misses that do not count: 'the second fill("") is redundant' (ref 3, R9); unused-import comments; 'add tests' (R8); a remark that only says the exceptions should be logged, without the false-success consequence.
D3 · low · bug — navigate prepends https:// to every URL without a lowercase http(s) prefix, breaking other schemes
The new auto-prefix rewrites any URL that does not start with lowercase "http://" or "https://". about:blank becomes https://about:blank, file:///tmp/x.html becomes https://file:///tmp/x.html, and data:, ftp:// and chrome:// URLs are broken the same way. An uppercase HTTP://example.com becomes https://HTTP://example.com. At the merge base page.navigate received these unchanged and handled them. Now they fail to navigate or go somewhere unintended.
- Sites:
spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/NavigateAction.java:41-46 (cause)
- Evidence: NavigateAction.java:42-44
if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "https://" + url; } then :46 page.navigate(url, ...). BrowserUseTool.java:223-224 forwards the URL the agent supplies directly to NavigateAction. The merge base passed the URL to page.navigate unchanged.
- Counts if: To count, a comment must say the prefix check only recognises (lowercase) http/https, so URLs that already have another scheme get mangled. Examples are about:, file:, data:, ftp:, or uppercase HTTP. The fix is to prefix only when no scheme is present. A comment that only mentions protocol-relative '//host' also counts, since it is the same mechanism. Near-misses that do not count: 'URL validation should be stricter' with no mangling example, and 'url could be null' (already checked at :38).
D4 · low · incomplete-fix — Agent-save fix uses a " " sentinel instead of fixing the inverted || guard, so the deprecated-prompt branch fires on every read and write
The NPE the PR works around comes from mergePrompts' guard getSystemPrompt() != null || !getSystemPrompt().trim().isEmpty(). That guard is true for every non-null value and dereferences null. Rather than fix it, the PR makes the field never null (a " " default, and " " written back as the 'cleared' value). The cleared state therefore still satisfies the guard. Every mapToAgentConfig and updateEntityFromConfig, for every agent including brand-new ones with no legacy prompt, re-enters the deprecation branch. Each time it logs a WARN claiming the SystemPrompt is non-empty and was merged, and prints the whole next-step prompt.
- Sites:
spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/dynamic/agent/service/AgentServiceImpl.java:190 (cause); spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/dynamic/agent/service/AgentServiceImpl.java:197-200 (symptom); spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/dynamic/agent/entity/DynamicAgentEntity.java:45-47 (other-site)
- Evidence: AgentServiceImpl.java:190
if (entity.getSystemPrompt() != null || !entity.getSystemPrompt().trim().isEmpty()) { ... :197-199 log.warn("Agent[{}]的SystemPrompt不为空, 但属性已经废弃...本次将agent 的内容合并... 当前制定的值: {}", agentName, nextPrompt); :200 entity.setSystemPrompt(" ");. DynamicAgentEntity.java:45-47 @Column(length = 40000) @Deprecated private String systemPrompt = " ";. mergePrompts is called from createAgent:94, updateEntityFromConfig:168 and mapToAgentConfig:153. Creating one agent therefore warns three times, and each admin getAllAgents/getAgentById call (AgentController:46/51) warns once per agent, forever, even though " " is not a prompt.
- Counts if: To count, a comment must identify the mergePrompts guard at :190 (
!= null || !...trim().isEmpty()) as the real defect the " " sentinel papers over, so it should be a null-safe && / isBlank check. It may name either consequence: the misleading deprecation warning firing for every agent on every read or save, or the guard still NPE-ing on null now that the column is nullable. Near-misses that do not count: 'use "" instead of " "' alone (ref 0/ref 1, which changes nothing because "" is also non-null); 'add a comment explaining the space'; and claims that " " bypasses some validation. Credit rests on identifying the inverted || guard and its misleading WARN; a claimed NPE path does not count (nothing can make systemPrompt null after this PR).
D5 · low · bug — Debug marker cleanup is not guaranteed, and its failure can turn a successful click into a reported failure
In debug mode (manus.browser.debug=true) the red marker is removed by a page.evaluate placed in the same try block right after mouse.click, not in a finally block. If the click's navigation has already destroyed the page's execution context, that evaluate throws. The catch then returns "Failed to click at position" for a click that happened and skips new-tab detection. If move or click throws, the removal is skipped and the dot stays in the DOM. Because of the if (!dot) guard, the next debug click reuses that stale dot rather than repositioning it.
- Sites:
spring-ai-alibaba-jmanus/src/main/java/com/alibaba/cloud/ai/example/manus/tool/browser/actions/MoveToAndClickAction.java:54-82 (cause)
- Evidence: MoveToAndClickAction.java:57-65 inject:
let dot = document.getElementById(id); if (!dot) { dot = document.createElement('div'); ... document.body.appendChild(dot); }. Then :69-70 page.mouse().move(x, y); page.mouse().click(x, y);, then :73-77 if (isDebug) { page.evaluate("(id) => { const dot = document.getElementById(id); if (dot) dot.remove(); }", ...); }. All of this is inside try { ... } catch (Exception e) { ... return new ToolExecuteResult("Failed to click at position (" + x + ", " + y + ")"); } (:79-82), which returns before the new-window check at :85-103. There is no finally block. Only reached when manus.browser.debug is true (default "false", ManusProperties.java:93-96).
- Counts if: To count, a comment must say either that the marker removal is not in a finally or guarded cleanup, so the dot leaks when the click path throws, or that the post-click removal evaluate can itself throw (for example after navigation) and make a successful click report failure. Near-misses that do not count: 'extract the marker JS into helper methods' (ref 7), and the Boolean-unboxing NPE on getBrowserDebug (ref 4).
Checked and rejected (10)
- ref 0 — Naming/comment taste. The " " default behaves the same as "" in the only check that reads it (AgentServiceImpl:190). The real guard defect is D4, and this note does not raise it.
- ref 1 — Wrong claim. No validation tells " " apart from "": the only check (:190) is true for any non-null value and trims anyway. Switching to "" changes nothing. The actual guard bug (D4) is not what this note says.
- ref 2 — Unused import (WaitForSelectorState; Random and ElementHandle are also unused now). A lint-level nit: the pom has no checkstyle, and spring-javaformat validate does not fail on unused imports.
- ref 3 — Nit. The second fill("") is redundant because fill(text) replaces the value, but removing it changes no behaviour. If fill("") fails, fill(text) would fail the same actionability check.
- ref 4 — Unreachable. ConfigService.initializeConfig seeds manus.browser.debug with defaultValue "false", so getBrowserDebug() returns Boolean.valueOf("false"), not null. The same unboxing already exists in GetElementPositionByNameAction:87.
- ref 5 — Unreachable. Pages come from browser.newPage() (ChromeDriverService:128) and popups in the same context, which use the default 1280x720 viewport, so viewportSize() is non-null. The code never creates a context with a null viewport.
- ref 7 — Readability refactor suggestion (extract the debug-marker JS into methods); not a defect.
- R8 — Request to add tests; not a defect.
- R9 — Same as ref 3: the redundant second fill("") is a nit. fill(text) would hit the same actionability wait, so there is no behavioural consequence.
- hunt:pressSequentially at a fixed 100ms per character exceeds the default 30s action timeout for texts over about 300 characters — Not a regression. The merge-base code typed per character with about 50-149ms delay plus 20-69ms sleep, roughly 145ms per character, so long texts were already slower. At head a timeout falls through to fill(text), which leaves the correct final value. Per-keystroke handler side effects also happened with the old per-character type().
openai__codex@8c952af
"Never store requests" (openai/codex #3212) removes the disable_response_storage option everywhere it appeared: Config, ConfigToml, ConfigProfile, ConfigOverrides, TurnContext, ConfigureSession, the MCP Profile type and the exec/tui/mcp-server callers. It also removes Prompt.store. Every Responses API request now sends store: false and, when reasoning is on, asks for reasoning.encrypted_content. The PR adds #[serde(skip_serializing)] to the id field of every ResponseItem variant (Message, Reasoning, LocalShellCall, FunctionCall, CustomToolCall, WebSearchCall), so item ids are never sent back to the API. Test expectations drop "id": null, and the PR deletes the store assertions.
D1 · high · build — codex-core unit tests no longer compile: store is removed from the ResponsesApiRequest test literals but the field still exists
The PR keeps pub(crate) store: bool on ResponsesApiRequest (client_common.rs:128) but deletes store: true, from both struct literals in the client_common.rs test module. Neither literal uses ..Default::default(), and the struct derives only Debug and Serialize. The lib's test target therefore fails with E0063 (missing field store), which breaks cargo test and cargo clippy --tests for codex-core in CI.
- Sites:
codex-rs/core/src/client_common.rs:190-204 (cause); codex-rs/core/src/client_common.rs:219-231 (cause); codex-rs/core/src/client_common.rs:128 (other-site)
- Evidence: Head client_common.rs:117-136
#[derive(Debug, Serialize)] pub(crate) struct ResponsesApiRequest<'a> { ... pub(crate) reasoning: Option<Reasoning>, pub(crate) store: bool, pub(crate) stream: bool, ... }. The diff removes - store: true, from both test literals. At head, let req = ResponsesApiRequest { model: "gpt-5", instructions: "i", input: &input, tools: &tools, tool_choice: "auto", parallel_tool_calls: false, reasoning: None, stream: true, include: vec![], prompt_cache_key: None, text: ... }; (lines 190 and 219) has no store and no .. base. The production site client.rs:198 still sets store: false, so the field is live. CI (.github/workflows/rust-ci.yml:148) runs cargo clippy ... --tests -- -D warnings, and :168 runs cargo test --all-features.
- Counts if: To count, a finding must say that the ResponsesApiRequest literals in the client_common.rs tests no longer initialize the still-required
store field, so the core test target fails to compile (missing field). Either literal, or both, is enough. Near-misses that do not count: comments about the misleading store doc comment being removed, or suggestions to drop the store field as dead or constant without saying the tests fail to compile.
D2 · high · build — mcp-server integration tests no longer compile: they still set the removed Profile.disable_response_storage field
The PR removes disable_response_storage from codex_protocol::mcp_protocol::Profile, but the unchanged codex-rs/mcp-server/tests/suite/config.rs still builds a Profile { ..., disable_response_storage: Some(false), ... }. That file is compiled into the mcp-server all integration-test binary through tests/all.rs -> mod suite; -> mod config;, so the mcp-server test build fails with E0560 (no field disable_response_storage) and CI fails.
- Sites:
codex-rs/protocol/src/mcp_protocol.rs:368-378 (cause); codex-rs/mcp-server/tests/suite/config.rs:107-116 (symptom)
- Evidence: Head mcp_protocol.rs:368
pub struct Profile { pub model, pub model_provider, pub approval_policy, pub model_reasoning_effort, pub model_reasoning_summary, pub model_verbosity, pub chatgpt_base_url }, from which the diff removes - pub disable_response_storage: Option<bool>,. At head, mcp-server/tests/suite/config.rs:114 has disable_response_storage: Some(false), inside Profile { model: Some("gpt-4o".into()), ... }. git grep disable_response_storage <head> still finds this file, and the PR does not touch it. tests/all.rs has mod suite; and tests/suite/mod.rs has mod config;.
- Counts if: To count, a finding must say that the mcp-server test
Profile literal (tests/suite/config.rs) still sets disable_response_storage, which no longer exists on Profile, so that test target fails to compile. Near-misses that do not count: saying only that the TOML fixture line disable_response_storage = false (config.rs:54) is stale. It is silently ignored because Profile/ConfigProfile have no deny_unknown_fields. Generic 'update the tests' remarks that do not name the compile failure also do not count.
D3 · medium · data — Reasoning items are written to rollouts without their required id, so resumed sessions silently drop all reasoning
ResponseItem::Reasoning { #[serde(skip_serializing)] id: String, ... } has no #[serde(default)], unlike the other skipped ids, which are Options and default to None. The rollout writer serializes ResponseItems with the same serde impl, so every persisted Reasoning line lacks id. On resume, serde_json::from_value::<ResponseItem> fails with 'missing field id', and get_rollout_history only logs a warning and skips the line. Every reasoning item, including its encrypted_content, is therefore lost when a session is resumed from the TUI (resume/continue), through MCP resumeConversation or through experimental_resume. With store now always false, that encrypted content is the only way the model's prior reasoning carries across turns.
- Sites:
codex-rs/protocol/src/models.rs:50-57 (cause); codex-rs/core/src/rollout/recorder.rs:291-334 (other-site); codex-rs/core/src/rollout/recorder.rs:189-198 (symptom); codex-rs/core/src/conversation_manager.rs:128-139 (other-site)
- Evidence: models.rs:50-56 at head:
Reasoning { #[serde(skip_serializing)] id: String, summary: Vec<...>, #[serde(default, ...)] content: ..., encrypted_content: Option<String> }. Writer: recorder.rs:293-297 RolloutCmd::AddItems(items) => for item in items { if is_persisted_response_item(&item) { writer.write_line(&item).await?; } }, and write_line (:329) uses serde_json::to_string(item). rollout/policy.rs:8 lists ResponseItem::Reasoning { .. } as persisted. Reader: recorder.rs:189-197 match serde_json::from_value::<ResponseItem>(v.clone()) { Ok(item) => ..., Err(e) => { warn!("failed to parse item: {v:?}, error: {e}"); } }. Reasoning items are recorded in codex.rs:1520-1533 and reach the rollout via record_conversation_items. Resume callers: conversation_manager.rs:134 (used by tui/src/app.rs:90 and mcp-server codex_message_processor.rs:613) and :70 (experimental_resume).
- Counts if: To count, a finding must connect the non-optional
Reasoning.id: String + skip_serializing to local persistence: rollout items are written without id and cannot be deserialized back (missing required field), so resume drops reasoning items. Accepted fixes include #[serde(default)]/Option, or a separate wire representation. Near-misses that do not count: claiming API responses fail to parse because they contain id (skip_serializing does not affect deserialization, so that is wrong); vague 'id may be dropped in other serialization paths' remarks that never say the item becomes unreadable or lost on resume; and complaints only that the field should be Option for consistency.
D4 · high · build — Now-unused request_body bindings in two auth tests fail cargo clippy --tests -D warnings
In prefers_chatgpt_token_when_config_prefers_chatgpt and prefers_apikey_when_config_prefers_apikey_even_with_chatgpt_tokens, the PR replaces the only use of request_body (the store assertion) with a comment but keeps let request_body = request.body_json::<serde_json::Value>().unwrap();. That triggers rustc's unused_variables warning, which CI's clippy step promotes to an error with -- -D warnings. The core test job therefore still fails after the compile errors are fixed. The replacement comment also says 'store flag removed' even though every request still sends store: false.
- Sites:
codex-rs/core/tests/suite/client.rs:578-582 (cause); codex-rs/core/tests/suite/client.rs:659-663 (cause)
- Evidence: Head core/tests/suite/client.rs:579-581
let request = &server.received_requests().await.unwrap()[0]; let request_body = request.body_json::<serde_json::Value>().unwrap(); // store flag removed; responses are never stored., followed by }. Lines 660-662 are the same. The diff removes assert!(!request_body["store"].as_bool().unwrap(), ...) and assert!(request_body["store"].as_bool().unwrap(), ...). core/Cargo.toml has [lints] workspace = true, with no allow in tests/all.rs or suite/mod.rs. rust-ci.yml:148 runs cargo clippy --target ... --all-features --tests --profile ... -- -D warnings.
- Counts if: To count, a finding must say that
request_body is left unused at client.rs ~580 and/or ~661, which produces an unused-variable warning or clippy -D warnings failure (a dead binding). Near-misses that do not count: comments that only ask to restore or assert store == false for coverage without noting that the binding is now unused (a test request); and remarks that the comment wording is misleading.
Checked and rejected (8)
- ref 0 — Style nit: it objects to the tombstone comment
// Removed: server-side response storage control... at config.rs:81. The comment is harmless and has no behavioural or maintenance cost.
- ref 1 — Wrong premise: the field was deleted, so no field's docs were demoted. Turning the line into
/// as suggested would attach it to user_instructions and corrupt that field's docs.
- ref 2 — Duplicate of ref 0 (the same tombstone-comment nit for the ConfigToml copy at config.rs:416). Style only.
- ref 3 — Duplicate of ref 1 and wrong for the same reason: a
/// at config.rs:416 would become part of the notify field's rustdoc.
- ref 4 — Wrong mechanism:
skip_serializing does not affect deserialization, so API payloads that contain id still parse at client.rs:509. The suggested skip_deserializing fix is also unneeded for that path. The real problem, a missing id on rollout resume, is D3, and this ref does not describe it.
- ref 6 — Describes a field that does not exist:
FunctionCallOutput has no id at head or at merge base (FunctionCallOutput { call_id, output }, models.rs:84-87).
- R6, R7, R8 — Docs-update requests (docs/config.md and docs/zdr.md still mention
disable_response_storage). No behavioural consequence: ConfigToml/ConfigProfile have no deny_unknown_fields, so the stale key is silently ignored, and responses are now never stored, which is the ZDR-safe behaviour. Docs requests are out of scope for this benchmark.
- R9, R12 — Test-coverage requests (restore a
store == false assertion so a regression would be caught). Neither comment says that request_body is now an unused binding that fails clippy -D warnings (D4), so they do not identify a concrete defect.
mpv-player__mpv@0729afe
The PR changes mp_option_change_callback so it no longer runs per-option side effects inline. Each change is appended as a {co, flags} entry to mpctx->option_callbacks. When a queued entry has the same nonzero flags or the same option, the older entry is dropped and the new one goes to the end. The new function mp_option_run_callbacks drains the queue in run_playloop and mp_idle, right after mp_process_input. A second commit moves startup IPC initialization out of the callback and into mp_initialize (main.c:415). As a result, the startup call mp_option_change_callback(mpctx, NULL, UPDATE_OPTS_MASK, false), which used to run every handler once inside mp_initialize, now only queues an entry. That entry runs at the first mp_idle or playloop iteration, and nothing wakes the core when an entry is queued.
D1 · high · bug — The startup 'run all update handlers' pass is only queued, so it runs against live playback state after playback has started
mp_initialize's 'Run all update handlers' call now only queues {co=NULL, flags=UPDATE_OPTS_MASK}. The handlers therefore run at the first mp_idle, which for a CLI run with no clients (no user scripts, Linux) is inside play_current_file's open loop, after stop_play was reset to 0. There the UPDATE_DVB_PROG branch sets stop_play=PT_CURRENT_ENTRY. That aborts the first file's open, and mp_play_files replays the entry, so the file opens twice, clients get spurious start-file/end-file events, and pipes/stdin lose the data the first open consumed. In the same pass, UPDATE_VO destroys and recreates any VO that force-window already made (idle+force-window, pseudo-gui with no file, force-window=immediate). Before the PR both branches were no-ops, because they ran in mp_initialize while stop_play was PT_NEXT_ENTRY and before any VO existed. The same deferral also means the initial pass no longer completes before the first file: builtin scripts (osc, ytdl_hook, auto_profiles) are created only by UPDATE_BUILTIN_SCRIPTS and are neither loaded nor waited on before the first file's hooks (the mp_play_files script-wait gate is skipped when there are no user scripts), and config-file logging/terminal settings from UPDATE_TERM apply late, losing early log messages.
- Sites:
player/main.c:383-387 (cause); player/command.c:7705-7725 (cause); player/command.c:7827-7830 (symptom); player/command.c:7783-7792 (symptom); player/loadfile.c:1621 (other-site); player/loadfile.c:1243-1248 (symptom); player/loadfile.c:2070-2076 (other-site); player/playloop.c:1315-1328 (other-site); player/main.c:427-428 (other-site); player/command.c:7758-7759 (cause); player/loadfile.c:2070-2079 (symptom); player/client.c:209-221 (other-site); player/scripting.c:257-266 (other-site); player/loadfile.c:1623 (symptom); player/loadfile.c:1711 (symptom); player/command.c:7735-7736 (other-site); common/msg.c:807-835 (other-site)
- Evidence: main.c:387
mp_option_change_callback(mpctx, NULL, UPDATE_OPTS_MASK, false); now just reaches MP_TARRAY_APPEND(mpctx, mpctx->option_callbacks, ...) (command.c:7723). UPDATE_OPTS_MASK includes UPDATE_DVB_PROG (m_option.h:440,452). mp_create sets .stop_play = PT_NEXT_ENTRY (main.c:280), so the old synchronous run was a no-op. With zero clients, mp_clients_all_initialized returns true (client.c:209-221), so mp_play_files skips its mp_idle wait (loadfile.c:2071-2076). idle_loop does nothing when not idle. play_current_file does mpctx->stop_play = 0; (1621), and process_hooks does not idle when no hooks exist (mp_hook_test_completion returns true, command.c:191-207). The first mp_idle is in while (!atomic_load(&mpctx->open_done)) { mp_idle(mpctx); if (mpctx->stop_play) mp_abort_playback_async(mpctx); } (1243-1247). mp_idle calls mp_option_run_callbacks (playloop.c:1305), which runs if (flags & UPDATE_DVB_PROG) { if (!mpctx->stop_play) mpctx->stop_play = PT_CURRENT_ENTRY; } (command.c:7827-7830). Playback then terminates, and mp_play_files does else if (mpctx->stop_play == PT_CURRENT_ENTRY) new_entry = mpctx->playlist->current;. Likewise if (flags & UPDATE_VO && mpctx->video_out) { uninit_video_out(mpctx); handle_force_window(mpctx, true); ...} (7783-7791) fires after idle_loop's handle_force_window(mpctx, true) (playloop.c:1322) or main.c:427's force_vo==2 path already created the VO.
- Counts if: To count, a comment must say that the startup UPDATE_OPTS_MASK 'run all update handlers' call (main.c:383-387) is now only queued and runs later, together with ANY one consequence: UPDATE_DVB_PROG aborting and reloading the first file, UPDATE_VO recreating the force-window VO, builtin scripts/hooks missing or not waited on for the first file, or config-file logging applied late. A generic 'initialization is deferred' that names the startup handler pass counts; a comment that names none of this does not.
D3 · medium · bug — Queued option changes never wake the core: synchronous property/option sets (mpv_set_property, IPC set_property, script mp.set_property) do not take effect while the player sleeps
mp_option_change_callback now only appends to the queue and never calls mp_wakeup_core or interrupts the dispatch queue. Synchronous client paths (mpv_set_property, mpv_set_option, and through them JSON IPC set_property and Lua/JS mp.set_property*) run under mp_dispatch_lock/unlock. Unlocking does not end the core's timed wait in mp_dispatch_queue_process. The queued handlers (set_pause_state, update_track_switch, audio_update_volume, VO/OSD refresh, ...) therefore do not run until something unrelated wakes the core. While paused or idle that can be indefinitely: for example, JSON-IPC set_property sid while paused does not switch subtitles, and a libmpv client that doesn't observe 'pause' calling set_property pause=no stays paused. Before the PR these handlers ran synchronously, and several of them woke the core themselves.
- Sites:
player/command.c:7705-7725 (cause); player/client.c:1059-1064 (other-site); player/client.c:1309-1335 (other-site); misc/dispatch.c:312-316 (symptom); misc/dispatch.c:402-418 (other-site); player/client.c:1643-1648 (other-site); player/playloop.c:1286-1292 (symptom)
- Evidence: The new callback body ends with
MP_TARRAY_APPEND(mpctx, mpctx->option_callbacks, mpctx->num_option_callbacks, callback); and contains no wakeup. The path is mpv_set_property -> run_locked(ctx, setproperty_fn, &req) -> mp_dispatch_lock(...); fn(fn_data); mp_dispatch_unlock(...). mp_dispatch_unlock only decrements lock_requests and broadcasts, and the process loop then re-enters } else if (queue->wait > 0 && !queue->interrupted) { mp_cond_timedwait_until(...) }. Only mp_dispatch_append/mp_dispatch_interrupt set interrupted. The only incidental wake is mp_client_property_change's if (any_pending) mp_dispatch_adjust_timeout(mpctx->dispatch, 0);, which fires only if some client observes that exact property. Callbacks run only after mp_wait_events returns (playloop.c:1286-1292, 1303-1305). Before the PR, set_pause_state called mp_wakeup_core(mpctx) (playloop.c:175) and update_track_switch called mp_wakeup_core(mpctx) (command.c:7688) synchronously from the callback. IPC uses mpv_set_property (input/ipc.c:243), and Lua uses it too (lua.c:635-665).
- Counts if: To count, a comment must say that queuing the option callback does not wake the core (no mp_wakeup_core or dispatch interrupt). As a result, a change made through a synchronous client/IPC/script set while the player is paused or idle isn't applied until an unrelated event wakes the loop, possibly never. Near-misses that do NOT count: generic claims that deferral adds 'latency until the next playloop iteration' or 'hundreds of ms' without the no-wakeup / stuck-while-idle mechanism (dataset ref 6); requests to confirm reentrancy (ref 7).
D4 · low · contract — Setting aid/vid/sid no longer switches the track synchronously: a read right after the set, and the command's OSD message, report the previous track
For aid/vid/sid/secondary-sid, SET goes through mp_property_generic_option, which only writes the option and queues the callback; update_track_switch now runs later in mp_option_run_callbacks. GET and PRINT for these properties read mpctx->current_track while playback is initialized. So set sid 2 / cycle-values sid ... (input.conf, IPC text commands) shows the old track in its OSD message, and a get_property right after a successful set_property returns the old track id until the queue drains, which is indefinitely while paused (see D3). Before the PR, update_track_switch ran inside the SET call.
- Sites:
player/command.c:7928-7933 (cause); player/command.c:1948-1971 (symptom); player/command.c:5215-5219 (symptom); player/command.c:4807-4817 (other-site)
- Evidence: mp_property_switch_track:
struct track *track = mpctx->current_track[order][type]; ... case M_PROPERTY_GET: if (mpctx->playback_initialized) { *(int *)arg = track ? track->user_tid : -2; }, and PRINT formats the same track. M_PROPERTY_SET falls through to return mp_property_generic_option(...), which calls m_config_set_option_raw -> callback -> queue. if (opt_ptr == &opts->stream_id[order][type]) update_track_switch(mpctx, order, type); (7930-7931) now runs only in mp_option_run_callbacks. change_property_cmd calls mp_property_do(...) and then immediately show_property_status -> show_property_osd, which expands "%s: ${%s}" at call time via mp_property_expand_string (4812-4814).
- Counts if: To count, a comment must say that because update_track_switch is deferred, setting aid/vid/sid (or another option whose effect is read back through derived state) followed immediately by a read or by the command's OSD message reports the old track, which breaks read-after-write for property sets. Near-misses that do NOT count: generic 'side effects are delayed' remarks with no stale read-back or OSD consequence; the missing wakeup itself (that is D3).
D5 · low · bug — Coalescing a round-trip hidpi-window-scale toggle leaves one unpaired relative resize, so the window is rescaled although the option ends where it started
update_hidpi_window_scale does not re-derive the window size from state. It applies a relative resize: it multiplies the current unfullscreened window size by the cached HiDPI scale when the option is true, and by the inverse when it is false. The new queue keeps only the newest entry for an option, and the handler reads the option's value at drain time. So if hidpi-window-scale is changed and changed back before the queue drains (true→false→true, or any even number of toggles), only one callback survives. It applies a single ×scale (or ×1/scale) to a window whose size is still correct, so the window is resized by the display scale factor (for example doubled or halved on a 2x display) even though the option's net change is zero. Before the PR each change ran synchronously and the two resizes cancelled out: the x11, wayland and win32 VOs update their stored size synchronously on VOCTRL_SET_UNFS_WINDOW_SIZE, so the second GET saw the first resize. Both changes reach the queue before one drain whenever they land in the same batch. That happens with a single command that sets the option twice (load-config-file of a file or profile that sets it twice), with ;-chained set/cycle commands (mp_process_input runs every queued command before mp_option_run_callbacks), and with a script or IPC client that sets the option and restores it while the core sleeps (the queue is not drained until an unrelated wakeup, see D3).
- Sites:
player/command.c:7706-7724 (cause); player/command.c:7898-7899 (other-site); player/command.c:2781-2799 (symptom); player/playloop.c:109-122 (other-site); options/m_config_core.c:802-803 (other-site)
- Evidence: The coalescing loop in mp_option_change_callback (command.c:7706-7724),
if (mpctx->option_callbacks[i].co && opt_ptr == mpctx->option_callbacks[i].co->data) drop = true;, overwrites the older same-option entry and keeps a single one. The drain calls if (opt_ptr == &opts->vo->hidpi_window_scale) update_hidpi_window_scale(mpctx, opts->vo->hidpi_window_scale); (7898-7899) with the value current at drain time. update_hidpi_window_scale computes double scale = hidpi_scale ? cmd->cached_window_scale : 1 / cmd->cached_window_scale;, then reads VOCTRL_GET_UNFS_WINDOW_SIZE, does s[0] *= scale; s[1] *= scale; and calls VOCTRL_SET_UNFS_WINDOW_SIZE (2781-2799), which is relative to the current size. m_config only notifies on a real change (m_config_core.c:802 !m_option_equal(...)), so a round trip produces exactly two queued changes, and coalescing collapses them into one. Base (e4b64fb) command.c:7870-7871 ran the handler once per change, synchronously, so the two resizes cancelled. mp_process_input loops for (;;) { cmd = mp_input_read_cmd(...); if (!cmd) break; run_command(...); } before mp_option_run_callbacks(mpctx); (playloop.c:1290-1292, 1304-1305).
- Counts if: To count, a comment must name hidpi-window-scale / update_hidpi_window_scale (or the relative window resize it performs) as a handler that coalescing breaks, because it applies a delta instead of re-deriving state from the final value. It must also name the consequence: changing the option and changing it back before the queue drains leaves one unpaired resize, so the window is rescaled by the HiDPI factor although the option ends where it started. The comment does not need to say that the two resizes cancelled before the PR. Near-misses that do NOT count: a generic 'coalescing may drop intermediate updates' or 'handlers must be idempotent' that names no concrete delta handler; a comment that names a state-based handler (e.g. window-scale / update_window_scale) as the broken one; the flag-collision or interleaving claims excluded as R2/R3; stale read-back after a set (D4) or the missing wakeup (D3).
Checked and rejected (12)
- ref 0 — Wrong. At iteration i the loop reads option_callbacks[i] before writing slot i, so every original entry is examined.
drop is sticky, and the loop correctly removes the first match and re-appends the new entry last (command.c:7707-7719). The suggested rewrite is itself broken: it drops every entry after the match and never appends the new callback.
- ref 1 — Style/readability preference (extract the loop body into a function). No defect.
- ref 2 — Wrong. Head guards both uses:
void *opt_ptr = co ? co->data : NULL; (command.c:7732), and the coalescing loop checks option_callbacks[i].co && ... (7711). No NULL dereference.
- ref 3 — Compensated. The second commit initializes IPC in mp_initialize,
mpctx->ipc_ctx = mp_init_ipc(...) (main.c:415), so dropping init || from the callback is not a regression.
- ref 4 — Not a leak. The array is talloc-parented on mpctx, MP_TARRAY_APPEND reuses capacity, and resetting num_option_callbacks=0 reuses the buffer, which is bounded by the peak queue size and freed with mpctx.
- ref 5 — NULL is the normal return of mp_init_ipc when no IPC path is configured, and mp_uninit_ipc handles NULL. The old callback stored it unchecked the same way.
- ref 6 — Speculative, with the wrong mechanism. Changes made from input commands and async dispatch items are drained in the same iteration (playloop.c:1286-1292), so there is no generic 'hundreds of ms' delay. The real issue is the missing wakeup for synchronous sets (D3), which this comment does not identify.
- ref 7 — A 'please confirm reentrancy/boundedness' request with no concrete path. input-commands only queues commands (command.c:7645-7650), handlers use self-notifications, and the per-iteration call is a no-op when the queue is empty.
- R1 — Readability/style request to make the single-match removal explicit. The behaviour is already correct.
- R2 — Not reachable. No option has both nonzero UPDATE_* flags and an opt_ptr-specific handler: every opt_ptr-handled option (pause, speed, aid/sid/vid, vf/af, ab-loop, input-commands, ipc, vo window options, ...) has flags 0, and no group change_flags apply to them. Flag-driven handlers read the current global state, so dropping the older entry with equal flags loses nothing. The startup entry (co=NULL, flags=UPDATE_OPTS_MASK) cannot collide by flags with any real option.
- R3 — Not reachable. A given option always produces the same change mask, so a queue entry can match at most one existing entry, and zero flags never match by flags. Interleaved A,B,A,B yields [A,B], not A,A,B, so run_command_opts cannot run twice this way.
- R7 — Request to add tests. Not a defect.
ppy__osu@748ab3d
This PR targets pp-dev and is described as a speed-up of the osu! RhythmEvaluator. The old code computed the rhythm-ratio term as Math.Min(0.5, sin²(π / (min/max))). The new code computes Math.Min(0.5, SmoothstepBellCurve(frac(max/min))) and adds the helper DifficultyCalculationUtils.SmoothstepBellCurve(x, mean=0.5, width=0.5), which is smoothstep(1-2|x-0.5|). Rewriting the ratio as a fractional part is correct, because sin²(πR) has period 1. The (long) cast is safe, since StrainTime is floored at 25 ms, and the helper behaves as its doc says. The one real problem is that smoothstep only approximates sin². The two curves match only at frac = 0 and inside the 0.5 clamp band [0.25, 0.75]. Everywhere else the new value is strictly higher, by up to +0.010 at frac ≈ 0.139. So a PR presented as a pure optimisation also quietly raises the rhythm and speed difficulty, and therefore SR/pp, for off-integer delta ratios.
D1 · low · bug — The smoothstep bell curve is not equivalent to sin²: the 'optimisation' changes the rhythm bonus and therefore SR/pp
Before the 0.5 clamp, SmoothstepBellCurve(f) equals 12f²-16f³ for f<0.25 (mirrored for f>0.75). The old term was sin²(πf). The two agree only at f=0 and wherever both are clamped to 0.5 (f in [0.25, 0.75]). For f in (0, 0.25) ∪ (0.75, 1) the new value is always higher, by up to +0.010, so currRatio = 1 + 12·term rises by up to +0.12 (about +4%). Every pair of deltas whose ratio is not a whole or half multiple (e.g. 1.1, 1.125, 1.2, 1.89, 3.2) now gets a larger rhythm multiplier in Speed. The PR is presented as a pure speed optimisation ("9x faster", with a Desmos plot of the curves) with no star-rating or pp diff, although the new curve raises values for off-integer ratios.
- Sites:
osu.Game.Rulesets.Osu/Difficulty/Evaluators/RhythmEvaluator.cs:71-76 (cause); osu.Game/Rulesets/Difficulty/Utils/DifficultyCalculationUtils.cs:76-81 (other-site); osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs:45-47 (symptom)
- Evidence: Merge base:
double currRatio = 1.0 + rhythm_ratio_multiplier * Math.Min(0.5, Math.Pow(Math.Sin(Math.PI / deltaDifferenceRatio), 2));. Head, RhythmEvaluator.cs:71-76: reverseDeltaDifferenceRatio = Math.Max(prevDelta, currDelta) / Math.Min(prevDelta, currDelta); deltaDifferenceFraction = reverseDeltaDifferenceRatio - (long)reverseDeltaDifferenceRatio; currRatio = 1.0 + rhythm_ratio_multiplier * Math.Min(0.5, DifficultyCalculationUtils.SmoothstepBellCurve(deltaDifferenceFraction));. Helper, DifficultyCalculationUtils.cs:78-80: x -= mean; x = x > 0 ? (width - x) : (width + x); return Smoothstep(x, 0, width);. Smoothstep is 3t²-2t³ (line 93). Evaluated numerically (old → new clamped term): ratio 1.1: 0.0955→0.1040; 1.125: 0.1464→0.1563; 1.2 and 3.2: 0.3455→0.3520; 1.889: 0.1170→0.1262. The maximum difference is +0.0100 at f≈0.139, and the new value is never lower. Path: Speed.StrainValueAt (Speed.cs:45) calls RhythmEvaluator.EvaluateDifficultyOf for every object, and totalStrain = currentStrain * currentRhythm feeds the speed rating and SR. Severity is low: the shift is small, common snapped ratios (2, 1.5, 4/3, 5/4) fall at f=0 or inside the clamp band and are unchanged, and pp-dev accepts balance changes. I estimate the objects the change touches in diffcalc-test.osu (78500, 98250, 99875) sit in low-weight strain sections, so the hard-coded SR tests (Within 1e-5) probably still pass. I did not run them.
- Counts if: To count, a comment must say that the new smoothstep bell curve is not a drop-in equivalent of the old sin²(π·ratio) term. It must say that it gives different (higher) values for some fractional delta ratios, so rhythm/speed difficulty, star rating or pp change, meaning the PR is not a pure performance change. Naming a concrete ratio (e.g. 1.125) or the region outside the 0.5 clamp is enough. These do not count: requests for tests (R1, R3); asking for a Version bump or star-rating cache invalidation without saying the curve changes values; saying 'tests may fail' without identifying the curve mismatch; claiming the max/min fractional-part rewrite is mathematically wrong (it is exact, since sin²(πR) has period 1); division-by-zero, long-overflow or precision concerns about the fraction; doc typos; the width==0 edge case; naming or Math.Abs simplification suggestions.
Checked and rejected (11)
- ref 0 — Unreachable. StrainTime = Math.Max(DeltaTime, MIN_DELTA_TIME=25) (OsuDifficultyHitObject.cs:25,123), so neither division can see 0 or near-0. Smoothstep clamps its normalised input to [0,1] (DifficultyCalculationUtils.cs:91), so overshoot cannot escape, and the (long)-based fraction is exact at these magnitudes. Even a hypothetical infinite ratio gives 0 under the new code, where the old code gave NaN.
- ref 1 — Misreads the comment.
// Take value in range [0, 1] (line 73) describes deltaDifferenceFraction on line 74, which is in [0,1), not reverseDeltaDifferenceRatio.
- ref 2 — No overflow is possible. The ratio is max/min of StrainTimes, with min ≥ 25 ms and max bounded by map length, far below long.MaxValue. The curve is also continuous and periodic at the 0/1 boundary, so the truncation choice cannot change the result.
- ref 3 — The doc typos ('returns returns', "it's") are real but a nit. The output-range concern is already handled because Smoothstep clamps internally, so the result stays in [0,1].
- ref 4 — Duplicate of ref 3's doc typo, and a nit.
- ref 5 — width==0 or negative is unreachable. The sole caller (RhythmEvaluator.cs:76) uses the default width 0.5, and the sibling Smoothstep and Smootherstep helpers do not validate either. This is generic defensive-validation advice.
- ref 6 — Variable naming taste in a 3-line helper.
- ref 7 — Readability micro-suggestion (the ternary equals width - |x|). Not a defect.
- R1, R3 — Requests to add focused tests. Test requests are not defects.
- R2 (version-bump claim) — R2's factual core, that at ratio 1.125 smoothstep changes the bonus relative to sin², is merged into D1. Its separate demand to bump OsuDifficultyCalculator.Version is not a defect for a pp-dev PR. pp-dev difficulty changes do not bump Version per PR: #28877 (60eaf088) changed Aim and Speed evaluators on pp-dev without touching it, and 20250306 was set in a master merge (33251275). The version is advanced when pp-dev is released.
- hunt: test baseline not re-baselined (sub-claim of the hunt defect) — Not kept as a separate build defect. Tracing diffcalc-test.osu, the pairs the change affects only change the rhythm of objects 78500, 98250 and 99875. Their speed strains (~6.5 and ~2-3) rank far below the 1/4-stream sections that dominate the 0.9^i-weighted sum, so the SR shift is estimated well below the 1e-5 tolerance. zero-length-sliders' affected pairs are zeroed by windowPenalty. Unproven either way (no .NET available), so it is recorded only as context in D1.
symfony__symfony@2b9721f
Docblock-only PR on the 7.3 branch. It adds a PHPStan/Psalm array-shape type to the $content constructor parameter and to the getContent() return type of the Mercure notifier's MercureOptions (src/Symfony/Component/Notifier/Bridge/Mercure/MercureOptions.php). The shape lists the browser Web Notification options: actions, badge, body, data, dir, icon, image, lang, renotify, requireInteraction, silent, tag, timestamp and vibrate. content itself was added earlier on the same unreleased 7.3 branch (d54febf32, with tests passing ['tag' => '1234', 'body' => 'TEST']), and it was meant to carry Notification options. Runtime behaviour does not change: MercureTransport::doSend still json_encodes $options->getContent() into the ActivityStreams content field as-is. The only real problem is one wrong type in the new shape: vibrate is documented as int[], but the API also accepts a single integer.
D1 · low · contract — vibrate documented as int[] only; the Notification API VibratePattern also accepts a single integer
The new shape declares vibrate?: int[] in both the constructor @param and the getContent() @return. The Web Notification vibrate option is a VibratePattern (unsigned long or sequence<unsigned long>), so a valid value such as ['vibrate' => 200] gets flagged by PHPStan/Psalm even though MercureTransport forwards it unchanged to the client and it works. The shape should be int|list<int> (or int|int[]). This shape is the only contract for the option, and it is the whole deliverable of this PR.
- Sites:
src/Symfony/Component/Notifier/Bridge/Mercure/MercureOptions.php:39 (cause); src/Symfony/Component/Notifier/Bridge/Mercure/MercureOptions.php:96 (other-site)
- Evidence: MercureOptions.php:39
* vibrate?: int[], (in @param array{...}|null $content) and :96 * vibrate?: int[], (in @return array{...}|null of getContent()). MercureTransport.php doSend: json_encode([... 'content' => $options->getContent(), ]) passes the array through with no normalisation, so the docblock is the only type contract, and the browser Notification API accepts vibrate: 200 as well as vibrate: [200, 100, 200].
- Counts if: To count, a comment must say that
vibrate is typed as an int array only, while the Notification/Vibration API (VibratePattern) also accepts a single integer, so the type should be int|int[] / int|list<int>. Flagging either line 39 or line 96 counts. Near-misses that do NOT count: saying int[] should be list<int> without mentioning the single-int form; general comments that the shape is too loose or too strict (e.g. actions?: array too broad, or the shape rejects custom keys); and remarks about the duplicated shape.
Checked and rejected (6)
- ref 0 —
actions?: array is less specific than the Web Notification action shape, but it is not wrong. Tightening it to list<array{action,title,icon}> is a precision nicety in a docblock and has no concrete consequence. Trivial.
- ref 2 — Asks for a @phpstan-type/@psalm-type alias to remove the duplicated @param/@return shape. Symfony production code does not use such aliases, and repeating a shape across @param and @return is routine there. Its only cost is editing two places, which is a style/maintainability nit a Symfony maintainer would not insist on.
- hunt:The 14-key array shape is copied verbatim into two docblocks — Same as ref 2: duplicating a shape across @param and @return is conventional in Symfony, and the only concrete cost is a two-place edit. That is not a defect. The indentation difference is a whitespace nit.
- ref 3 — Whitespace-only formatting difference: 6-space indentation and
* }|null in the @return block vs 5 spaces in the constructor. A style nit with no consequence.
- R1, R2, R3 — All three argue that the closed shape narrows an 'existing' arbitrary-array contract, so custom keys like
['orderId' => 123] would be flagged. This is a design disagreement, not a defect. content was added on the same unreleased 7.3 branch (d54febf32; CHANGELOG 7.3 'Add content option'), so no released contract is narrowed. It was meant to carry Web Notification options (its tests pass tag/body), and this PR exists to document exactly that shape, as requested in the linked #60140 review discussion. Runtime behaviour is unchanged, since only static analysis sees the docblock. Whether the payload should be open-ended is a product decision, not a bug the PR introduces.
- judge candidate: Preserve custom content fields in the documented type The constructor accepts any array, and
MercureTransport::doSend() serializes it directly into content — Both make the same argument that the case's excluded list already rejects as R1/R2/R3: the closed array shape narrows an 'existing' open ?array $content contract, so custom keys like ['orderId' => 123] would be flagged. The code bears out that exclusion. content was added on this same unreleased 7.3 branch by d54febf32 ('Notifier mercure7.3'; the Mercure CHANGELOG lists it under '7.3: * Add content option'), and the PR targets base_ref 7.3, so no released contract is narrowed. The option was meant to carry Web Notification options: its tests pass tag/body, and the PR fixes review thread #60140 by documenting exactly that shape. The diff only adds @param array{actions?: array, ... vibrate?: int[]}|null $content and the matching @return docblock on getContent(). MercureTransport::doSend still forwards the array unchanged, so nothing changes at runtime and the only effect is on static analysis. Whether the payload should allow arbitrary keys is a design decision, not a defect this PR introduces.