Skip to content

feat(parser): migrate vibe provider#770

Draft
mariusvniekerk wants to merge 1 commit into
provider-cursorfrom
provider-vibe
Draft

feat(parser): migrate vibe provider#770
mariusvniekerk wants to merge 1 commit into
provider-cursorfrom
provider-vibe

Conversation

@mariusvniekerk

Copy link
Copy Markdown
Collaborator

Vibe now uses a concrete provider for its session directory layout. The provider keeps messages.jsonl as the stable source while modeling meta.json as a companion for changed-path classification and freshness.

The provider preserves recursive discovery, symlinked session directories, canonical ID lookup through meta.json, effective size and mtime from transcript plus metadata, transcript hashing, fallback-ID exclusion, aggregate usage events, and parse output through the existing Vibe parser wrapper.

@roborev-ci

roborev-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown

roborev: Combined Review (b0d0dc2)

Summary verdict: one medium correctness issue needs attention before merge.

Medium

  • Location: internal/parser/vibe_provider.go:374
    Problem: When meta.json is removed or no longer has session_id, Vibe falls back to vibe:<session_dir>, but vibeProviderExcludedSessionIDs returns no exclusions for that fallback case. A previously synced canonical vibe:<uuid> row for the same source would be retained, leaving duplicate sessions and double-counted usage/messages once the provider path is used.
    Fix: Preserve the legacy file-path based exclusion behavior by excluding existing IDs for the same source/fingerprint that differ from the parsed ID, or defer Vibe provider migration until the provider-backed sync layer can do that cleanup.

Panel: ci_default_security | Synthesis: codex, 7s | Members: codex_default (codex/default, done, 4m22s), codex_security (codex/security, done, 1m12s) | Total: 5m41s

@roborev-ci

roborev-ci Bot commented Jun 20, 2026

Copy link
Copy Markdown

roborev: Review Unavailable (8c1706a)

The review agent repeatedly failed to run (likely an agent or configuration error). roborev will try again on the next commit.

Last error: agent: claude-code failed stream: stream errors: You've hit your session limit · resets 5:50am (UTC): exit status 1

@roborev-ci

roborev-ci Bot commented Jun 21, 2026

Copy link
Copy Markdown

roborev: Combined Review (3416e6f)

Shadow-mode Vibe provider migration has two Medium parity issues; no security findings.

Medium

  • internal/parser/vibe_provider.go:400 - The provider only excludes the directory-name fallback ID when the parsed ID is canonical. Legacy Vibe also excludes any other session rows already stored for the same file path, which removes the stale canonical row when meta.json disappears. In shadow mode this can report mismatches; if Vibe later becomes provider-authoritative, stale duplicate rows can remain. Fix by keeping Vibe legacy-only until the provider path can receive stored IDs for the source, or by extending the provider/engine contract so Vibe can exclude all non-current IDs for the same source path and adding parity tests for meta removal/promotion cases.

  • internal/parser/vibe_provider.go:324 - A deleted meta.json event synthesizes a messages.jsonl source even when the sibling transcript is also gone. The engine's deleted-physical-source guard only skips events where the source path equals the removed path, so a whole-session delete can enqueue a nonexistent transcript and fail on stat. Fix by routing meta.json to messages.jsonl only when that transcript still exists, and avoiding the missing-path fallback for sidecar-only events.


Panel: ci_default_security | Synthesis: codex, 9s | Members: codex_default (codex/default, done, 4m4s), codex_security (codex/security, done, 1m29s) | Total: 5m42s

@mariusvniekerk

mariusvniekerk commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

This change is part of the following stack:

Change managed by git-spice.

@roborev-ci

roborev-ci Bot commented Jun 21, 2026

Copy link
Copy Markdown

roborev: Combined Review (6f517c2)

Medium confidence to merge is blocked by one behavioral parity issue.

Medium

  • internal/parser/vibe_provider.go:400: The provider only excludes the directory-name fallback ID. When meta.json is removed or its session_id changes, the legacy path deletes existing session rows for the same file path, but the provider path does not plan deletion for the stale canonical ID. If the provider becomes authoritative, this can cause shadow mismatches and duplicate rows.
    • Fix: Mirror processVibe’s file-path based stale-ID cleanup in the provider-processing path, or keep Vibe legacy-only until that DB-dependent cleanup is handled. Add parity tests for meta.json removal and session_id changes.

Panel: ci_default_security | Synthesis: codex, 6s | Members: codex_default (codex/default, done, 4m37s), codex_security (codex/security, done, 1m33s) | Total: 6m16s

@roborev-ci

roborev-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown

roborev: Combined Review (5436337)

Medium issue found; no critical or high findings.

Medium

  • internal/parser/types.go:580 - Removing Vibe's DiscoverFunc/FindSourceFunc drops it from existing code paths that still gate on those hooks. parse-diff now excludes/rejects Vibe, SSH remote directory resolution no longer emits Vibe roots, and token-use raw disk probing can no longer resolve unsynced Vibe IDs.

    Fix: Keep compatibility hooks for Vibe until those call sites are provider-aware, or update parse-diff, SSH resolution, and token-use lookup to use the provider factory Discover/FindSource paths for provider-authoritative agents.


Panel: ci_default_security | Synthesis: codex, 7s | Members: codex_default (codex/default, done, 6m30s), codex_security (codex/security, done, 44s) | Total: 7m21s

Vibe stores transcript content in messages.jsonl while canonical session identity, title, timestamps, model, and usage can live in a sibling meta.json. Moving it behind a concrete provider keeps that companion relationship explicit at the provider boundary.\n\nThe provider preserves recursive session discovery, symlinked session directories, raw and full ID lookup through meta.json, meta-sidecar changed-path classification, effective size and mtime freshness, transcript hashing, fallback-ID exclusion, and parser output normalization through the existing Vibe parser wrapper.

fix(parser): classify removed vibe transcripts

Vibe source events need to keep working after the primary messages.jsonl has already disappeared. Routing deletion and rename-style events through the existing file check meant the watcher could ignore the exact event that should refresh or remove the stored session.

Synthesize source refs only for missing-path removal semantics, keep ordinary lookups existence-checked, and pin the intentionally shallow session directory layout in provider tests. This lets the Vibe provider enter shadow comparison as a real migration step.

Validation: go test -tags "fts5" ./internal/parser -run 'Test(VibeProvider|ProviderMigrationModes)' -count=1; go test -tags "fts5" ./internal/parser -count=1; go vet ./...; git diff --check

test(sync): compare vibe shadow parity

Vibe is shadow-compared on this branch, so add source-level migration coverage that compares provider observation with ParseVibeSessionWrapper.

The test includes meta.json canonical ID promotion, provider-adjusted fingerprint metadata, usage events, and excluded fallback IDs so reviewers can see the migration preserves the composite source behavior.

Validation: go test -tags "fts5" ./internal/parser ./internal/sync -run 'TestObserveProviderSourceMatchesVibeLegacyParser|TestVibeProvider|TestParseVibe|TestClassifyOnePath_Vibe|TestSyncVibe|TestSourceMtimeVibe|TestProcessVibe' -count=1; go test -tags "fts5" ./internal/parser ./internal/sync -count=1; go fmt ./...; go vet ./...; git diff --check; ./custom-gcl run --config .golangci.nilaway.yml ./internal/parser/... ./internal/sync/...

test(sync): cover vibe provider usage parity

Roborev job 2711 caught that the Vibe shadow parity fixture compared empty usage slices, so it could not detect regressions in aggregate usage emission.

Seed the fixture with real Vibe metadata fields for active model and nonzero stats, then assert both legacy and provider paths emit usage before comparing them.

Validation: go test -tags "fts5" ./internal/sync -run TestObserveProviderSourceMatchesVibeLegacyParser -count=1; go fmt ./...; go vet ./...; git diff --check

refactor(parser): fold vibe into provider

Move Vibe source discovery, lookup, and parse ownership onto the concrete
vibeProvider and delete the package-level DiscoverVibeSessions,
FindVibeSourceFile, and ParseVibeSessionWrapper free functions. Discovery
and find-source bodies now live as provider-owned helpers
(discoverSessionPaths, findSourceFile) on the vibe source set, the
isVibeMessagesFile guard moves to the provider file, and the messages.jsonl
parser becomes the provider parseVibeResult/parseSession methods.

Make Vibe provider-authoritative and drop its legacy sync dispatch: the
classifyContainerPath classifyVibePath call and method, the processFile case
arm, the processVibe method, and its now-orphaned isSessionBlocked and
isSessionTrashed helpers. vibeEffectiveInfo stays as a shared composite-mtime
helper used by the skip-cache and fingerprint paths.

Because a provider has no database handle, the engine reproduces Vibe's
DB-aware, file-path-scoped bookkeeping in applyProviderFilePathPolicies for
single-session-per-file providers: stale stored IDs at the same source path
are excluded, and a freshly parsed row is suppressed when the user already
removed (trashed or deleted) the session occupying that path, so a canonical
ID flipping between the meta.json session_id and the directory-name fallback
no longer resurrects a hidden session. This is a no-op for stable-ID
providers and skipped for multi-session sources.

Drop the Vibe AgentDef DiscoverFunc/FindSourceFunc hooks, remove it from the
pending shim scan list, replace the shadow-baseline test with provider API
coverage plus a guard that the legacy entrypoints stay gone, and route the
package and engine tests through the provider methods. The obsolete
classifyOnePath Vibe test is removed; the provider's SourcesForChangedPath
coverage replaces it.
@roborev-ci

roborev-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

roborev: Combined Review (df219b4)

Summary verdict: one medium-risk sync regression should be addressed before merge.

Medium

  • internal/parser/provider_migration.go:55 - Moving Vibe to the provider-authoritative path drops the legacy shouldSkipByPath freshness check from processVibe, so unchanged Vibe sessions will be parsed, upserted, counted as synced, and emit updates on every full scheduled SyncAll.
    • Fix: Add a provider-path DB freshness skip using the provider fingerprint size/mtime/key and data version before provider.Parse, or keep Vibe on the legacy path until that parity exists.

Panel: ci_default_security | Synthesis: codex, 7s | Members: codex_default (codex/default, done, 6m16s), codex_security (codex/security, done, 1m41s) | Total: 8m4s

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