Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/serve/store/cost_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
"errors"
"fmt"
"net/url"
"os"
"path/filepath"
"sync"
"time"

Expand Down Expand Up @@ -92,6 +94,18 @@ type sqliteCostStore struct {
// keeps the handler-side Writer from erroring under light contention
// with the quota-subscriber goroutine.
func OpenCostStore(path string) (CostStore, error) {
// Ensure the parent directory exists. Production opens the DB at
// ~/.config/ctm/ctm.db; on a fresh install (or in CI runners
// without a pre-existing config dir) the parent might not exist
// yet, and mattn/go-sqlite3 surfaces that as
// "unable to open database file". Cheap and idempotent — no-op
// for ":memory:" (filepath.Dir returns "."). Errors here are
// non-fatal: if mkdir fails we let sql.Open surface the real
// problem.
if path != ":memory:" {
_ = os.MkdirAll(filepath.Dir(path), 0o700)
}

// DSN tuning: ?_busy_timeout=5000 waits out brief writer locks;
// ?_journal=WAL enables concurrent readers; ?_sync=NORMAL pairs
// with WAL for an acceptable durability-vs-speed trade.
Expand Down
1 change: 1 addition & 0 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { AuthGate } from "@/routes/AuthGate";
const router = createBrowserRouter([
{ path: "/", element: <Dashboard /> },
{ path: "/s/:name", element: <Dashboard /> },
{ path: "/s/:name/feed", element: <Dashboard /> },
{ path: "/s/:name/checkpoints", element: <Dashboard /> },
{ path: "/s/:name/pane", element: <Dashboard /> },
{ path: "/s/:name/subagents", element: <Dashboard /> },
Expand Down
1 change: 1 addition & 0 deletions ui/src/routes/SessionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type TabKey =
| "meta";

function tabFromPath(pathname: string): TabKey {
if (pathname.endsWith("/feed")) return "feed";
if (pathname.endsWith("/checkpoints")) return "checkpoints";
if (pathname.endsWith("/pane")) return "pane";
if (pathname.endsWith("/subagents")) return "subagents";
Expand Down
Loading