Repository navigation
feat: add project auto-pull and compaction timeline dividers - #284
Conversation
Persist an opt-in project setting and share guarded fast-forward pulls across startup, enabling, and monitored status refreshes. Protect local work and active agent turns, recheck checkout identity, and back off failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Pending turns can be misclassified as idle, and automatic pulls are not coordinated with other internal checkout mutations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds opt-in automatic fast-forward pulls for idle default-branch project checkouts.
Changes:
- Persists and exposes the
autoPullproject setting. - Adds guarded startup, enablement, and monitored-status pull triggers.
- Adds documentation and tests for migration, hydration, and Git behavior.
File summaries
| File | Description |
|---|---|
scars.md |
Documents automatic Git mutation safeguards. |
packages/contracts/src/orchestration.ts |
Adds autoPull to project contracts. |
docs/project-auto-pull.md |
Documents behavior and limitations. |
apps/web/src/types.ts |
Extends the web project model. |
apps/web/src/store.ts |
Hydrates and reduces the setting. |
apps/web/src/store.test.ts |
Tests web-store persistence. |
apps/web/src/components/sidebar/ProjectDialogs.tsx |
Adds the settings switch. |
apps/web/src/components/Sidebar.tsx |
Connects settings UI to commands. |
apps/server/src/serverRuntimeStartup.ts |
Starts the background sweep. |
apps/server/src/server.ts |
Wires the auto-pull service layer. |
apps/server/src/server.test.ts |
Updates server test dependencies. |
apps/server/src/persistence/Services/ProjectionProjects.ts |
Extends the projection schema. |
apps/server/src/persistence/Migrations/083_ProjectionProjectsAutoPull.ts |
Adds the database column. |
apps/server/src/persistence/Migrations/083_ProjectionProjectsAutoPull.test.ts |
Tests migration replay. |
apps/server/src/persistence/Migrations.ts |
Registers migration 083. |
apps/server/src/persistence/Layers/ProjectionProjects.ts |
Reads and writes auto_pull. |
apps/server/src/orchestration/projector.ts |
Projects setting events. |
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts |
Includes the setting in snapshots. |
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts |
Tests snapshot hydration. |
apps/server/src/orchestration/Layers/ProjectionPipeline.ts |
Persists setting changes. |
apps/server/src/orchestration/decider.ts |
Emits setting updates. |
apps/server/src/orchestration/decider.autoPull.test.ts |
Tests command/event handling. |
apps/server/src/git/ProjectAutoPull.ts |
Implements guarded automatic pulls. |
apps/server/src/git/ProjectAutoPull.test.ts |
Tests pull eligibility and backoff. |
apps/server/src/git/Layers/GitStatusBroadcaster.ts |
Integrates pulls with status refreshes. |
apps/server/src/git/Layers/GitStatusBroadcaster.test.ts |
Updates broadcaster fixtures. |
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve provider-reported token counts and keep compaction boundaries visible outside collapsed reasoning. Support Claude boundaries and modern Codex compaction items. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse canonical project resolution per startup sweep, recognize unacknowledged user turns, and exercise both post-pull status publications. Document the remaining shared-mutation reservation gap explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The acknowledged checkout-coordination gap still allows agent starts and manual Git mutations to race an automatic pull.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 40/40 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Serialize turn admission and logical Git mutations by canonical checkout. Keep completion exclusion from ingestion through checkpoint finalization, including runtime paths during handoff, without holding checkout locks across command-queue waits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A provider event received between lifecycle subscriptions can leave a checkout permanently marked as finalizing until restart.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 56/56 changed files
- Comments generated: 1
- Review effort level: Balanced
Route processed provider events directly to the checkpoint worker instead of a second hot subscription. Release completion exclusions on failed handoff and worker shutdown, including queued work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Confirmed GitHub reports this branch conflicts with main. Disposition: needs-human approval to merge main into the PR branch and resolve conflicts, per the monitor policy prohibiting merges without explicit approval. No branch changes made. The monitor context/report tools were unavailable during tool discovery, so this disposition is recorded here instead. |
Preserve auto-pull, compaction, and owned checkpoint handoff alongside main's bounded transactional snapshot reads. Repair both historical migration-83 ledgers with append-only migration 084; retain existing ledger entries and populated values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Merged origin/main into this branch and pushed e398278. The PR itself was not merged. Resolved the snapshot test imports and retained both scars. Preserved project auto-pull, compaction dividers, checkout coordination, and the ingestion-owned checkpoint handoff alongside main’s bounded, transactional snapshot reads. Both histories used migration 083. The registry retains main’s message-sequence migration at 083 and appends idempotent repair 084, which ensures both schemas without rewriting existing ledger entries. Regression tests cover fresh databases and either historical 083 name, retained enabled auto-pull values, retained message sequences, backfill, indexes, and replay. Validation: pnpm fmt:check, pnpm lint, and pnpm typecheck pass. Lint reports five existing unused-import warnings in packages/contracts/src/ipc.ts. All 267 targeted tests pass across 11 suites covering migrations, snapshots, projection persistence/bootstrap, auto-pull, ingestion, checkpoints, lifecycle, and server runtime integration. GitHub now reports MERGEABLE for this head. CI is queued/running, so this is not a ready-to-merge claim. Working tree is clean. The monitor context tool was available, but its response exceeded the tool output limit before exposing finding IDs. No monitor disposition was changed; this comment records the resolution explicitly. |
Summary
autoPullthrough commands, events, SQL projections, snapshots, and the web store. Migration 083 is idempotent and defaults existing projects to off.Adapted from pingdotgg#9277 to this fork’s Git services rather than cherry-picking the upstream VCS refactor.
Behavior and limitations
Only the configured project checkout is updated, not feature branches or other worktrees. Background attempts use existing status monitoring; unopened projects are not continuously polled. Internal turn admission and logical Git operations share a checkout reservation. External terminals, other server processes, and detached provider commands that outlive their turn do not participate, so this is not an atomic filesystem guarantee against external writers. Pulls are fast-forward only: no stash, reset, branch switch, or conflict resolution.
Testing
pnpm fmt:check,pnpm lint,pnpm typecheck.Screenshot
Context compaction
Also adapts the upstream compaction divider UI from pingdotgg#9293. Manual and automatic provider-reported compactions render a muted separator with the inward-arrow icon. Compaction rows remain visible outside collapsed reasoning and work groups, and are included in chat search.
Claude compact boundaries retain valid provider-reported token counts. Completed modern Codex context-compaction items now produce the canonical compaction event, alongside existing legacy notification support. When both counts exist, the caption reads
Compacted context 173K → 5.69K tokens; otherwise it readsCompacted context. Existing stored compaction activities receive the new presentation too.This does not introduce a
/compactcommand or infer compaction from falling token usage. Providers without an explicit compaction notification cannot produce this marker.Compaction validation
Compaction screenshot
Checkout coordination
Implemented in
bb80aca9b. One shared, process-local coordinator keys reservations by canonical Git checkout root, including symlink and subdirectory aliases. Automatic pulls try-acquire and skip a busy checkout; foreground operations wait for an existing pull. Idle lock entries are removed.The reservation covers direct and queued turn admission through the pending-state/read-model commit, checkpoint HEAD/worktree/temp-index/real-index snapshots and restores, GitManager stacked actions and PR preparation, both Git and VCS mutation RPCs, bootstrap worktree creation, provider branch renames, and worktree cleanup. GitCore stays an unlocked implementation detail so composed operations do not acquire the same lock recursively.
Turn activity remains owned by the authoritative read model and provider sessions, not a second turn state machine. Ingestion registers an event-keyed finalization exclusion before publishing an idle session. The checkpoint worker retains it across the completion receipt wait and clears it on its terminal outcome, including failure. Both configured and actual provider checkouts are protected during handoff.
No checkout mutex spans orchestration dispatch, ingestion receipt waits, provider startup, or setup dispatch. Reservations release on interruption. On restart, process-local exclusions disappear and existing startup session reconciliation finishes before automatic pulls start. The coordinator does not replay interrupted checkpoint work. Separate worktrees retain independent file/index locks; Git owns shared-ref locking.
Coordination validation
pnpm fmt:check,pnpm lint, andpnpm typecheckpass.The shared-mutation implementation blocker is addressed. CI for the new head is still pending; this does not claim the PR is ready to merge.
Completion handoff follow-up
Fixed the startup-subscription gap in
154d21a3a. Ingestion now owns the only provider runtime subscription and hands processed events directly to the existing checkpoint queue. Queue acceptance is included in ingestion drain; capture stays independently queued. The checkpoint domain subscription starts first, but correctness does not rely on provider subscriber ordering.Exclusion ownership transfers without an interruption gap. Failed handoffs, terminal capture outcomes, worker cancellation with queued completions, and late handoffs during shutdown all release their exclusions. No checkout mutex spans dispatch or ingestion receipt waits.
pnpm fmt:check,pnpm lint, andpnpm typecheckpass.