perf(cli): load the conversation key only for the queue verbs that use it #4211
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.53) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.53 · 523 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.375
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4211"
general
weight: 0.35
openrig-review
The problem
Everyday
rig queue listandrig queue showbecame slower than in 0.7.26, by about 5% of a read's time on the reads measured. The cost is in the CLI process, not the daemon.For one
queue list --json, the CLI onmainopens four more modules than 0.7.26's. One module it already loaded also grew:@openrig/daemon/conversation-key: this re-exports from the openrig plugin's hook bridge script,assets/claude-hook-bridge.cjs.- That script is about 60 KB of CommonJS (49,659 B in 0.7.26, 58,972 B now). When an ES module imports it, Node reads the whole file for its named exports at every load, before compiling it.
- It now also brings
issued-conversation-address.- Importing this surface alone in a fresh process took a median 12.7 ms on 0.7.26's package and 20.1 ms on a later one (30 runs each).
rig queue listandrig queue shownever use it. Onlyrig queue createuses it, to record a conversation's key with--return-route auto, and the two handoff verbs use it to drop a given key. It was imported at the top ofcommands/queue.ts, so every queue command paid for it.What changes
commands/queue.tsloads the conversation key with a dynamicimport()inside the three actions that use it.withoutConversationKeystakes the prefix as an argument, so the constant is still defined in one place.rig queuemust not load it.How it was checked
main, the start-up test fails with "the conversation key was loaded with the queue command module". With the change, it passes.queuetest file, plus the MCP queue, lazy program, bin wrapper and daemon start tests: 32 files, 820 passed, 1 skipped.npm run lintpassed.- published 0.7.26 (A);
-
mainas packed (M);-
mainwith this change (F).Each command ran 100 rounds per CLI, the order rotating each round, and every exit was 0. Medians, with child CPU time (user + sys) from
wait4first and wall time second:| Read | M/A | F/A | F−M |
|---|---|---|---|
|
queue list --json| 1.050 / 1.034 | 0.939 / 0.974 | −40.5 / −15.3 ms ||
queue show <id> --full --json| 0.979 / 1.011 | 0.918 / 0.986 | −26.8 / −7.8 ms ||
view show escalations --json| 1.008 / 1.015 | 1.012 / 1.037 | +1.6 / +5.3 ms (noise; the same modules load) ||
--version| 0.992 / 0.994 | 1.009 / 1.020 | +3.0 / +3.9 ms (noise) |An earlier run on the same box gave F−M of −39.9 / −19.9 ms for
queue listand −32.1 / −12.4 ms forqueue show. With this change,queue listandqueue showload fewer modules than 0.7.26 did, because 0.7.26 loaded the hook bridge for them too.Limits
daemon-lifecyclenow also imports@openrig/daemon/bind-plan, which brings the bearer-token middleware. Every read command loads that (three files, about 13 KB). Its cost didn't show above noise onview show.- Moving it into the daemon start path would change that path's timing, and it made one fake-timer start test hang.
rig sendalso imports the conversation key at start-up (isIssuedConversationAddress, since #4141). It isn't a queue read and isn't changed here.🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Improvements
The queue command now loads conversation-key support only when needed, helping keep command startup lightweight.
Create and handoff operations continue to filter and deduplicate tags as before.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->