#5761·gbrain

0.60.11.0 managed: doctor's extract --stale step never converges (one unresolved attendee keeps a calendar page stale forever; the job has no long wall-clock budget)

Author: andreineacsuCreated Sep 30, 2026Updated Sep 30, 2026

Environment: gbrain 0.60.11.0 (f8d1e3936), macOS, bun 1.3.14, Postgres 17, managed persistence, serve --http, gbrain-base-v2 pack. Four Google connector sources plus default. Upgraded from 0.60.10.0 today, schema at v178.

What I ran

The post-upgrade flow from skills/migrations/v0.60.11.0.md, step 4. gbrain doctor --remediation-plan listed step 2 [high] extract ("Materialize link + timeline edges for 4642 stale database pages") with:

run: gbrain jobs submit extract --params '{"stale":true}' --follow

With the operator's agreement I ran that exact command.

Observed

Wall-clock detector: dead-lettered 1 jobs (wall-clock timeout exceeded)
Lock lost for job 20501, aborting execution (cause: fenced-lost, via: renewal [...])
Extract --stale: 0 link(s) created, 0 removed, 8 timeline entr(ies) from 2357 page(s). Skipped 4635 page(s) edited during extraction or with unresolved attendance; they stay stale. 4635 page(s) remain stale.
Job 20501 completion dropped (lock token mismatch, job was reclaimed)
Job #20501 dead: wall-clock timeout exceeded

gbrain jobs get 20501 reports the timeout as unset, so the null-default wall-clock sweep applies; started 09:44:06Z, dead 09:47:06Z. A second doctor --remediation-plan lists the same step again, now for 4635 pages. Nothing on this brain was edited during the run, so the skips are the attendance branch.

Code-level cause

Two independent problems. Each alone keeps this remediation step from converging.

1. One unresolved attendee keeps a whole page stale, permanently

  • extractPageLinks sets attendanceComplete = false when any attendees frontmatter entry does not resolve (src/core/link-extraction.ts:1754, :1763).
  • prepareAutomaticLinks then returns errors: 1 for the page (src/core/persistence/links-preparation.ts:63), so none of its links are written, not only the attendance edge.
  • extractManagedStaleLinks counts it as skipped and does not stamp links_extracted_at (src/core/persistence/links-maintenance.ts:70), so every later extract --stale visits it again with the same result.
  • resolveAttendance only looks in the page's own source (WHERE source_id=$1 ... AND type='person', src/core/link-extraction.ts:1499) and matches slug, title or aliases.

On this brain the stale pages are Google Calendar event pages (type meeting, attendees = email addresses) in the connector sources:

Calendar event pages in connector sources Count
extracted, with attendees 372
extracted, no attendees 221
never extracted, with attendees 4315

On a sample of 200 of the never-extracted pages: 1670 attendee entries, 816 unresolved, and every page has at least one. Those 816 entries are only 13 distinct addresses. 8 of the 13 have a person page carrying that address as an alias, but in the default source, which the same-source lookup never searches. Recurring series expand into many instances, so a handful of people living in another source block thousands of pages. (The counts come from my SQL approximation of the resolver query: exact slug forms, title and aliases. It is not a trace of the resolver itself.)

2. extract has no long-job wall-clock budget

HANDLER_DEFAULT_TIMEOUT_MS (src/core/minions/handler-timeouts.ts:56) has no extract entry. The remediation plan submits the job without --timeout-ms, so a brain-wide pass inherits the short null-default and is dead-lettered after about 3 minutes, with the lock lost mid-run. This is the same shape as #3207 (facts-absorb missing from the same map).

Smaller point

With --include-repairs, the plan prints Apply everything after the user agrees: gbrain doctor --remediate --yes --include-repairs --max-usd .... When the score target is unreachable, that command prints Job steps are skipped; repair steps still run. (src/commands/doctor/remediate.ts:268). So "everything" silently excluded the embed and extract steps, and I had to submit them by hand.

Expected

  • A page whose attendance cannot be fully resolved still gets its other derived links and a watermark, or at least reaches a terminal state that extract --stale and doctor stop re-counting.
  • Attendance resolution for connector-sourced calendar pages can reach person pages in the source where the people live (or the gap is documented).
  • extract jobs submitted by the remediation plan get a budget that fits a brain-wide pass.

Question

Is the all-or-nothing attendance gate intended to hold back every other link on the page? If it is, what is the supported way to make these calendar pages converge on a managed brain?

Related: #5499 (managed extraction paths behind serve --http), #5280 (fixed in 0.60.11.0; the job now runs instead of being refused, which exposed this).