Skip to content

fix(queue): expose re-enqueue counts in queue status#1337

Merged
chenjw merged 1 commit intomainfrom
fix/queue-reenqueue-observability
Apr 9, 2026
Merged

fix(queue): expose re-enqueue counts in queue status#1337
chenjw merged 1 commit intomainfrom
fix/queue-reenqueue-observability

Conversation

@qin-ctx
Copy link
Copy Markdown
Collaborator

@qin-ctx qin-ctx commented Apr 9, 2026

Description

Expose semantic and embedding re-enqueue activity as first-class queue observability so retry loops are visible in queue status, wait payloads, and telemetry summaries instead of being hidden behind successful re-acks.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • add requeue_count to queue status and request-scoped queue tracking for semantic and embedding work
  • increment requeue counters exactly on semantic and embedding re-enqueue paths, including circuit-breaker driven retries
  • surface the new metric in observer queue tables, wait_processed payloads, resource wait telemetry, and related tests

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

image

Additional Notes

Targeted local verification:

  • python -m py_compile openviking/storage/queuefs/semantic_processor.py openviking/storage/collection_schemas.py openviking/storage/queuefs/named_queue.py openviking/telemetry/request_wait_tracker.py openviking/telemetry/resource_summary.py openviking/telemetry/operation.py openviking/service/resource_service.py openviking/storage/observers/queue_observer.py
  • python -m pytest -o addopts='' tests/telemetry/test_request_wait_tracker.py -q
  • python -m pytest -o addopts='' tests/storage/test_collection_schemas.py -q
  • python -m pytest -o addopts='' tests/telemetry/test_resource_summary.py tests/test_telemetry_runtime.py -q
  • python -m pytest -o addopts='' tests/server/test_request_wait_tracking.py -q

Track semantic and embedding re-enqueues as first-class queue metrics so
observer output, wait_processed payloads, and telemetry summaries make
retry loops visible before they escalate into hard errors.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🏅 Score: 92
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ Recommended focus areas for review

Backward Compatibility Risk

The set_callbacks method added on_requeue as a required positional parameter between on_success and on_error. This breaks any external or existing code that calls set_callbacks with positional arguments.

def set_callbacks(
    self,
    on_success: Callable[[], None],
    on_requeue: Callable[[], None],
    on_error: Callable[[str, Optional[Dict[str, Any]]], None],
) -> None:
    """Set callback functions."""
    self._success_callback = on_success
    self._requeue_callback = on_requeue
    self._error_callback = on_error
Code Duplication / Consistency

RequestQueueStats is defined in both semantic_processor.py and collection_schemas.py, with the former missing the @dataclass decorator. This could lead to inconsistencies.

class RequestQueueStats:
    processed: int = 0
    requeue_count: int = 0
    error_count: int = 0

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

@chenjw chenjw merged commit d72c6c9 into main Apr 9, 2026
5 of 6 checks passed
@chenjw chenjw deleted the fix/queue-reenqueue-observability branch April 9, 2026 11:55
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants