Skip to content

agent-runner builds post-run OutroData from a stale session snapshot #596

@ethangui

Description

@ethangui

Problem

runProgram(session, …) in agent-runner receives the session snapshot captured at the start of the run (bin.ts passes tui.store.session). During the run, nanostore's setKey replaces the atom's top-level object on every store mutation, so that captured reference goes stale — anything written to the store during the run isn't visible on it at the end.

Symptoms:

  • events-audit dashboard URL: the agent emits [DASHBOARD_URL]InkUI.setDashboardUrl writes it to the store atom, but events-audit's buildOutroData reads sess.dashboardUrl from the stale snapshot → falls back to the generic /dashboard instead of the created dashboard. (src/lib/programs/events-audit/index.ts ~70-74)
  • session.skillId (and similar direct session.X = mutations in the runner) land on the stale ref; safe today only because they're read back through the same local ref, not the UI — a latent landmine for any future UI-visible field.

posthog-integration is unaffected: it reads its dashboard link from frameworkContext, which is shared by reference across the spread.

Proposed fix

Have the runner operate on the live session rather than a captured snapshot — e.g. pass the store (or a live accessor) into runProgram, or route post-run fields through store setters / getUI(). #595 already did this for the outroData delivery half (via getUI().outro(message, data), which also repaired reportFile/changes/dashboard rendering that was silently dropped). This issue tracks the remaining input half — buildOutroData reading stale session fields — across all programs.

Context

Surfaced by codex + multi-agent review on #595 and the chatgpt-codex-connector review. Deliberately deferred there to keep the handoff PR focused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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