Skip to content

Correct a reversed expiration check on directory caching.#342

Merged
garbear merged 1 commit into
xbmc:Piersfrom
bjsvedin:cache-check-reversal
Jun 15, 2026
Merged

Correct a reversed expiration check on directory caching.#342
garbear merged 1 commit into
xbmc:Piersfrom
bjsvedin:cache-check-reversal

Conversation

@bjsvedin

Copy link
Copy Markdown

When looking into a memory leak with peripherals PR, claude randomly pointed out that this check was incorrect, and actually the reverse of what is desired. So I did some digging.

From my understanding, m_cache hold the list of files for a directory, and a timestamp for when that list should be considered stale. If the path is stale, it should return false without assigning a value to items, which will cause a fresh pull of the directory contents, which is placed back into the cache. If not stale, it returns the cache contents and true, so no disk reads are necessary.

I applied some logs to the function and found that indeed the existing code does appear to do the exact opposite of what is wanted here. Instead of returning false on the first call with a stale cache, it would return true, and then proceed to return false to every proceeding call. This would result in stale data being returned the first call, then no cache return for the rest.

@kodiai

kodiai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Decision: APPROVE

Issues: none

Evidence:

  • Review prompt covered 1 changed file.
Review Details
  • Review plan: ready hash=c315c31710bb route=tiny-diff task=review.small-diff files=1 lines=2(local-diff) budget=na/752s gates=3/3 publish=canonical-visible-surface graph=skipped candidates=preferred doctrine=disabled/0/0/0 reasons=disabled

  • Review reducer: ready input=0 kept=0 suppressed=0 rewritten=0 deprioritized=0 lowConfidence=0 auditEvents=0 severityDemoted=0 graphValidated=0 graphUncertain=0 doctrine=disabled/0/0/0 reasons=disabled

  • Review candidates: shadow recorded=0 rejected=0 errors=0 artifact=absent repo=xbmc-peripheral.joystick pr=342 key=kodiai-review-output:v1:inst-109141824:xbmc-peripheral.joystick:pr-342:action-op delivery=3b000520-67b3-11f1-94b8-b717c1db7c49

  • Review candidate publication: mode=blocked approved=0 rewritten=0 publishable=0 nonPublishable=0 fixBlocked=0 published=0 directFallback=0 reasons=no-candidate-publication-path,approval-blocked movedToDetails=0 detailsOmitted=0 buckets=blocked:1:approval-blocked+no-candidate-publication-path

  • M072 candidate publication bridge: status=denied; bridgeVersion=candidate-publication-bridge.v1; bridgeId=candidate-publication-record:55f18bcfd11c1a659ea41c5b29477f26; recordKey=candidate-publication-record:55f18bcfd11c1a659ea41c5b29477f26; correlationKey=candidate-publication-bridge:da95846d79ee0dd61c8415bbd47863ae; source=review-handler-publication; candidateRef=candidate-publication-summary-41cc3607; verification=none; counts=candidateCount:0,evidenceCount:0,verifiedCount:0,partiallyVerifiedCount:0,unverifiedCount:0,disprovenCount:0,publicationEligibleCount:0,malformedRecordCount:0,unsafeInputFieldCount:0; reasons=no-evidence,publication-ineligible; malformed=none; presence=deliveryId:y,reviewOutputKey:y,upstreamCorrelationKey:y,policyCorrelationKey:y; handoffOwner=available; redaction=privateOnly:y,rawPayloads:n,publicationFields:n,evidencePayloads:n,githubCommentBody:n,reducerRawPayload:n,discardedRawPayload:n,discardedPublicationFields:n,discardedEvidencePayloads:n

  • Review finding lifecycle: status=normalized; counts=input:0,recorded:0,rejected:0,unsafeInputFields:0; correlation=repo:y,pull:y,reviewOutputKey:y,deliveryId:y,commit:n; statuses=detected:0,open:0,suggested:0,validated:0,revalidated:0,resolved:0,blocked:0,degraded:0; severity=critical:0,major:0,medium:0,minor:0; actionability=actionable:0,needs-human-review:0,needs-reproduction:0,blocked:0,not-actionable:0; reasons=none; rejected=none; redaction=privateOnly:y,rawPrompts:n,rawModelOutput:n,candidateBodies:n,toolPayloads:n,secretLike:n,diffs:n,unboundedArrays:n,unsafeFields:0

  • Review validation truth: status=empty; counts=detected:0,suggested:0,validated:0,revalidated:0,resolved:0,blocked:0,degraded:0,open:0,uncertain:0,inputFindings:0,unsafeInputFields:0; evidence=fresh:0,stale:0,missingValidation:0,missingRevalidation:0; reasons=none; refs=none; correlation=reviewOutputKey:y,deliveryId:y; redaction=privateOnly:y,rawPrompts:n,rawModelOutput:n,candidateBodies:n,replacementText:n,toolPayloads:n,secretLike:n,diffs:n,unboundedArrays:n,unsafeFields:0

  • Files reviewed: 1

  • Findings: 0 critical, 0 major, 0 medium, 0 minor

  • Lines changed: +1 -1

  • Profile: strict (auto, lines changed: 2)

  • Contributor experience: profile-backed (using linked contributor profile guidance)

  • Shadow specialist: lane=docs-config-truth status=skipped reason=no-operator-truth-paths candidateCount=0 decisionCount=0 decisionCounts=candidate:0,duplicate:0,disagreement:0,dismissed:0,unclassifiable:0 duplicateCount=0 disagreementCount=0 dismissedCount=0 unclassifiableCount=0 truncatedCandidateCount=0 metricAvailability=token:n,cost:n,latency:n visiblePublicationDenied=true approvalPublicationDenied=true privateOnly=true shadowOnly=true redacted=raw:n,publication:n,approval:n,unsafe:0 correlationKey=156505900e2de7eb deliveryId=3b000520-67b3-11f1-94b8-b717c1d… reviewOutputKey=kodiai-review-output:v1:inst-10…

  • Review completed: 2026-06-14T05:40:17.009Z

  • Total wall-clock: 2m 5s

  • Phase timings:

    • queue wait: 0ms
    • workspace preparation: 734ms
    • retrieval/context assembly: 4.3s
    • executor handoff: 13s
    • remote runtime: 1m 41s
    • publication: 2.6s
  • Tokens: 26 in / 3,055 out | 0.1162

  • Keyword parsing: No keywords detected

  • Budget behavior: complete (within-budget).

  • Prompt budget: 6 sections, 0 trimmed, 0 bypassed, 0 trimmed tokens.

  • Cache behavior: 2 observations, 1 hits, 1 misses, 0 degraded, 0 bypassed.

  • Continuation behavior: 0 observations, 0 compacted, 0 fallback, 0 degraded, 0 bypassed.

@garbear garbear left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@garbear garbear merged commit 199584b into xbmc:Piers Jun 15, 2026
9 checks passed
@bjsvedin bjsvedin deleted the cache-check-reversal branch July 4, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants