Conversation
BREAKING CHANGE: `maxRetries` is now required on both `FillOptions` and `LiveAgentConfig`. Callers must explicitly specify the retry count (0 for no retries, 2–3 for production). This prevents downstream libraries from unknowingly inheriting a default retry policy, which has been a source of bugs. Changes: - Remove `DEFAULT_MAX_RETRIES` constant from settings.ts - Make `maxRetries` required (not optional) on `FillOptions` and `LiveAgentConfig` interfaces - Remove fallback `?? DEFAULT_MAX_RETRIES` in LiveAgent constructor - Pass `maxRetries` directly in programmaticFill.ts (not conditionally) - CLI fill/run/research commands explicitly pass `maxRetries: 3` - Fix test-live-agent.ts script to pass explicit `maxRetries: 3` to `generateText()` (was using AI SDK's own hidden default of 2) - All test calls updated to pass `maxRetries: 0` https://claude.ai/code/session_01Df5orNck9FRQ8sZMkqPRyU Co-Authored-By: Claude <noreply@anthropic.com>
…flag - Add CLI_DEFAULT_MAX_RETRIES = 3 in settings.ts as the single source of truth for the CLI retry default value - Add --max-retries <n> CLI flag to fill and research commands - Replace all 5 hardcoded `maxRetries: 3` values with the constant - Update JSDoc on FillOptions/LiveAgentConfig to mention the AI SDK default (2) while keeping the field required - TypeScript API remains explicit (no default) — CLI has one constant Co-Authored-By: Claude <noreply@anthropic.com> https://claude.ai/code/session_01Df5orNck9FRQ8sZMkqPRyU
Coverage Report for packages/markform
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
jlevy
left a comment
There was a problem hiding this comment.
Senior Engineering Code Review
Summary
Clean, well-scoped refactoring that eliminates hidden defaults and makes the retry policy explicit everywhere. The breaking change is the right call — TypeScript should enforce that callers think about retries. The single-constant-for-CLI pattern is exactly the right level of DRY.
Strengths
- Excellent single-source-of-truth discipline:
CLI_DEFAULT_MAX_RETRIES = 3insettings.tsis the ONE place the value lives. Zero hardcoded3anywhere else. This is the gold standard for magic numbers. - Clean API boundary:
CLI_DEFAULT_MAX_RETRIESstays internal (not exported fromindex.ts), while the public types (FillOptions,LiveAgentConfig) simply require the number. Good separation. - JSDoc mentions AI SDK default (2): Telling callers "the SDK default is 2, we use 3" gives them the context to make an informed choice without having to read SDK source.
- Tests use
maxRetries: 0: The right choice — tests shouldn't retry, and this makes that explicit rather than relying on a mock path that happens to skip retries. - Commander flags show the default in help text:
--max-retries <n>with(default: 3)is exactly what CLI users expect.
Issues
None blocking.
Nits (non-blocking)
-
Style inconsistency between
fill.tsandresearch.ts:fill.ts:398usesoptions.maxRetries!(non-null assertion)research.ts:167usesoptions.maxRetries as string(type assertion)
Both are safe (Commander default guarantees the value), but the style is inconsistent. The
!approach is more idiomatic for Commander options with defaults. Minor — not worth a follow-up commit.
Documentation
- No public docs (
development.md) reference the removed constant — no updates needed. - Active specs reference
maxRetriesin design context — correct as historical artifacts. CLI_DEFAULT_MAX_RETRIESis correctly NOT exported from public API (index.ts).
CI Status
- test: pass (3m36s)
- Cursor Bugbot: pass (6m2s)
All checks green.
Verdict
Approve. This is a well-executed breaking change with thorough test coverage (all ~60 call sites updated) and clear documentation of the breaking nature via conventional commit prefix (refactor!:).
Summary
Makes
maxRetriesa required field on the TypeScript API (FillOptions,LiveAgentConfig) so callers must choose their retry policy explicitly. Introduces a singleCLI_DEFAULT_MAX_RETRIES = 3constant as the sole source of truth for CLI commands, and adds a--max-retriesflag tofillandresearchcommands.Changes
Breaking: TypeScript API
FillOptions.maxRetrieschanged fromoptionaltorequired numberLiveAgentConfig.maxRetrieschanged fromoptionaltorequired numberDEFAULT_MAX_RETRIESconstant (was the hidden default for the optional field)config.maxRetries ?? DEFAULT_MAX_RETRIESin LiveAgent constructorprogrammaticFill.ts— no more conditional spread, just direct pass-throughNew: CLI default constant
CLI_DEFAULT_MAX_RETRIES = 3insettings.ts— the ONE place the value livesfill,run,research,test-live-agent.ts) reference this constantmaxRetries: 3anywhere in the codebaseNew:
--max-retriesCLI flagfillandresearchcommands with Commander default from the constantruncommand uses the constant directly (it's an interactive launcher, no flag needed)JSDoc improvements
FillOptions.maxRetriesandLiveAgentConfig.maxRetriesnow document:Test updates
maxRetries: 0explicitly (tests shouldn't retry)CLI_DEFAULT_MAX_RETRIES === 3DEFAULT_MAX_RETRIESTest Plan
pnpm testpnpm typecheckmaxRetries: 3in any.tsfile (verified via grep)CLI_DEFAULT_MAX_RETRIESis the sole occurrence of the value3in retry contextmarkform fill --helpshows--max-retrieswith defaultmarkform research --helpshows--max-retrieswith defaultmarkform fill --max-retries 0overrides the defaultmaxRetriesomitted fromfillForm()callRelated Beads
None — this was a direct user request for API hygiene.
https://claude.ai/code/session_01Df5orNck9FRQ8sZMkqPRyU
Note
Medium Risk
This is an API-breaking type change that touches core harness/agent construction and all call sites; runtime behavior is mostly unchanged but missing/incorrect
maxRetriesplumbing could cause compile failures or unexpected retry behavior in consumers.Overview
Breaking change:
maxRetriesis now required on the TypeScript API (FillOptions,LiveAgentConfig), removing the implicitDEFAULT_MAX_RETRIESfallback and forcing all callers (including internal harness paths) to pass an explicit retry policy.Adds
CLI_DEFAULT_MAX_RETRIES = 3as the single CLI source of truth and wires it through CLI entrypoints (fill,research,run,scripts/test-live-agent.ts), including new--max-retriesflags onfillandresearch; tests are updated to passmaxRetries: 0explicitly to keep retries disabled in test runs.Written by Cursor Bugbot for commit 5fa04cc. This will update automatically on new commits. Configure here.