Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Upgrade: Anthropic.ts silently skips releases when more than 5 land between checks (fixed per_page=5 / per_page=10)

Open cristbc opened this issue 2 months ago • 2 comments

Version

LifeOS 7.40.4 (main @ 5e2f2e8).

What is broken

fetchGitHubRepo in the Upgrade skill asks GitHub for one fixed page, releases?per_page=5 and commits?since=…&per_page=10, then walks that page until it hits the last-seen tag or SHA. When more releases than that land between two checks, the older ones never show up in the report, and the saved state jumps past them anyway. Claude Code ships close to daily, so a week or so between runs is enough. On a 12-day gap it reported v2.1.275 through v2.1.280 and missed v2.1.269 through v2.1.274, which is where the Monitor persistent removal and the omitClaudeMd agent field landed.

Where (file:line)

  • LifeOS/install/skills/Upgrade/Tools/Anthropic.ts:238 (commits)
  • LifeOS/install/skills/Upgrade/Tools/Anthropic.ts:275 (releases)

Suggested fix

Page until the last-seen item or the since window, with a page cap. One small helper covers both calls:

export async function pageUntil<T>(
  fetchPage: (page: number) => Promise<T[] | null>,
  stop: (item: T) => boolean,
  maxPages = 5,
): Promise<T[]> {
  const out: T[] = [];
  for (let page = 1; page <= maxPages; page++) {
    const items = await fetchPage(page);
    if (!items || items.length === 0) break;
    for (const item of items) {
      out.push(item);
      if (stop(item)) return out;
    }
  }
  return out;
}

For releases, stop on the last-seen tag or on published_at < since, and drop anything older than the window. With the last-seen tag set back 12 releases, the paged version reported all 11 tags published in that gap (v2.1.279 was never published); the fixed page reported 5.

main() also runs on import. Guarding it with if (import.meta.main) lets the helper be unit-tested.

cristbc avatar Sep 22 '26 19:09 cristbc

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed against HEAD — both the commits and releases fetches were single fixed-page calls (per_page=5/10) with no pagination, so anything beyond a page landing between two checks was silently dropped, and main() ran unconditionally at module scope with no import.meta.main guard. Added a pageUntil() helper that walks pages until the last-seen item is found (capped at 5 pages) and guarded the top-level call. Verified via isolated unit test with mocked pagination and a clean bun build.

Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.

waveman2020-sudo avatar Sep 23 '26 19:09 waveman2020-sudo

Thanks @cristbc. Following up on the page-size fix: the Anthropic source now pages until it reaches the last-seen item, or on a first run the time window, with a cap of five pages. More than 100 new commits or releases between checks no longer drop. There are tests with a stubbed fetch. This goes out in the next public release (8.3.0).

danielmiessler avatar Sep 29 '26 02:09 danielmiessler