Files
Pulse/internal/api
rcourtman 3246d40e00 Harden Patrol cost accounting, pricing, probes, retention, and isolation
Fixes five runtime correctness, cost-control, and isolation defects in Patrol:

1. Turn-boundary usage recording and mid-run budget enforcement: record Patrol and investigation token usage on every completed provider response (and interrupted Anthropic streams via UsageEvent) before the agentic loop budget check runs, retain spend across context-window retries without double-counting, and preserve per-turn usage slices so fallback accounting keeps tiered pricing accurate.
2. Anthropic 5.5 pricing and per-tier cache rates: add verified Opus 5.5, Sonnet 5.5, and tiered Haiku 5.5 rates with explicit cache write and read prices per tier instead of one provider-wide cache multiplier.
3. Guest reachability probe safety and scope: replace shared-map worker mutation with a buffered result channel so timed-out probes cannot race with the returned map, and propagate effective Patrol scope so scoped runs probe only in-scope guests.
4. Bounded Patrol forensic session storage: batch append and trim messages in one SessionStore write on both error and success exits in ExecutePatrolStream so repeated failures stay capped at 200 messages.
5. Fail-closed multi-tenant AI resolvers: reject non-default organization fallback to default read state, unified provider, config, persistence, and AI service even when multi-tenant managers are nil.

Contract-Neutral: Hardens Patrol cost accounting, Anthropic 5.5 pricing, guest probe concurrency and scope, forensic session retention, and fail-closed tenant resolvers with no external API or subsystem contract delta
2026-12-02 14:41:40 +00:00
..
2026-10-11 22:20:25 +01:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-04-26 17:26:16 +01:00
2026-01-22 00:30:15 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-09-01 01:02:17 +01:00

Internal API Package

This directory contains the API server implementation for Pulse.

Important Note About frontend-modern/

The frontend-modern/ subdirectory that appears here is:

  • AUTO-GENERATED during builds
  • NOT the source code - just a build artifact
  • IN .gitignore - never committed
  • REQUIRED BY GO - The embed directive needs it here

Frontend Development Location

👉 Edit frontend files at: ${PULSE_REPOS_DIR}/pulse/frontend-modern/src/

Why This Structure?

Go's //go:embed directive has limitations:

  1. Cannot use ../ paths to access parent directories
  2. Cannot follow symbolic links
  3. Must embed files within the Go module

This is a known Go limitation and our structure works around it.