Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ Each macro (protein, carbs, fat, alcohol) is added as a separate "Quick Add" foo
4. Click "Add Food..." in context menu
5. Search for the macro (e.g. "Quick Add, Protein")
6. Click SEARCH, select the result
7. Enter serving size in grams
8. Click "ADD TO DIARY"
9. Repeat for each macro
7. Wait (up to 10s) for the food details to load inside the dialog; if the dialog closes early or stalls, re-open and re-select (up to 3 attempts)
8. Enter serving size in grams (inputs and buttons are scoped to the Add Food dialog, never the diary behind it)
9. Click "ADD TO DIARY" and confirm a new diary entry appeared (existing entries of the same macro are never edited)
10. Repeat for each macro

**Date navigation note:** Cronometer's GWT hash routing does not support `?date=` query params. Date changes use prev-day arrow clicks (same approach as `diary` and `weight` commands), capped at 90 days back.

Expand Down
9 changes: 5 additions & 4 deletions src/automation/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type {
WeightData,
} from "./types.js";

const QUICK_ADD_SECONDS_PER_MACRO = 60;
const QUICK_ADD_SECONDS_PER_MACRO = 150;
const QUICK_ADD_SETUP_TIMEOUT_SEC = 60;
const QUICK_ADD_SECONDS_PER_DATE_STEP = 2;
const MAX_QUICK_ADD_DATE_STEPS = 90;
Expand All @@ -37,9 +37,10 @@ const AUTO_LOGIN_TIMEOUT_SEC = 120;
* 60-second timeout can therefore save the first macro and abort while adding
* the next one, leaving a partial (and unsafe to retry) diary entry.
*
* Allow one minute to load and prepare the diary, one minute per macro, plus
* the two-second delay used for each previous day navigation step in
* buildQuickAddCode.
* Allow one minute to load and prepare the diary, two and a half minutes per
* macro (each macro may re-open the Add Food dialog up to three times if it
* closes before the food details load), plus the two-second delay used for
* each previous day navigation step in buildQuickAddCode.
*/
export function getQuickAddTimeoutSec(
entry: MacroEntry,
Expand Down
8 changes: 4 additions & 4 deletions src/kernel/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ import { getCredential } from "../credentials.js";
* Client-side HTTP timeout for Kernel API requests.
*
* The SDK defaults to 60s, but automations are dispatched with `timeout_sec`
* values up to 480s (see multi-macro retroactive quick-add). When the client gives up first the
* values up to 840s (see multi-macro retroactive quick-add). When the client gives up first the
* browser keeps going, so Cronometer commits the change while crono reports
* failure — and a retry then duplicates the data. Keep this comfortably above
* the largest `timeout_sec` used by any automation.
*/
const KERNEL_REQUEST_TIMEOUT_MS = 10 * 60 * 1000;
const KERNEL_REQUEST_TIMEOUT_MS = 20 * 60 * 1000;

/**
* Lifetime of a remote browser session.
*
* A single command can spend up to 120s logging in before a multi-macro quick-add
* starts. Quick-add may need up to 480s for setup, four macros, and 90 date
* starts. Quick-add may need up to 840s for setup, four macros, and 90 date
* steps, so
* leave enough room for both login and the operation.
*/
const BROWSER_SESSION_TIMEOUT_SEC = 900;
const BROWSER_SESSION_TIMEOUT_SEC = 1200;

export type KernelClient = AutomationClient;
export type {
Expand Down
Loading
Loading