Skip to content

fix(app-shared): parse glanceable session times with parseTimestamp - #8418

Merged
iscekic merged 2 commits into
mainfrom
drain/parse-glanceable-session-times
Oct 22, 2026
Merged

iscekic merged 2 commits into
mainfrom
drain/parse-glanceable-session-times

Conversation

@iscekic

@iscekic iscekic commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Change

  • packages/app-shared/src/glanceable-agents-snapshot.ts: oldestNeedsInputSince,
    soonestScheduledAt and newestGlanceableResult read each session time through the shared
    parseTimestamp helper and report the selected instant as ISO 8601, the form the snapshot
    schema already declares. One sessionTimeMs helper holds that parse so all three agree.
  • packages/app-shared/src/home-widget.ts: usableTime parses through parseTimestamp; the
    scheduled-agent time, the presented wake and awaitingUpdate read that one parsed instant, and
    the presentation reports the wake as ISO 8601, instead of re-parsing the raw string with
    Date.parse/new Date.
  • Mobile parsers of the same fields use the same helper:
    toIsoStatusTime (apps/mobile/src/lib/active-sessions-live.ts), the Android Home
    scheduled-agent time (apps/mobile/src/glanceable-android/home-copy.ts), and isOlderThanCard
    (apps/mobile/src/glanceable-ios/session-card-facts.ts).

Unparseable and absent values keep their current behavior: the row is skipped for the wait,
wake and newest-result facts, and null reaches the presentation.

Verification

  • pnpm --filter @kilocode/app-shared run test: 503 tests pass. New PostgreSQL-format fixtures
    (2026-03-16 15:21:40.957+00, 2026-10-09 11:00:00+00) cover the waiting order, the soonest
    wake, the newest result, a restored snapshot wake, awaitingUpdate and the snapshot fields.

  • Failing before the fix: with the previous source files restored, the same suites fail 6 tests
    (the snapshot fields returned the producer's raw form). After the fix they pass.

  • pnpm --filter kilo-app exec vitest run --project mobile-pure: 877 files, 14469 tests pass;
    the glanceable, Home and active-session suites rerun after the review fix: 81 files, 1285
    tests pass.

  • The web producer that builds the same snapshot reads the changed helpers:
    pnpm --filter web exec jest src/lib/glanceable-agents-snapshot-server.test.ts: 17 tests pass.

  • pnpm --filter @kilocode/app-shared run typecheck and pnpm --filter kilo-app run typecheck
    pass; oxlint on the changed sources reports no findings; oxfmt applied.

  • Behavior smoke on the pure functions with PostgreSQL-format rows and Date.parse patched to
    reject non-ISO input (a parser with the Hermes limitation):

    oldestNeedsInputSince : 2026-03-16T15:21:40.957Z
    soonestScheduledAt    : 2026-03-16T16:05:00.500Z
    newestGlanceableResult: {"kind":"needsInput","at":"2026-03-16T15:30:00.000Z"}
    home.waitingAgents    : Oldest wait, Later question
    home.scheduledAgents  : Soonest wake 2026-03-16T16:05:00.500Z, Later wake 2026-03-16T18:00:00.000Z
    home.awaitingUpdate   : true
    

    The same run with the unpatched parser reports identical values, so the policy reads the same
    instants under both parsers.

Device execution: Android emulator running the dev client, Metro, the local dev stack and a local
test account on the same machine. The glanceable builder received one scheduled
row whose wake time is PostgreSQL timestamp text (2099-03-16 15:21:40.957+00). The ongoing
notification card drew 1 Scheduled with the wake line Next run 3/16/99, 3:21 PM. With the same
row and home-widget.ts plus glanceable-agents-snapshot.ts at their base revision, the same card
drew 1 Scheduled and no wake line, because the device parser returns no instant for that text
form. The row came from the app's dev-only glanceable fixture harness, entered as a local catalog
entry that is not part of this branch; the harness, the shared builder, the render path and the
native card are the shipped ones. Captures are attached to this pull request. The waiting order,
the newest-result fact and awaitingUpdate read the same parser and are covered by the fixtures
above; the card renders the wake only, not the wait order.

Review follow-up

  • The presentation now emits the parsed wake as ISO 8601, so a snapshot restored with a raw
    producer value still reaches the iOS widget's date formatting in canonical form.
  • The date-only fixture asserts the canonical form of the parsed instant rather than success,
    which keeps it correct under the pending date-only rule in fix(app-shared): parse date-only strings as calendar days #8181.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: Fix shape: The snapshot fields needsInputSince/scheduledAt/newestResultAt are declared ISO 8601, but the helpers currently echo the producer's raw string. Which shape should this PR take?
    Answer: Parse with parseTimestamp + normalize snapshot timestamps to ISO
    Confidence: 0.72 · Precedent: Proof and verification: require valid end-to-end proof on every PR (session 55c9c80332a7, "logs and/or screenshots are mandatory proof"). Autonomy: fix the root cause and the class (session 7f3470e0ba6f, "fix class of issue").
  2. Question: Same-class spots: Other Date.parse uses of the same fields sit outside the finding's files: apps/mobile/src/lib/active-sessions-live.ts toIsoStatusTime (statusUpdatedAt producer normalization), components/home/home-copy.ts:79 (scheduled-agent time), glanceable/session-card-facts.ts:74-75. Include them?
    Answer: Yes, convert the same-field mobile parsers too
    Confidence: 0.60 · Precedent: Autonomy: fix the class of the issue on every affected surface (session 75f8833fe8c1, "fix this for all shared services model pickers on all surfaces (web, app)"). Also: if you see a gap, fix it (session 89824a222897, "if you saw a gap, fix it").

The Home widget details and the glanceable snapshot read session status and
wake times through the shared Hermes-safe parser, and the snapshot reports the
selected instants as ISO 8601, the form its schema declares.

The mobile parsers of the same fields use the same helper.
@iscekic iscekic added drain Work item from the findings drain janitor:features-workflows Janitor finding family: features-workflows labels Oct 21, 2026
Comment thread packages/app-shared/src/home-widget.ts Resolved
@kilo-code-bot

kilo-code-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Both prior findings are fixed at cf62d18: the presentation now emits the parsed wake as canonical ISO 8601, and the date-only fixture asserts the parser's instant; the incremental diff (3 files, 13 insertions) introduces no new issues.

Files Reviewed (3 files)
  • packages/app-shared/src/home-widget.ts
  • packages/app-shared/src/home-widget.test.ts
  • packages/app-shared/src/glanceable-agents-snapshot.test.ts

Previously raised findings on home-widget.ts:215 and the date-only snapshot test are resolved; no unresolved findings remain.

Previous Review Summary (commit 42e3a5b)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 42e3a5b)

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The parse/normalize fix is sound and well covered at the policy layer; the one contract gap is that HomeWidgetPresentation.scheduledAt is still the raw producer string, so a restored legacy snapshot emits PostgreSQL text where ISO 8601 is expected.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/app-shared/src/home-widget.ts 215 scheduledAt returns snapshot.scheduledAt verbatim instead of the parsed instant, so a restored snapshot can carry the PostgreSQL form into a field consumed as ISO 8601

SUGGESTION

File Line Issue
packages/app-shared/src/glanceable-agents-snapshot.test.ts 653 The date-only test asserts only non-null, which the pre-fix code also satisfied; assert the exact instant
Files Reviewed (7 files)
  • apps/mobile/src/glanceable-android/home-copy.ts - 0 issues
  • apps/mobile/src/glanceable-ios/session-card-facts.ts - 0 issues
  • apps/mobile/src/lib/active-sessions-live.ts - 0 issues
  • packages/app-shared/src/glanceable-agents-snapshot.test.ts - 1 issue
  • packages/app-shared/src/glanceable-agents-snapshot.ts - 0 issues
  • packages/app-shared/src/home-widget.test.ts - 0 issues
  • packages/app-shared/src/home-widget.ts - 1 issue

Notes outside the changed lines (not counted above): packages/notifications/src/session-live-activity.ts:66 (isoOrNull, which builds the statusSince/scheduledAt side of the session card) and apps/mobile/src/lib/glanceable/front-approval.ts:43 / waiting-ask.ts:82 still parse the same session fields with Date.parse, so the same-class gap persists for those call sites. No markdown files were changed in this PR; the new code is pure parsing/formatting and introduces no listeners or retained resources, so no memory-leak risk was found.

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash-1017 · Input: 40.9K · Output: 3.5K · Cached: 266.1K

Review guidance: REVIEW.md from base branch main

…tation

The presentation reports the parsed wake as ISO 8601 instead of echoing a
restored snapshot value, so every consumer parses one canonical form.

The date-only fixture now pins the canonical form rather than success.
@iscekic iscekic added merge:blocked merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. merge:blocked:insufficient-e2e Verification does not cover the change and removed merge:blocked labels Oct 21, 2026
@iscekic

iscekic commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android card drawn from the glanceable snapshot built on the device, with the session wake time in PostgreSQL timestamp text.

  • 01-wake-parsed.png — the ongoing agent card draws 1 Scheduled and the wake line Next run 3/16/99, 3:21 PM from a wake of 2099-03-16 15:21:40.957+00, read on the device.
  • 02-wake-unparsed.png — the same row with the two shared modules at their base revision: 1 Scheduled, no wake line.

Both frames come from the dev client on the emulator against Metro and the local dev stack on the same VM. The row was entered through the app's dev-only glanceable fixture harness as a local catalog entry that is not part of this branch.

Ongoing agent card showing the scheduled wake time read from a PostgreSQL timestamp

Same card with the shared modules at their base revision, no wake line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain janitor:features-workflows Janitor finding family: features-workflows merge:bot Bot-owned review; merge when ready once readiness passes and a review approves.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants