Skip to content

Retry edge 4xx reports, leave out uncounted events, keep the rating answer across older decks - #1934

Merged
BarganConstantin merged 4 commits into
developmentfrom
fix/report-refusals-and-legacy-days
Oct 4, 2026
Merged

BarganConstantin merged 4 commits into
developmentfrom
fix/report-refusals-and-legacy-days

Conversation

@BarganConstantin

Copy link
Copy Markdown
Owner

What changes

  • A 4xx that is not the API's own refusal is retried. Only a 400, 413 or 422 that the API writes as application/problem+json is final for an event. A 403 or 404 that Cloudflare answers with itself (a challenge, a rule, a tunnel being moved) or a proxy's 401 says nothing about the body, so the install with its --ref, "activated" and "rated" stay owed and go out on the existing backoff instead of being dropped. The /v1/app/* routes in ccdeck-api answer a body they will not take only with ValidationProblem, and UseStatusCodePages + AddProblemDetails write the framework's own 400/413 as problem+json too.
  • A day not counted in full leaves events out. A day saved by 3.36.x has no events count. It was read back as 0, so the first "active" after an upgrade said events "0" for a day that had sessions, and an upgrade during the day undercounted that day. Such a day now keeps its events unknown, through restarts too, and the "active" leaves the field out, as a peak of 0 already leaves deckMemory out.
  • The rating question stays answered when an older deck rewrites prefs.json. A 3.36.x deck sharing the data dir (the desktop app before it updates, npx ccdeck@3.36.9) drops every key it does not know when it writes prefs.json, report.rating among them. The question then came back after a week and a second "rated" went out. The outcome is now also kept in rating.json beside prefs.json (0600, install id + the question's state only). At start it is merged back when it is further along than prefs.json says, and only under the same install id. Switching reports off removes it.
  • README: the line under the install command no longer says "nothing about your sessions is reported", which the daily "active" counts made false, or that AGENTS_DECK_NO_REPORTS=1 "turns them off". It now says what a session contains is never reported, what the reports carry, and that the variable keeps them off from the first start. This matches ccdeck.dev.

Verification

  • npm run typecheck: clean.
  • Full suite before the rebase: 883 files, 11567 tests passed (--maxWorkers=3 --minWorkers=1). After rebasing onto Network map key, heartbeat Retry-After, skipped-release tray row, and two narrow-topbar fixes #1933 I reran every reporter, usage-day and rating test file (19 files, 247 tests) and every README test (24 files, 582 tests), and all passed.
  • New regression tests, each run and seen failing for the reason described before its fix:
    • reports-edge-refusal.test.ts: before the fix, a 403/404/401/409 or a non-problem+json 400 marked the install done and cleared the ref. The rating was stored as sent, and the activation as sent. Now each stays owed and goes out once the API answers. A problem+json 400/413/422 is still final.
    • usage-day-legacy-events.test.ts: before the fix, the first "active" over a 3.36.9 save carried events: "0" with sessions: 12, and so did a day upgraded mid-way. Now events is absent. A day counted in full still says its events, zero included.
    • rating-older-deck.test.ts: uses real files in a temp dir. Before the fix, after a 3.36.9-shaped rewrite the question was asked again, an owed answer was lost, and a twice-put-off question came back. Now none of that happens, start() restores the outcome, a different install id is ignored, and switching off removes the file.
  • Repointed: reports-refused-event.test.ts now gives the API's refusals as problem+json. usage-day.test.ts now pins a save with no events count to events: null. readme-order.test.ts pins the new third beat and that the old sentence is gone.
  • Also checked outside the suite: the real v3.36.9 updatePrefs wrote over a prefs.json that 3.37 had written, in a temp home. On the fixed build the next boot did not ask again, sent no second "rated", and wrote the rating back into prefs.json.
  • No UI change, so no browser check.

Only a 400, 413 or 422 the API writes as application/problem+json is final for an event. A 403 or 404 the edge answers with itself, or a proxy's 401, says nothing about the body, so the install with its ref, the activation and the rating stay owed and go out on the existing backoff instead of being dropped.
A day saved by 3.36.x has no events count, and was read back as 0, so the first "active" after an upgrade said events "0" for a day with sessions, and a mid-day upgrade undercounted. Such a day now keeps its events unknown and the "active" leaves them out, as a peak of 0 already leaves deckMemory out.
…drop it

A 3.36.x deck sharing the data dir rewrites prefs.json without the keys it does not know, report.rating among them, so the question came back after a week and a second answer was sent. The outcome is now also kept in rating.json beside prefs.json, under its install id, and merged back at start when it is further along; switching reports off removes it.
…sessions leaves

The daily "active" carries the day's session, subagent and project counts, so "nothing about your sessions is reported" over-claimed, and the deck has no switch to turn the reports off. The line now says what a session contains is never reported, what the reports carry, and that AGENTS_DECK_NO_REPORTS=1 keeps them off from the first start.
@BarganConstantin
BarganConstantin merged commit 61de2ff into development Oct 4, 2026
10 checks passed
@BarganConstantin BarganConstantin mentioned this pull request Oct 5, 2026
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.

1 participant