Skip to main content

render_since_last_session_banner

Function render_since_last_session_banner 

Source
pub async fn render_since_last_session_banner(
    ctx: &BannerContext,
) -> Option<String>
Expand description

Build the “since-last-session” banner for the given context. Returns None when there is nothing new to show OR when any step in the pipeline failed — callers should treat both as “emit nothing”.

The pipeline:

  1. Resolve the project root + repo aliases from ctx.cwd.
  2. Read the watermark (prev_ts) — None on first session.
  3. Open data.db and query for rules with installed_at > prev_ts whose source_repo matches one of this repo’s aliases.
  4. Advance the watermark to “now” (best-effort).
  5. Format the rows into the banner string.

Each step is fenced by tokio::time::timeout against BANNER_BUDGET so a stuck DB never stalls the agent’s session start.