Skip to content

[bootstrap] perf regression risk + diagnostics observability followups #568

@100yenadmin

Description

@100yenadmin

Why one issue, not two

Both items are followups to v0.9.3's bootstrap externalization landing (#510) and its diagnostics companion (#512). One concerns a perf regression risk introduced by the new ingest path; the other is an observability lifetime bug in the diagnostic that exists to surface bootstrap problems. Filing together so the bootstrap-import area can be considered as a single follow-up surface.

Sub-item D1: Per-message ingestSingle loop in #510 may regress first-time import latency

Sub-item F10: recentBootstrapImportsByConversation has no TTL

  • Repro hypothesis: A conversation that imported 7 times during early debugging will keep showing the "7 imports" diagnostic tag long after those imports have ceased to be relevant — until the LRU eviction at 100 conversations kicks in.
  • Evidence: PR fix: add overflow assembly diagnostics #512's recentBootstrapImportsByConversation map only evicts on LRU pressure (capacity 100). There is no per-entry TTL. For a long-lived gateway the stale tag trails the conversation indefinitely.
  • Suggested fix: Add a per-entry timestamp; treat entries older than e.g. 1h as expired on read; OR clear the entry once a conversation has had a successful round of subsequent normal turns without re-import.

Suggested PR scope

One PR adding a pre-scan fast path to the bootstrap ingest in src/conversation/bootstrap.ts (or wherever #510 landed the new loop), restoring bulk insert when safe and keeping ingestSingle for the externalization-required path. Same PR adds a TTL field to the recentBootstrapImportsByConversation entry shape and prunes on read in the diagnostic accessor. Both changes are localized and testable without standing up a full bootstrap fixture: pre-scan logic gets a unit test against synthetic message arrays, TTL gets a unit test by injecting a clock.

Cross-links

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglinked-prHas an identified PR or merge candidatepriority:P3Moderate bug or backlog item

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions