Skip to content

feat(parser): migrate workbuddy provider#762

Draft
mariusvniekerk wants to merge 1 commit into
provider-qwenfrom
provider-workbuddy
Draft

feat(parser): migrate workbuddy provider#762
mariusvniekerk wants to merge 1 commit into
provider-qwenfrom
provider-workbuddy

Conversation

@mariusvniekerk

@mariusvniekerk mariusvniekerk commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

WorkBuddy is still JSONL-backed, but its source layout has two valid shapes: project-level session files and nested subagent files. Moving it behind a concrete provider keeps that provider-specific shape explicit while continuing to reuse the shared JSONL filesystem mechanics.

The provider preserves legacy discovery and lookup behavior, including symlinked project directories and files, compound subagent raw IDs, deleted-path classification, source fingerprinting, and existing parser normalization for parent/subagent relationships. The tests also document the legacy asymmetry where discovery accepts non-ID subagent JSONL filenames while raw subagent lookup remains constrained.

@roborev-ci

roborev-ci Bot commented Jun 19, 2026

Copy link
Copy Markdown

roborev: Combined Review (38aa6d2)

No issues found.


Panel: ci_default_security | Synthesis: codex | Members: codex_default (codex/default, done, 3m46s), codex_security (codex/security, done, 1m13s) | Total: 4m59s

@roborev-ci

roborev-ci Bot commented Jun 20, 2026

Copy link
Copy Markdown

roborev: Combined Review (c227cdd)

No issues found.


Panel: ci_default_security | Synthesis: codex | Members: codex_default (claude-code/default, done, 4m49s), codex_security (claude-code/security, done, 1m27s) | Total: 6m16s

@roborev-ci

roborev-ci Bot commented Jun 21, 2026

Copy link
Copy Markdown

roborev: Combined Review (07d5389)

Summary verdict: One medium issue remains; no high or critical findings were reported.

Medium

  • internal/parser/workbuddy_provider.go:136: The WorkBuddy source set does not enable hashing, so Fingerprint.Hash remains empty and Parse leaves Session.File.Hash unset. The legacy WorkBuddy path computes File.Hash, and WorkBuddy is now opted into shadow comparison, so successful shadow parses may be reported as false session mismatches. If this provider later becomes authoritative, it would also drop file_hash.
    • Fix: Set Hash: true in JSONLSourceSetOptions or compute the same SHA-256 hash before returning the parse result, and add caller-level shadow comparison coverage.

Panel: ci_default_security | Synthesis: codex, 6s | Members: codex_default (codex/default, done, 4m44s), codex_security (codex/security, done, 1m28s) | Total: 6m18s

@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 (b524d53)

Summary verdict: One medium issue needs attention before relying on WorkBuddy provider parity.

Medium

  • internal/parser/workbuddy_provider.go:136
    The WorkBuddy provider is opted into shadow comparison, but its fingerprint does not include a content hash while processWorkBuddy stores sess.File.Hash from ComputeFileHash. This can cause shadow comparisons to report mismatches for every parsed WorkBuddy file, and a future authoritative switch would stop preserving file_hash.
    Fix: Populate the provider hash to match legacy behavior, such as setting Hash: true in JSONLSourceSetOptions or computing the same SHA-256 hash before returning parsed sessions.

Panel: ci_default_security | Synthesis: codex, 6s | Members: codex_default (codex/default, done, 5m24s), codex_security (codex/security, done, 2m8s) | Total: 7m38s

@roborev-ci

roborev-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown

roborev: Combined Review (daede0a)

Medium findings:

  • [internal/parser/workbuddy_provider.go:137] The new WorkBuddy provider never enables fingerprint hashing, so req.Fingerprint.Hash is empty and sess.File.Hash is no longer populated. The legacy processWorkBuddy path computed ComputeFileHash for every synced WorkBuddy session, so this regresses stored file_hash data. Add Hash: true to the WorkBuddy JSONLSourceSetOptions and cover it with a provider fingerprint/parse test that asserts the stored session hash is populated from the source content.

  • [internal/parser/types.go:459] Removing WorkBuddy's DiscoverFunc and FindSourceFunc cuts it out of remaining non-provider-aware callers. parse-diff still supports only agents with DiscoverFunc, the SSH resolver emits only file-based agents with DiscoverFunc, and token-use disk resolution still probes only FindSourceFunc, so WorkBuddy loses existing CLI/remote-sync paths after this migration. Either keep provider-backed compatibility hooks for WorkBuddy until those callers are migrated, or update parse-diff, SSH resolution, and token-use ID resolution to use the provider facade.

Security review found no additional medium-or-higher issues.


Panel: ci_default_security | Synthesis: codex, 8s | Members: codex_default (codex/default, done, 4m23s), codex_security (codex/security, done, 1m4s) | Total: 5m35s

WorkBuddy is still JSONL-backed, but its source layout has two valid shapes: project-level session files and nested subagent files. Moving it behind a concrete provider keeps that provider-specific shape explicit while continuing to reuse the shared JSONL filesystem mechanics.

The provider preserves legacy discovery and lookup behavior, including symlinked project directories and files, compound subagent raw IDs, deleted-path classification, source fingerprinting, and existing parser normalization for parent/subagent relationships.

Validation: go fmt ./...; go test -tags "fts5" ./internal/parser -run TestWorkBuddyProvider -count=1; go test -tags "fts5" ./internal/parser -count=1; go vet ./...; make test-short; git diff --check

test(parser): document workbuddy subagent discovery

WorkBuddy legacy discovery accepts any JSONL filename under a valid parent session's subagents directory, while raw subagent lookup still validates the requested ID. The provider migration intentionally preserves that asymmetry rather than tightening discovery and dropping sources that older code would import.

Validation: go fmt ./...; go test -tags "fts5" ./internal/parser -run TestWorkBuddyProviderSourceMethods -count=1; go test -tags "fts5" ./internal/parser -count=1; go vet ./...; git diff --check; make nilaway

test(parser): opt workbuddy into provider shadow

WorkBuddy now has a concrete facade provider on this branch, so its migration mode should enter the shared shadow-compare harness rather than remaining legacy-only and additive.

Lower provider opt-ins stay inherited and later provider branches remain responsible for their own concrete providers.

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

test(sync): compare workbuddy shadow parity

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

The test covers both the main session file and nested subagent file shape so parent relationship parity stays visible while the stack migrates provider by provider.

Validation: go test -tags "fts5" ./internal/parser ./internal/sync -run 'TestObserveProviderSourceMatchesWorkBuddyLegacyParser|TestWorkBuddyProvider|TestParseWorkBuddy' -count=1; go test -tags "fts5" ./internal/parser ./internal/sync -count=1; go fmt ./...; go vet ./...; ./custom-gcl run --config .golangci.nilaway.yml ./internal/parser/... ./internal/sync/...; git diff --check; go test -tags "fts5" ./internal/sync -run TestObserveProviderSourceMatchesWorkBuddyLegacyParser -count=1

refactor(parser): fold workbuddy into provider

WorkBuddy already had a concrete provider, but it still depended on exported legacy parser/source functions and legacy sync dispatch. That kept the branch additive and let the old shape remain authoritative.\n\nMove parsing and composite subagent source lookup behind the provider, remove registry callbacks and sync dispatch, and convert the WorkBuddy tests to provider-backed helpers plus a guard that the old entrypoints stay gone.\n\nValidation: go test -tags "fts5" ./internal/parser ./internal/sync -run 'TestWorkBuddy|TestDiscoverWorkBuddy|TestParseWorkBuddy|TestFindWorkBuddy|TestEngineClassifyWorkBuddy|TestWorkBuddyRegistry' -count=1 -v; go test -tags "fts5" ./internal/parser ./internal/sync ./cmd/agentsview -count=1; go vet ./...; git diff --check

fix(parser): preserve workbuddy file hashes

WorkBuddy legacy sync stored the transcript content hash for both main sessions and subagent transcripts. The provider migration kept copying Fingerprint.Hash into Session.File.Hash, but the recursive source set did not request hashed fingerprints, so provider-authoritative writes would clear file_hash.\n\nEnable source hashing and make the provider parse test exercise Fingerprint -> Parse for both main and subagent sources.\n\nValidation: go test -tags "fts5" ./internal/parser -run TestWorkBuddyProvider -count=1; go test -tags "fts5" ./internal/parser -count=1; go test -tags "fts5" ./internal/sync -run 'Test.*WorkBuddy' -count=1; go vet ./...; git diff --check

fix(parser): thread ctx through workbuddy source lookups
@roborev-ci

roborev-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

roborev: Combined Review (1fe6b53)

No Medium, High, or Critical findings were reported.

The only finding was Low severity and has been omitted per the review-combination rules.


Panel: ci_default_security | Synthesis: codex, 4s | Members: codex_default (codex/default, done, 7m4s), codex_security (codex/security, done, 2m17s) | Total: 9m25s

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