think: allow a per-instance submissionRecoveryStaleMs (900 s default equals the alarm wall)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start from the stale-window read at dist/think.js:7156 (this.constructor.submissionRecoveryStaleMs) and _recoverSubmissionsOnStart around :7099-7114. Prefer an instance submissionRecoveryStaleMs (or a protected getter) over the static default of 900000 ms, then expose it in the typings. Done when mixed agent instances in one Durable Object class can use different cutoffs without a class-wide override.
Written by the indexing model from the issue text.
Description
Summary
@cloudflare/think 0.20.0 reads its stale-submission window only from the class: this.constructor.submissionRecoveryStaleMs (dist/think.js:7156, declared protected static, default 900 * 1e3 at :11276). One Durable Object class cannot use different windows for different kinds of agent instances.
Why it matters
The default (900 s) equals the Durable Object alarm wall limit (15 min). A submission whose turn starts with its alarm and runs until the wall cut is always older than 900 s at the next wake. _recoverSubmissionsOnStart (think.js:7099-7114) then marks it error ("Submission was interrupted after messages were applied.") before chat recovery runs, although chat recovery goes on to continue the same turn. Code that reacts to the submission status sees a terminal error for a turn that later completes.
We hit this with long-running background agents (helpers that read documents for 10+ minutes). For interactive chat agents, the 900 s default is right, so a class-wide override is wrong for us: both kinds share one class.
Request
Let an instance choose the window, for example by reading an instance value first:
const cutoff = Date.now() - (this.submissionRecoveryStaleMs ?? this.constructor.submissionRecoveryStaleMs);
with a protected get submissionRecoveryStaleMs(): number | undefined in the typings, or an equivalent protected hook. We carry this one-line change as a pnpm patch until a release exposes it.
Environment
@cloudflare/think 0.20.0, agents 0.25.0, Workers with EU jurisdiction Durable Objects.
- Dominant language
- TypeScript
- Stars
- 5.8k
- Forks
- 775
- Avg merge
- 20h 44m
- Merged PRs (30d)
- 165
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/agents
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
cloudflare/agents#2503 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cloudflare/agents#2482 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
cloudflare/agents#2376 · 3 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
Alarm memory-limit breaker (#1825) never trips after a DO memory-limit reset: strike counter can't be persisted, recovery loops indefinitelyPossibly taken @mattzcarey claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cloudflare/agents#2613 ·
Maintainers usually reply within 1 day
-
PiHarness.submit: allow pi-durable's `entry` (InputEntry) so hosts can label non-user inputsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
cloudflare/agents#2611 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudflare/agents
Similar issues
-
engine-rs P3 review-deferral wasm
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
maniator/verticopolis#1154 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
telerik/kendo-react#3861 ·
Maintainers usually reply within 1 day
-
[bug]: use-mobile.ts uses pixel logic, causing UI state de-sync with Tailwind CSS rem breakpointsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100