Skip to content

feat(copilot): add caching, incremental parsing, fixture tests, and agent launcher#145

Open
jacola wants to merge 7 commits intomarcus:mainfrom
jacola:feature/copilot-cli-adapter
Open

feat(copilot): add caching, incremental parsing, fixture tests, and agent launcher#145
jacola wants to merge 7 commits intomarcus:mainfrom
jacola:feature/copilot-cli-adapter

Conversation

@jacola
Copy link

@jacola jacola commented Feb 12, 2026

Summary

Builds on PR #115 by addressing the review feedback and adding Copilot CLI as a launchable agent.

Changes

1. Metadata/message caching

  • Added metaCache (map with path+size+modTime keys) for workspace.yaml reads
  • Added cache.Cache[messageCacheEntry] (LRU-bounded, 128 entries) for messages
  • Detect(), Sessions(), and sessionMatchesProject() now use readWorkspaceCached()
  • countMessagesCached() returns cached count when available

2. Incremental JSONL parsing

  • Messages() uses 3-way cache decision: exact hit → defensive copy, file grew → parseMessagesIncremental() via cache.IncrementalReader, otherwise full re-parse
  • Uses cache.NewScanner pool for scanner buffers
  • Fixed retroactive tool result linking (tool.execution_complete events arrive after assistant messages)

3. Fixture-based tests

  • Created testdata/ with 5 fixtures: workspace.yaml, valid_events.jsonl, tool_linking.jsonl, malformed.jsonl, empty.jsonl
  • All tests use setupTestSession() helper with temp dirs — no more t.Skip on missing real sessions
  • Added tests for: caching, incremental parsing, defensive copies, tool linking, malformed input, metadata caching
  • 16 tests, all pass in CI without requiring real Copilot sessions

4. Agent launcher (bonus)

  • Added AgentCopilot to workspace plugin so Copilot CLI appears in the agent selection UI when creating sessions

Testing

  • ✅ All 16 copilot adapter tests pass
  • ✅ All workspace plugin tests pass
  • ✅ Full go build ./cmd/sidecar/ succeeds
  • ✅ Manually verified in running sidecar

Related

mjneuharth and others added 7 commits February 9, 2026 14:40
Implement MessageSearcher interface for cross-conversation search.
Uses adapter.SearchMessagesSlice helper for efficient searching
with regex and case-sensitivity options.
Add Copilot CLI to the list of supported agents in both README
and conversations plugin documentation.
Use a.ID(), a.Name(), a.Icon() instead of constants directly
to match pattern used by all other adapters.
…gent launcher

Addresses PR review feedback:
- Add metadata cache (workspace.yaml) and message cache (cache.Cache[T])
  with path+size+modTime keys and LRU eviction
- Implement 3-way cache decision in Messages() (hit/grew/changed)
- Add incremental JSONL parsing via cache.IncrementalReader
- Fix retroactive tool result linking for tool.execution_complete events
- Add defensive copy helpers (copyMessages, copyStringMap)
- Replace environment-dependent tests with fixture-based tests using
  testdata/ (valid_events, tool_linking, malformed, empty)
- Use cache.NewScanner pool for scanner buffers
- Add GitHub Copilot CLI as launchable agent in workspace plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants