Skip to content

[WRONG BRANCH] chore: sync metrics lane with current dev - #43

Merged
OnlineChef merged 1 commit into
feat/prometheus-metricsfrom
dev
Aug 2, 2026
Merged

[WRONG BRANCH] chore: sync metrics lane with current dev#43
OnlineChef merged 1 commit into
feat/prometheus-metricsfrom
dev

Conversation

@OnlineChef

@OnlineChef OnlineChef commented Aug 2, 2026

Copy link
Copy Markdown

Temporary branch-sync PR: merge the current dev tip, including merged plugin lane #40, into feat/prometheus-metrics. The metrics files are disjoint from the plugin lane; this keeps PR #42 based on the actual integration head before final validation.


View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

Greptile Summary

This change adds a typed, privacy-preserving plugin registry with request-scoped sessions, immutable lifecycle payloads, hook timeouts, and failure isolation. Focused registry tests pass, but a real streamed /v1/chat/completions request never invokes a registered plugin because the production request path does not create or dispatch a plugin session.

Merge safety: do not merge this as a functional plugin-lifecycle feature until production request handling wires the registry into adapter-request, event-stream, completion, and error paths.

Confidence Score: 4/5

Not safe to merge as an operational plugin lifecycle because real proxy requests bypass every plugin hook.

The central behavior added by this change was exercised against a real streamed proxy request and did not run despite a registered plugin. The isolated registry implementation and its focused tests behave correctly, but they do not establish integration with request processing.

Files Needing Attention: src/plugins/index.ts needs wiring from the shared production request and adapter lifecycle; the relevant production routing path begins in src/server/index.ts.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for the posted P1 finding and attached artifacts that chronicle the lifecycle probe and a sequence of proxy- and registry-related checks: a focused production lifecycle probe source, a production proxy request before plugin registration, a production proxy request after plugin registration with no observed hooks, a production registry reachability scan with no matches, and the plugin registry unit test results.
  • T-Rex validated contract behavior, confirming that sessions are only created when invoked, that lifecycle dispatch and the global registry are located at the cited code sections, that the real request router directs chat requests to handleChatCompletions without registry/session invocation, and that after-capture production-probe registration yields a complete 200 streamed response with observedHooks: [].

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P1 Plugin lifecycle registry is never integrated into production requests

    • Bug
      • The newly added registry can register plugins and dispatch lifecycle hooks in unit tests, but no production request handler imports the plugin module, creates a request session, or observes adapter events. A plugin registered before a real successful /v1/chat/completions request received zero hooks.
    • Cause
      • src/plugins/index.ts adds an isolated registry/session API but no request lifecycle integration was added. The production chat route at src/server/index.ts:651-666 invokes handleChatCompletions directly; production-wide reachability scan found no calls to pluginRegistry, PluginRegistry, createSession, beforeAdapterRequest, observeAdapterEvents, onRequestComplete, or onRequestError.
    • Fix
      • At the shared request/adapter boundary, import the global registry, create a session with the resolved request context, invoke beforeAdapterRequest around each outbound adapter attempt, wrap the actual adapter event iterable with observeAdapterEvents, and invoke exactly one completion/error hook for every terminal outcome. Cover each supported request surface or explicitly narrow/document the supported surface.

    T-Rex Ran code and verified through T-Rex

Fix All in Cursor Fix All in Codex Fix All in Claude Code Fix All in Conductor

Prompt To Fix All With AI
### Issue 1
src/plugins/index.ts:460
**Plugin lifecycle is never invoked by production requests**

The registry is exported here, but no production request handler imports it, creates a request session, or dispatches its hooks. A real streamed `POST /v1/chat/completions` request completed successfully after registering a global plugin, yet the plugin recorded no request, adapter-event, completion, or error callbacks. The feature is therefore inert outside the isolated unit tests. Wire session creation and dispatch into the shared request/adapter lifecycle, including event-stream wrapping and terminal completion/error handling.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(plugins): add typed observational l..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Adds the internal compile-time plugin contract with bounded hook timeouts, request-scoped failure isolation, immutable structural payloads, class-instance hook support, and focused privacy/order tests.

Validated by the full Linux, macOS, and Windows CI matrix including tests, privacy scan, GUI checks, and global package smokes.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • ^dev$
  • ^preview$

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 559416b6-047d-463f-ae76-daa90e8dcd4e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

⚠️ Wrong target branch

This pull request currently targets feat/prometheus-metrics, but pull requests must target one of dev or dev2-go.

Its title has been prefixed with [WRONG BRANCH].

OnlineChef Please retarget this PR to dev. Most contributions go to dev first; use dev2-go only for scoped Go native-port work. main receives only release promotions. See our Contributing guide for details. Thanks! 🙏

This pull request is being kept as a draft automatically. Once the target branch is corrected, it will be marked ready for review again.

@github-actions github-actions Bot changed the title chore: sync metrics lane with current dev [WRONG BRANCH] chore: sync metrics lane with current dev Aug 2, 2026
@OnlineChef
OnlineChef merged commit e3debd9 into feat/prometheus-metrics Aug 2, 2026
11 of 14 checks passed
Comment thread src/plugins/index.ts
}

/** Compile-time registration surface. It is intentionally empty by default. */
export const pluginRegistry = new PluginRegistry();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Plugin lifecycle is never invoked by production requests

The registry is exported here, but no production request handler imports it, creates a request session, or dispatches its hooks. A real streamed POST /v1/chat/completions request completed successfully after registering a global plugin, yet the plugin recorded no request, adapter-event, completion, or error callbacks. The feature is therefore inert outside the isolated unit tests. Wire session creation and dispatch into the shared request/adapter lifecycle, including event-stream wrapping and terminal completion/error handling.

Artifacts

Focused production lifecycle probe source

  • This authored Bun probe registers a plugin, starts the real proxy and a local streaming adapter, then sends a real chat-completions request; it demonstrates the exact exercised path.

Production proxy request before plugin registration

  • The before run starts the proxy and mock adapter and receives a complete 200 SSE response without a registered plugin, establishing the comparison baseline.

Production proxy request after plugin registration with no observed hooks

  • The after run registers `production-probe`, receives the same complete 200 SSE response, and logs an empty `observedHooks` array, proving the registry is not connected.

Production registry reachability scan with no matches

  • The production-only source scan exits with ripgrep status 1 and no matches for registry/session imports or lifecycle dispatch calls, confirming no static production integration.

Plugin registry unit test results

  • The PR’s focused registry tests pass 10 of 10, showing the isolated API works while the production wiring remains absent.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/plugins/index.ts
Line: 460

Comment:
**Plugin lifecycle is never invoked by production requests**

The registry is exported here, but no production request handler imports it, creates a request session, or dispatches its hooks. A real streamed `POST /v1/chat/completions` request completed successfully after registering a global plugin, yet the plugin recorded no request, adapter-event, completion, or error callbacks. The feature is therefore inert outside the isolated unit tests. Wire session creation and dispatch into the shared request/adapter lifecycle, including event-stream wrapping and terminal completion/error handling.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Cursor Fix in Codex Fix in Claude Code Fix in Conductor

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.

1 participant