Reconcile periscope onto current AgentsView upstream (third integrative merge) - #39
Conversation
DuckDB config resolution currently leaves a leading `~` literal in
`[duckdb].path`, so daemon-backed pushes can canonicalize the server
mirror path against the daemon working directory instead of the user's
home directory.
This expands leading-home shorthand during DuckDB config resolution,
alongside the existing defaulting and env expansion, so the daemon and
in-process callers resolve the same mirror path from the same config
value. `${HOME}` expansion, default-path fallback, and non-leading
tildes keep their current behavior. The change stays in
`internal/config` with focused resolution regression coverage.
The config snippet and daemon-vs-in-process repro came from @halms's
issue report.
Closes kenn-io#1264
---------
Co-authored-by: Marius van Niekerk <marius.v.niekerk@gmail.com>
Second PR in the artifact-sync split (follows kenn-io#1242, which froze the wire format and added the docbank-backed store). Extracted from the closed kenn-io#1239 branch with review fixes applied during extraction. ## What this adds - **SQLite publication ledger** (`internal/db`): `artifact_export_queue`, `artifact_publications`, `artifact_publication_revisions`, `artifact_checkpoint_heads`/`_floors`, plus session triggers that enqueue owned-session changes. Triggers are origin-gated — they fire only once an artifact origin exists in `pg_sync_state` — so archives that never opt in carry no queue writes. Trigger DDL lives in Go and is installed after column migrations (drops run before), so no trigger references session columns while migrations run. - **Go enqueue hooks** for child-only mutations that don't touch trigger-covered session columns: batch message writes (queue generation sampled around the batch, enqueues exactly once when the triggers didn't fire), standalone usage-event replacement, and token-coverage backfill. Queue bootstrap is an explicit call at origin creation, not a migrate-time backfill. - **Origin lifecycle** (`internal/artifact`): `EnsureOrigin`/`AdoptOrigin`/`StoredOrigin`. Creating or adopting an origin bootstraps the export queue; a failed bootstrap rolls the origin back (deleting the key when there was none before, since the gates test key existence) so a retry re-runs population. Adopting over a different established origin force-requeues every owned session with a generation bump, because prior acknowledgements belong to the old origin. - **Checkpointed export pipeline** (`internal/artifact`): claims pending queue rows, publishes content-addressed session manifests and segments into the store, records publication revisions, and advances per-origin checkpoint heads with monotone sequence reservation. Stale claims (a writer advanced the generation mid-export) roll back atomically. Incremental export is bounded by the dirty batch; an unchanged archive costs a catalog identity check only. Full export streams all bodies, then re-checks the queue up to 32 settle rounds — hitting the bound returns the accumulated result with an error meaning "made progress, run again." - **Resync carriage**: `CopySyncStateFrom` carries queue, publication, revision, and checkpoint state across a full resync and re-dirties every copied queue row — the origin gate keeps triggers silent in the rebuild's temp DB, and a parser bump changes manifest hashes anyway, so the exporter must re-verify each session (unchanged content is cheap to skip, being content-addressed). ## Scope and limitations - Export-side only. Nothing wires the pipeline to the daemon or CLI yet; that lands with folder transport and import in a later PR. There is no import/read path here. - The ledger is local SQLite state. PostgreSQL push and shared query shapes are untouched. - The wire format is unchanged: no golden churn, format stays frozen at v1. ## Where to look - `internal/db/artifact_publication.go` — queue and ledger SQL, origin-gated enqueue - `internal/db/db.go` — trigger DDL split around column migrations, bootstrap/requeue - `internal/artifact/export.go` — publish → manifest → checkpoint ordering and claim lifecycle - `internal/artifact/origin.go` — origin lifecycle and rollback semantics - `internal/db/orphaned.go` — resync carriage and the pending-flag decision Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
Supersedes kenn-io#1167 — same feature, rebuilt as a lean series on the capability work that landed in kenn-io#1282/kenn-io#1283. The comment on kenn-io#1167 records what was cut and why. ## What this does Adds Omnigent to the supported agents. Omnigent stores every conversation in one SQLite file (`chat.db`), so this follows the same container model as Zed: sync watches one file, and the archive holds one session per conversation (`omnigent:0:<hex>`). - Scheduled syncs reparse the container when its fingerprint (mtime + hash of the db and WAL) changes. - Watcher events do a bounded, indexed scan of only the members whose `updated_at` moved, and retire disappeared members as tombstones. WAL `-shm` checkpoint noise is ignored. - Deleting a conversation (or the whole db) tombstones its sessions; nothing is destroyed. ## Notes - Supports the two schema generations that ship in released Omnigent builds, including the current binary-uuid one. The oldest shape is reported as unsupported without failing sync; the interim `session_overrides` shape is not supported. - `chat.db` co-locates transcripts with authentication secrets, so Omnigent is excluded from remote sync (capability from kenn-io#1282, nested-root enforcement from kenn-io#1283). - Validated against a chat.db produced by Omnigent's own store code at upstream head, not just fixtures (evidence in `docs/internal/session-format-sources.md`). - Known trade-offs (Zed parity): the scheduled reparse scales with container size, and edits that don't bump `updated_at` wait for the scheduled pass instead of the watcher. ## Where to look - `internal/parser/omnigent.go` — schema detection and member queries - `internal/parser/omnigent_provider.go` — discovery, fingerprinting, watcher scan, tombstones - `internal/sync/engine.go` — container scheduling and the persistent-archive audit fallback - `internal/sync/omnigent_integration_test.go` — end-to-end sync coverage Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
Activity reports currently fragment repository activity under short-lived worktree directory names when linked worktrees are backed by a bare Git repository or their checkout has already been removed. This change derives live bare-backed repositories from the common Git directory without spawning Git, and recognizes standard hosted worktree layouts when Git metadata is unavailable. Tool-anchored manager layouts keep their explicit path precedence, while generic hosted patterns defer to a live enclosing repository so matching fixture or nested paths are not misattributed. The parser data version advances so existing source-backed sessions are reparsed through the established non-destructive full-resync flow. Archived sessions whose original source is permanently unavailable are preserved, but their previous project attribution cannot be recomputed. The main review points are the filesystem-only `core.bare` detection, the anchored-versus-generic layout precedence, and the data-version-triggered repair path. Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
…enn-io#1298) Local DuckDBPushWatch mirrored pg watch's pre-fix gap: no sync engine, no unwatched-root poller, and watcher options only wired OnCoverageDegraded. Interval pushes used runLocalSyncAuthoritative → SyncAll, which never tombstones missed deletions under deferred scopes. Align local duckdb watch with local pg watch: shared watcher options, engine-backed batch sync, startup sync, and the probe-gated poller. Add TestLocalDuckDBPushWatchGivesDeferredScopesAPollingOwner parallel to the existing pg regression at archive_write_backend_test.go:821. Daemon-delegated duckdb/pg watch remains unchanged (no local engine). Co-authored-by: cyre <diazMelgarejo@users.noreply.github.com>
The Linux race suite inherits Go’s ten-minute default package timeout even though the ordinary suite allows twenty minutes. On the failed main run, `internal/sync` reached that boundary without reporting a data race, turning an instrumentation-slow package into a false CI failure. Windows hit a similar timing assumption: vector serving stayed open correctly while the API build was blocked, but the test allowed only two seconds for index finalization after release. This keeps both lifecycle assertions while giving finalization a bounded allowance appropriate for loaded Windows runners. This is intentionally a reliability fix, not a suite-sharding change. `internal/sync` and `internal/artifact` are already near co-critical paths; the larger follow-up opportunity is to run the separate non-race DuckDB command in parallel with the race suite.
Unifies cost and token analytics in one Usage page with a URL-backed metric toggle, metric-aware visual formatting, and server-side rankings across SQLite, PostgreSQL, and DuckDB. Legacy token-usage links remain compatible. Adds Kimi Work desktop discovery and parsing with documented format provenance, plus timestamp-aware Kimi alias pricing. Exact custom alias rates retain precedence, while schema-v4 pricing metadata preserves reported model names and every resolved priced model across cutoff-spanning reports. Adds macOS production and development launchers that use private temporary log directories and open only process-authenticated, dynamically discovered loopback URLs. K3 rates remain curated estimates until they are available from the upstream pricing catalog; consumers of the changed pricing provenance shape must use schema version 4. Co-authored-by: 潦草学者 <liaocaoxuezhe@users.noreply.github.com>
Artifact export currently establishes durable publication authority, but artifacts already present in a store cannot be consumed into the normalized archive with equivalent crash safety. That leaves round-trip synchronization one-way and makes later folder or service transports unsafe to add because inbound work has no durable claim, version-deferral, or landing boundary. This change adds exact checkpoint claims, monotonic peer heads, complete landing maps, and per-session provenance that survive full resync. Imports authenticate bounded artifact reads, accept semantically valid peer JSON under its stored identity, defer missing or future dependencies independently, quarantine deterministic corruption, and rewrite complete sessions under origin-qualified identities without carrying source-machine or unverified secret state. The coordinator acknowledges a checkpoint only after its available session closures and exact landing map are durable. Retries converge across each write boundary, unchanged large checkpoints perform closure work only for changed sessions, and repeated observations do not duplicate normalized messages or usage. Checkpoint absence remains non-destructive. Metadata replay, artifact transport, raw provider-source stewardship, and provider-file eviction remain separate follow-on scopes. Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
Long-running agentsview daemons currently retain the LiteLLM pricing catalog fetched at startup, so models added upstream afterward remain unpriced until an operator restarts the process. This adds one cancellable daily refresh loop to the writable daemon while preserving the immediate startup refresh. Attempts remain serialized and transient failures leave the scheduler active, keeping pricing current without adding request latency or archive-sized background work. <sup>generated by a clanker</sup> Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>
Rename context-session-visualizer-spec.md to periscope-spec.md. Collapse overlapping intro sections, split scope into V1 (descriptive visualizer) and V2 (interpretation/guidance), commit to compute-on-read storage, standalone /context/:sessionId route with JetBrains exposure, SSE live updates, and post-compaction-only handling. Rename "advisor" to "guidance" throughout and drop drift signals.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…tegrative merge) Real 3-way merge of origin/merged into the agentsview-upstream-based branch (origin/agentsview a421fe8 + 2 cherry-picked fork commits), reconciled at the fork-point anchor merge-base(origin/merged, origin/agentsview) = 6c3317a. Verified: Go build and vet clean across the whole repo; internal/db, internal/duckdb, internal/postgres test suites pass; internal/sync and scripts package FTS5 test failures are pre-existing (confirmed identical on pristine origin/merged and pristine kenn-io/agentsview upstream main, not introduced by this merge); frontend svelte-check 0 errors, vitest 143/143 files and 2146/2146 tests pass. See PR body for the detailed list of conflict-resolution judgment calls made during reconciliation.
…pypi rename) Brings in cursor-agent's independent PR #36 parser-provider synthesis (merged as #37) and the periscope-agentsview PyPI rename (#38), which had landed on merged concurrently with this branch's reconciliation work. No real conflicts -- the only touched files (build_wheels.py, build_wheels_test.py, release.yml) were edited identically in both places and resolved by taking the already-merged version.
Fixed by an earlier hygiene sweep this session but the fix was applied to the working tree only and never committed -- caught by an independent code-reviewer subagent pass on PR #39, which reproduced `go build ./...` failing at the pushed tip with "no required module provides package go.kenn.io/agentsview/internal/{money,db}". Verified here: go build and go vet are clean across the whole repo with these staged. Same root failure class as the earlier merge-never-committed incident tonight: trusted "I already fixed this" from memory instead of re-verifying the actual committed/pushed state.
Summary
Real 3-way
git merge origin/merged --no-commit --no-ffreconciling periscope's fork-unique work against the currentkenn-io/agentsviewupstream tip (a421fe8d), following up the earlier incremental cherry-pick replay. This is the third major AgentsView →mergedintegrative absorption referenced indocs/ARCHITECTURE.md§ Versioning (the work behind the-periscope.3generation marker).Base:
origin/agentsview(upstream mirror) + 2 cherry-picked commits (Periscope V1 context visualizer, Codex context token accounting fix), then merged againstorigin/mergedat the fork-point anchormerge-base(origin/merged, origin/agentsview) = 6c3317ad.Verification performed
go test ./internal/db/... ./internal/duckdb/... ./internal/postgres/...— all passinternal/syncandscriptspackage test failures are pre-existing — confirmed identical on pristineorigin/merged, pristinekenn-io/agentsviewupstreammain, and this branch (an FTS5 test-environment condition local to the sandbox, not introduced by this merge)svelte-check— 0 errors;vitest run— 143/143 test files, 2146/2146 tests passNotable conflict-resolution findings (for reviewers)
internal/artifact/*: upstream added error-handling/schema evolution (futureArtifactVersionError, native-session-ID validation) that periscope's fork hadn't absorbed yet — took upstream's superset, fixed module paths.internal/db/db.go,internal/db/orphaned.go: upstream added newer schema migrations (artifact_checkpoint_stages.*,quarantine_pending) and a newcopyArtifactImportStateDB-rebuild path periscope's fork lacked entirely.cmd/periscope/archive_write_backend.go+duckdb.go: upstream had refactored duplicated watch-loop closures into shared helpers (archivePushWatchWatcherOptions,newDuckDBPusher); reconciled by keeping upstream's cleaner structure while preserving periscope's real fixes (acfg.Full || didResyncbugfix upstream lacked, and awatchHooks-based test-injection seam) — required deleting a now-genuinely-stale duplicate file,duckdb_watch.go.internal/postgres/usage.go,usage_unit_test.go, twoactivityreport_test.gofiles: found and fixed real missing-import bugs (pricingpkg,export) that periscope's side of these conflicts had silently dropped.frontend/src/lib/api/client.ts: caught 183 lines of dead upstream REST-wrapper code that had been silently unioned in via a non-conflicting merge; fixed by matching the generated-OpenAPI-client architecture already enforced by this repo's owngenerated-client-usage.test.tsregression guard.frontend/src/lib/components/layout/AppHeader.svelte: fixed a misplaced Sessions nav button (a leftover from an earlier cherry-pick) that was breaking Svelte snippet typing — moved into the correct{#snippet right()}slot.Requesting review
@codex @cursor — could you each independently review this against:
latentsignal-org/periscopetip (the pre-merge periscope fork state)kenn-io/agentsviewupstream (unmodified upstream, no fork changes)Looking especially for: any upstream security fixes silently reverted, any periscope-specific behavior silently dropped, and any of the conflict-resolution judgment calls above that look wrong on closer inspection.
Test plan