Skip to content

fix(sync): bound startup reconciliation and expose daemon identity - #1413

Merged
wesm merged 3 commits into
mainfrom
fix/reconciliation-freshness-query
Aug 14, 2026
Merged

fix(sync): bound startup reconciliation and expose daemon identity#1413
wesm merged 3 commits into
mainfrom
fix/reconciliation-freshness-query

Conversation

@wesm

@wesm wesm commented Aug 14, 2026

Copy link
Copy Markdown
Member

Warm startup reconciliation could consume several CPU cores for tens of
minutes on large archives. The agent-scoped freshness query shape introduced
in #1349 allowed SQLite to choose the broad agent index, so each discovered
source could scan every stored session for that provider. These lookups now
require the existing source-path index, keeping the reconciliation path and
the digest-backed freshness path from #1393 bounded by the matching source
rows without adding an index migration.

Long startup is now identifiable and controllable before runtime publication.
Startup state includes the daemon build version and operating-system process
create time; status displays that version, while stop and restart can safely
target the exact starting process. Managed Caddy identity is published at
launch so forced startup shutdown also cleans up the proxy. Legacy startup
snapshots without process identity remain protected from signaling.

This is independent of #1374, which changes provider controls and watcher
scheduling but does not change these database lookups or startup-state
lifecycle behavior.

wesm added 2 commits August 14, 2026 14:04
Startup reconciliation checks freshness for every discovered source. The
agent-scoped queries made SQLite choose the agent index, so each check scanned
all sessions for that agent and made warm reconciliation effectively
quadratic on large archives.

Require the existing source-path index for these lookups. This keeps tombstone
semantics unchanged and avoids a new index migration while making each check
scale with the matching source rows.
Startup reconciliation checks freshness for every discovered source. The
agent-scoped queries made SQLite choose the agent index, so each check scanned
all sessions for that agent and made warm reconciliation effectively
quadratic on large archives.

Require the existing source-path index for these lookups. This keeps tombstone
semantics unchanged and avoids a new index migration while making each check
scale with the matching source rows.
fix(daemon): make startup identifiable and stoppable

Long initial syncs left users unable to confirm which build owned the startup
PID. Stop and restart also refused before runtime publication, so a stuck
startup required manual signals.

Publish the build version and OS create time in startup state. Lifecycle
commands can now show the build identity and safely stop or replace the exact
starting process. Legacy snapshots without process identity remain protected
from signaling.
@roborev-ci

roborev-ci Bot commented Aug 14, 2026

Copy link
Copy Markdown

roborev: Combined Review (0e234a6)

The PR needs one medium-severity fix to ensure managed Caddy is cleaned up during forced startup shutdown.

Medium

  • cmd/agentsview/daemon.go:433 — The synthesized startup stop record omits CaddyPID and CaddyCreateTime from startupState. If the runtime-record fallback is unresponsive and the daemon must be force-killed, Caddy cleanup silently becomes a no-op, potentially leaving the proxy process and port behind. Copy these fields into runtimeCaddyPID and runtimeCaddyCreateTime, and publish them immediately after Caddy starts so they are available if startup is stopped before runtime publication.

Reviewers: 2 done | Synthesis: codex, 10s | Total: 5m25s

Stopping a daemon before runtime publication only carried the parent process
identity. If the parent required forced shutdown, managed Caddy metadata was
unavailable and the proxy could retain its port.

Publish the managed Caddy identity immediately after launch and carry it
through the startup stop record. The existing exact create-time check remains
the guard against signaling a reused Caddy PID.
@roborev-ci

roborev-ci Bot commented Aug 14, 2026

Copy link
Copy Markdown

roborev: Combined Review (8d02e90)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 5m17s

@wesm
wesm merged commit 7469e87 into main Aug 14, 2026
23 checks passed
@wesm
wesm deleted the fix/reconciliation-freshness-query branch August 14, 2026 19:53
wesm added a commit to salmonumbrella/agentsview that referenced this pull request Aug 16, 2026
…dy-core

* origin/main: (25 commits)
  ci: retry failed Docker image builds (kenn-io#1437)
  Speed up HTTP sync by processing only changed sessions (kenn-io#1414)
  chore: remove dead code and unused frontend exports (kenn-io#1434)
  fix(parser): populate Kimi session cwd (kenn-io#1427)
  feat(frontend): add raw and formatted tool output display (kenn-io#1424)
  feat(insights): support OpenAI-compatible endpoints (kenn-io#1430)
  fix(parser): support legacy Zed thread schemas (kenn-io#1429)
  perf(signals): index duplicate prompt comparisons (kenn-io#1425)
  fix(config): honor explicit empty agent directory arrays (kenn-io#1423)
  feat(parser): add DeepSeek Harness session support (kenn-io#1402)
  test(sync): wait for archive audit stall state (kenn-io#1422)
  chore(deps): update github actions dependencies (kenn-io#1421)
  Tombstone stored Claude sessions a complete full parse no longer emits (kenn-io#1392)
  fix(sync): report stalled syncs as unhealthy (kenn-io#1419)
  Reduce idle CPU and let users turn off unused providers (kenn-io#1374)
  fix(serve): survive dual-stack port collisions at startup (kenn-io#1406)
  fix(sync): bound startup reconciliation and expose daemon identity (kenn-io#1413)
  fix(deps): update module golang.org/x/mod to v0.40.0 [security] (kenn-io#1400)
  Persist Claude and Codex freshness digests across engine restarts (kenn-io#1393)
  fix(sync): add lifecycle logging (kenn-io#1399)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant