GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved · Issue #4739 · developing-today/code

opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739

New issue
Copy link
New issue
Copy link
Closed
#6810
Closed
opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved#4739
#6810
Copy link
Assignees
dezren39
Labels
app/opencode-usage-exportPackage/app: opencode-usage-export (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientqueue/queuedHas a queued queue tasksource/creatorFiled by the new-issue-creator jobstatus/in-progressQueue worker lifecycle statetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Description

@dezren39
dezren39
opened on Nov 3, 2026
Issue body actions

opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status: "ok" document, a junk freshness reports a fresh store as moved

pm-stack/opencode-usage-export/opencode-usage-export.mjs (slice 1 of #2072, merged in PR #4680) parses its two numeric flags with a bare Number(...) and never checks the result:

  • parseArgs (:311-322): --window-hours → Number(argv[++i]) (:317), --fresh-hours → Number(argv[++i]) (:318). No finite/positive check; a missing value is Number(undefined) = NaN; an unknown flag throws, but a known flag with a bad value does not.
  • The window flows unchecked into sinceMs = now - args.windowHours * 3600000 (:348) and the session query WHERE time_updated >= ? (:221 via :349).
  • The freshness flows unchecked into freshMs: args.freshHours * 3600000 (:343) and the liveness comparison now - p.newestUpdated <= freshMs (:165).

Verified this run (laptop probe, verbatim origin/main @ cf74b1e, file md5 13c24364)

Fixture store with one fresh session (updated 1 min before now) and one 48 h-old session, exporter extracted byte-identical from origin/main (~/git/fleet/probe-2026-11-02-laneA-usagewindow/ on the laptop):

Invocation Result
control (defaults) exit 0, status: "ok", 1 session
--window-hours banana exit 0, status: "ok", 0 sessions, windowHours: NaN
--window-hours (value missing) exit 0, status: "ok", 0 sessions, windowHours: NaN
--window-hours -5 exit 0, status: "ok", 0 sessions
--window-hours Infinity exit 0, status: "ok", 2 sessions — the 48 h-old session outside any real window is included
--fresh-hours banana exit 4, store-stale: "no candidate store has session_v2 activity within NaNh; newest activity [1 minute ago] — the live store may have moved"
--fresh-hours -1 exit 4, store-stale, same misleading moved-store diagnosis for a store updated 1 minute ago

Why it matters

The module's own contract is fail-closed: the header (:29-31) promises a tick that cannot read the live store "writes a failure document and exits non-zero — never a zero-filled success", and the README repeats that a failed tick can never look like a reading. An invalid --window-hours breaks exactly that promise: latest.json becomes a status: "ok" document with zero sessions and zero totals, indistinguishable downstream (slices 2–7 of #2072 consume this document) from "OpenCode was genuinely idle for 24 h". An invalid --fresh-hours fails closed but with the wrong diagnosis — it tells the operator the store moved when the store is fine and the flag is wrong, sending them hunting for a moved database. The systemd unit passes neither flag today, so this bites manual ticks, debugging runs, and any future unit/timer change that starts passing them.

Distinct from #1566 (meta-exporter window_duration_secs, a different tool, closed) and #4381 (cloudflare-export threshold accepting 0): no open or closed issue covers this exporter's argument validation (searched usage-export in:title, --window-hours, exporter/NaN, 2026-11-02).

Acceptance criteria

  • --window-hours and --fresh-hours values that are missing, non-numeric, NaN, infinite, zero, or negative are rejected before any store read: a failure document with a status/detail that names the invalid argument (not store-stale), and a non-zero exit.
  • A valid positive finite value behaves exactly as today (existing tests green).
  • New tests in opencode-usage-export.test.mjs cover at least: junk window, missing window value, negative window, junk freshness — each asserting no status: "ok" document is produced and the failure detail names the bad argument.
  • No ok document can ever carry a non-finite or non-positive windowHours.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    queue/queuedHas a queued queue task
    effort/xsTrivial: expected under 30 minutes of work
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    app/opencode-usage-exportPackage/app: opencode-usage-export (pm-stack in this repo)
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    dezren39
    on Nov 3, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a run 2026-11-02 20:35 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop against origin/main @ cf74b1e (probe-2026-11-02-laneA-usagewindow): junk/missing/negative --window-hours publishes a zero-filled status:"ok" document; junk --fresh-hours misreports a fresh store as moved/stale. Enqueued as a repo-task/v1 triage packet on repo-health-code-pilot.
    • Expectation: effort/xs — validate both numeric flags (finite, positive) in parseArgs before any store read, fail with an argument-naming failure document, add regression tests per the issue's acceptance criteria.
    • Links: packet creator-a-2026-11-02-2035/packets/packet-4739-triage.json (hidden_files)
  3. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 3, 2026
  4. 61 remaining items

  5. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    Picked up as task 8444 by lane code-c (repo-queue worker) and handed off to the opencode execution lane per the execution-lane assignment for task 8444. The laptop claimant launches the bound opencode session for task 8444; this lane does not work issue #4739 directly. Note: task 8444 is at attempts 19/32.

  6. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-c
    • Session / ID: task 8444
    • Found via: queue claim
    • Task: Fix issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 — revalidated fresh (open, no hard-stop labels, labels already queue/claimed + status/in-progress); execution lane assigned opencode, handing off to claimant. Attempts 20/32.
    • Expectation: claimant launches the bound opencode session to drive task 8444 to a terminal state.
    • Links: issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739
  7. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-t
    • Session / ID: task 8444
    • Found via: queue claim
    • Task: task 8444 (small_fix) for issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 was assigned to the opencode execution lane; handing off to the opencode claimant. Issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 verified OPEN fresh with no hard-stop labels; PR fix(usage-export): validate hours flags (#4739) #4790 is OPEN for this issue — claimant session should reconcile that PR rather than create a competing one.
    • Expectation: the claimant launches the bound opencode session for task 8444; that session drives issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 to its terminal state.
    • Links: issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 · PR fix(usage-export): validate hours flags (#4739) #4790
  8. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · handed off

    • Agent: queue worker (repo-worker-code), lane code-a
    • Session / ID: task 8444
    • Found via: queue claim · repo-health-code-pilot
    • Task: task 8444 (small_fix, issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739) claimed by lane code-a and assigned to the opencode execution lane; handing off to the laptop opencode claimant, which launches the bound session. Fresh check: issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739 OPEN (fresh gh check this shift), no hard-stop labels, no open PR found.
    • Expectation: done = task 8444 acceptance met for issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739.
    • Links: issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739
  9. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    🤖 Agent note · correction

    • Agent: queue worker (repo-worker-code), lane code-a
    • Session / ID: task 8444
    • Correction: the handed-off note above for task 8444 (issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739) said "no open PR found" — that was wrong. Fresh gh pr list --search 4739 in the same check returned open PR fix(usage-export): validate hours flags (#4739) #4790 "fix(usage-export): validate hours flags (opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739)", which appears to own this fix. The bound opencode session should evaluate/advance PR fix(usage-export): validate hours flags (#4739) #4790, not open a competing PR. The handoff itself stands.
    • Links: issue opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739, PR fix(usage-export): validate hours flags (#4739) #4790
  10. dezren39 commented on Nov 5, 2026

    @dezren39
    dezren39
    on Nov 5, 2026
    MemberAuthor
    More actions

    agent-note:v1
    state: handed off
    task: 8444 (repo-health-code-pilot, worker repo-worker-code)
    session: ses_e5e5589f378ffejE3h9MHlWsSx
    found via: queue claim; execution lane opencode
    launch: session created on the laptop OpenCode server at verified primary location /home/user/git/code, bound atomically before the prompt was sent.
    next: the bound session revalidates issue #4739 and current main, works only this task, heartbeats, and records the terminal outcome with the same session ID.
    links: task 8444 · issue #4739

  11. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Picked up by repo-worker-code-f — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-f posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  12. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Progress from repo-worker-code-f: implementation_complete: parseHourFlag validation + run() fail-closed routing; 9/9 tests pass on laptop (node --test file form); next: commit + PR

  13. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    🤖 Agent note · fixed — PR #6810 open, remainder: merge on green CI

    • Agent: queue worker lane F (repo-worker-code-f), fallback claim (queue backend down, code#6619)
    • Fix: PR fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739) #6810, branch queue/4739-usage-export-arg-validation, commit 761c60f744. --window-hours/--fresh-hours now go through parseHourFlag (missing / non-numeric / NaN / infinite / zero / negative → ExportError("invalid-argument", exit 2) naming the flag, before any store read); run() routes argument errors to a failure document routed to --out-dir when parsed, instead of an uncaught throw. Valid values behave exactly as before.
    • Tests: 5 new cases in opencode-usage-export.test.mjs (junk window, missing window value, negative window, junk freshness, valid-value control). Laptop run (node v24, file form): 9/9 pass (4 pre-existing + 5 new). The directory form of node --test fails identically on clean main — pre-existing, untouched.
    • Remainder (why released free, not done): PR fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739) #6810's CI had not completed within the poll window (fleet CI is heavily backlogged tonight; PR docs(aggregator): success-only memoization contract + highlight latch fix (#3880) #6796's checks are likewise still queued). Next worker: check PR fix(opencode-usage-export): validate --window-hours/--fresh-hours (#4739) #6810 (incl. Codex findings — disposition any before merging); if green, merge and close opencode-usage-export: --window-hours / --fresh-hours are never validated — a junk window publishes a zero-filled status:ok document, a junk freshness reports a fresh store as moved #4739. The branch and tests are final; do not redo the fix.
  14. developing-today commented on Nov 7, 2026

    @developing-today
    developing-todayBot
    on Nov 7, 2026 – with developing.today
    Contributor
    More actions

    Released by repo-worker-code-f (outcome: free). Fixed in PR #6810 (parseHourFlag validation, fail-closed invalid-argument doc, exit 2; 9/9 module tests pass on laptop). REMAINS: merge PR #6810 when CI green (disposition Codex findings first), then close #4739.

  15. developing-today
    added
    queue/queuedHas a queued queue task
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 7, 2026
  16. dezren39
    added a commit that references this issue on Nov 8, 2026

    Merge pull request #6810 from developing-today/queue/4739-usage-expor…

    4113bf0
  17. dezren39
    closed this as completedin #6810on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/opencode-usage-exportPackage/app: opencode-usage-export (pm-stack in this repo)app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientqueue/queuedHas a queued queue tasksource/creatorFiled by the new-issue-creator jobstatus/in-progressQueue worker lifecycle statetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.