Event collector and user feedback tracking #9119

Closed
opened 2026-02-16 18:11:41 -05:00 by yindo · 2 comments
Owner

Originally created by @florianleibert on GitHub (Feb 11, 2026).

Originally assigned to: @thdxr on GitHub.

Task: Event collector and user feedback tracking

Description

Implement the event collection layer that subscribes to opencode's event bus to capture quality-relevant signals. This includes session events, LSP diagnostics, command execution, and inferred user feedback (accept, revert, redo, edit-after-apply). The collector aggregates signals and triggers the scoring engine.

Acceptance Criteria

  • packages/opencode/src/quality/collector.ts created
  • Subscribes to Session.Event.Updated — captures model_id, provider_id, tokens, cost, tool results, errors per assistant message
  • Subscribes to Session.Event.Diff — captures file changes (additions, deletions) for correctness signals
  • Subscribes to LSPClient.Event.Diagnostics — snapshots diagnostic state before/after response for static analysis delta
  • Detects revert signals from Session.Info.revert population — updates feedback score retroactively
  • Detects redo signals via prompt similarity heuristic (same topic within short time window)
  • Detects edit-after-apply via file change tracking (user edits files AI just modified)
  • All feedback signals trigger retroactive score update in SQLite via scorer
  • packages/opencode/src/quality/index.ts created — public API, initializes collector via Instance.state(), exposes Quality.init() and Quality.dispose()
  • Quality system initialized during project bootstrap when quality.enabled is true
  • All event subscriptions cleaned up on dispose

Technical Details

  • Use Bus.subscribe() for event subscriptions following existing patterns
  • Store LSP diagnostic snapshots in memory (Map<path, Diagnostic[]>) to compute deltas
  • For redo detection: hash prompt topics and compare against last N prompts — simple substring/keyword overlap, not full semantic similarity
  • For edit-after-apply: track which files were modified by the last AI response, watch for user modifications to same files within a time window (e.g., 60 seconds)
  • Initialize in packages/opencode/src/quality/index.ts using Instance.state(init, dispose) pattern

Dependencies

  • Task 001: SQLite storage layer
  • Task 002: Quality configuration
  • Task 003: Scoring engine

Effort Estimate

  • Size: L
  • Hours: 8-10
  • Parallel: false (depends on 001-003)
Originally created by @florianleibert on GitHub (Feb 11, 2026). Originally assigned to: @thdxr on GitHub. # Task: Event collector and user feedback tracking ## Description Implement the event collection layer that subscribes to opencode's event bus to capture quality-relevant signals. This includes session events, LSP diagnostics, command execution, and inferred user feedback (accept, revert, redo, edit-after-apply). The collector aggregates signals and triggers the scoring engine. ## Acceptance Criteria - [ ] `packages/opencode/src/quality/collector.ts` created - [ ] Subscribes to `Session.Event.Updated` — captures model_id, provider_id, tokens, cost, tool results, errors per assistant message - [ ] Subscribes to `Session.Event.Diff` — captures file changes (additions, deletions) for correctness signals - [ ] Subscribes to `LSPClient.Event.Diagnostics` — snapshots diagnostic state before/after response for static analysis delta - [ ] Detects revert signals from `Session.Info.revert` population — updates feedback score retroactively - [ ] Detects redo signals via prompt similarity heuristic (same topic within short time window) - [ ] Detects edit-after-apply via file change tracking (user edits files AI just modified) - [ ] All feedback signals trigger retroactive score update in SQLite via scorer - [ ] `packages/opencode/src/quality/index.ts` created — public API, initializes collector via `Instance.state()`, exposes `Quality.init()` and `Quality.dispose()` - [ ] Quality system initialized during project bootstrap when `quality.enabled` is true - [ ] All event subscriptions cleaned up on dispose ## Technical Details - Use `Bus.subscribe()` for event subscriptions following existing patterns - Store LSP diagnostic snapshots in memory (Map<path, Diagnostic[]>) to compute deltas - For redo detection: hash prompt topics and compare against last N prompts — simple substring/keyword overlap, not full semantic similarity - For edit-after-apply: track which files were modified by the last AI response, watch for user modifications to same files within a time window (e.g., 60 seconds) - Initialize in `packages/opencode/src/quality/index.ts` using `Instance.state(init, dispose)` pattern ## Dependencies - [ ] Task 001: SQLite storage layer - [ ] Task 002: Quality configuration - [ ] Task 003: Scoring engine ## Effort Estimate - Size: L - Hours: 8-10 - Parallel: false (depends on 001-003)
yindo added the needs:compliance label 2026-02-16 18:11:41 -05:00
yindo closed this issue 2026-02-16 18:11:41 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 11, 2026):

This issue doesn't fully meet our contributing guidelines.

What needs to be fixed:

  • This issue doesn't use one of our required templates. All issues must use one of these three templates:
    1. Bug Report — for reporting bugs (requires a Description field with real content)
    2. Feature Request — for suggesting enhancements (requires verification checkbox and description, with title starting with [FEATURE]:)
    3. Question — for asking questions (requires the Question field with real content)

Please edit this issue to follow one of these templates within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions[bot] commented on GitHub (Feb 11, 2026): <!-- issue-compliance --> This issue doesn't fully meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md). **What needs to be fixed:** - This issue doesn't use one of our required templates. All issues must use one of these three templates: 1. **Bug Report** — for reporting bugs (requires a Description field with real content) 2. **Feature Request** — for suggesting enhancements (requires verification checkbox and description, with title starting with [FEATURE]:) 3. **Question** — for asking questions (requires the Question field with real content) Please edit this issue to follow one of these templates within **2 hours**, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 11, 2026):

This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new issue that follows our issue templates.

@github-actions[bot] commented on GitHub (Feb 11, 2026): This issue has been automatically closed because it was not updated to meet our [contributing guidelines](../blob/dev/CONTRIBUTING.md) within the 2-hour window. Feel free to open a new issue that follows our issue templates.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9119