jev mods: an unset effort skips the downgrade bar, and a null body throws

Author: erikpr1994Created Sep 25, 2026Updated Sep 25, 2026

We use jev-model-router and jev-skill-suggestion in our repository. A code review found two bugs and two README lines that do not match the code. We fixed them in our vendored copy. A reinstall with --mod would remove our fixes, so we ask you to take them upstream.

1. An unset effort skips the confidence bar (jev-model-router)

In route() in hooks/policy.ts, comparable is typeof current.effort !== 'number'. When current.effort is undefined, effortRank() returns null. allowed() then reads the move as an upgrade. A move to low can be a downgrade from the engine's default effort, but it only needs minUpgradeConfidence. A backend with no confidence passes it with no check. The README says that an answer with no confidence can only move a request up.

Fix: an unset effort is comparable only when risk forces the change.

2. A JSON null body throws out of prompt.submit (both mods)

JSON.parse('null') returns null, and the next line reads .answers (or .plugins) on it. The read is outside the try, so it throws a TypeError. The READMEs say that a malformed body leaves the request as it was. This affects three functions:

  • readDecision in jev-model-router/hooks/policy.ts
  • answersOf in jev-skill-suggestion/hooks/policy.ts (reached through readWide and readRerank)
  • installPathsOf in jev-skill-suggestion/hooks/policy.ts

Fix: return null (or []) when the parsed value is not an object. readSkillSettings already has this guard.

3. Two README lines do not match policy.ts (jev-model-router)

  • Line 30 says the threshold does not apply to the built-in path. allowed() lets an answer with no confidence move a request up only.
  • Line 38 describes risky with the old question text. questions() now asks whether carrying out the task would itself change production, move real money or alter data that cannot be restored.

Patch

Each new test fails without its fix and passes with it. bun test passes 73 of 73.

diff
diff --git a/cli-tool/components/mods/productivity/jev-model-router/hooks/policy.ts b/cli-tool/components/mods/productivity/jev-model-router/hooks/policy.ts
index ad892bd60..46a89bae3 100644
--- a/cli-tool/components/mods/productivity/jev-model-router/hooks/policy.ts
+++ b/cli-tool/components/mods/productivity/jev-model-router/hooks/policy.ts
@@ -183,6 +183,7 @@ export function readDecision(responseText: string): Decision | null {
   } catch {
     return null
   }
+  if (!parsed || typeof parsed !== 'object') return null
   const answers = (parsed as { answers?: Record<string, Record<string, unknown>> }).answers
   if (!answers) return null
 
@@ -374,7 +375,10 @@ export function route(
     if (forced && currentRank !== null) wantedRank = Math.max(wantedRank, currentRank)
 
     // A numeric effort is the caller's own scale, not this ladder; leave it.
-    const comparable = typeof current.effort !== 'number'
+    // An unset effort has no place on the ladder either, so only a risk
+    // override may set it.
+    const comparable =
+      typeof current.effort === 'string' || (forced && current.effort === undefined)
     const wanted = EFFORT_ORDER[Math.min(EFFORT_ORDER.length - 1, wantedRank)] as Effort
     if (
       comparable &&
diff --git a/cli-tool/components/mods/productivity/jev-model-router/tests/policy.test.ts b/cli-tool/components/mods/productivity/jev-model-router/tests/policy.test.ts
index fc8e47d3e..639ceb840 100644
--- a/cli-tool/components/mods/productivity/jev-model-router/tests/policy.test.ts
+++ b/cli-tool/components/mods/productivity/jev-model-router/tests/policy.test.ts
@@ -59,6 +59,7 @@ test('a distribution is optional in the response schema, so confidence may be ab
 test('malformed or unexpected payloads read as no decision rather than throwing', () => {
   expect(readDecision('not json')).toBeNull()
   expect(readDecision('{}')).toBeNull()
+  expect(readDecision('null')).toBeNull()
   expect(readDecision(JSON.stringify({ answers: { tier: { type: 'choice', choice: 'cheap' } } }))).toBeNull()
 })
 
@@ -92,6 +93,14 @@ test('a numeric effort is the caller\'s own scale and is left alone', () => {
   expect(route(decision, { model: 'claude-opus-5', effort: 4000 }, config).effort).toBeNull()
 })
 
+test('an unset effort is left alone unless risk forces it', () => {
+  const low = readDecision(gatewayAnswer('fast', { fast: 0.95 }, 0.01, 0.1))
+  expect(route(low, on('claude-opus-5'), config).effort).toBeNull()
+
+  const risky = readDecision(gatewayAnswer('fast', { fast: 0.99 }, 0.95, 0))
+  expect(route(risky, on('claude-opus-5'), config).effort).toBe('high')
+})
+
 test('the rubric score maps onto the reasoning ladder', () => {
   expect(effortLevel(0)).toBe('low')
   expect(effortLevel(0.4)).toBe('low')
diff --git a/cli-tool/components/mods/productivity/jev-skill-suggestion/hooks/policy.ts b/cli-tool/components/mods/productivity/jev-skill-suggestion/hooks/policy.ts
index 11dd84d67..9a6ebb3f7 100644
--- a/cli-tool/components/mods/productivity/jev-skill-suggestion/hooks/policy.ts
+++ b/cli-tool/components/mods/productivity/jev-skill-suggestion/hooks/policy.ts
@@ -279,6 +279,7 @@ export function installPathsOf(installedJson: string, plugin: string): string[]
   } catch {
     return []
   }
+  if (!parsed || typeof parsed !== 'object') return []
   const plugins = (parsed as { plugins?: Record<string, { installPath?: string }[]> }).plugins
   if (!plugins) return []
   const paths: string[] = []
@@ -487,6 +488,7 @@ function answersOf(responseText: string): Answers | null {
   } catch {
     return null
   }
+  if (!parsed || typeof parsed !== 'object') return null
   const answers = (parsed as { answers?: Answers }).answers
   return answers && typeof answers === 'object' ? answers : null
 }
diff --git a/cli-tool/components/mods/productivity/jev-skill-suggestion/tests/policy.test.ts b/cli-tool/components/mods/productivity/jev-skill-suggestion/tests/policy.test.ts
index 26d1b2b3e..0bfbf123c 100644
--- a/cli-tool/components/mods/productivity/jev-skill-suggestion/tests/policy.test.ts
+++ b/cli-tool/components/mods/productivity/jev-skill-suggestion/tests/policy.test.ts
@@ -273,6 +273,7 @@ test('skill bodies are looked for where Claude Code lays skills out', () => {
   })
   expect(installPathsOf(installed, 'engineering')).toEqual(['/x/cache/engineering/1.0.0'])
   expect(installPathsOf('not json', 'engineering')).toEqual([])
+  expect(installPathsOf('null', 'engineering')).toEqual([])
   // A name that is not a plain basename is never spliced into a path.
   expect(skillFileCandidates('../etc/passwd')).toEqual([])
   expect(skillFileCandidates('x', '..')).toEqual([])
@@ -466,3 +467,8 @@ test('only a file with the backup\'s own shape is treated as a reusable backup',
   expect(validBackup('{nope')).toBe(false)
   expect(validBackup('[]')).toBe(false)
 })
+
+test('a null response body reads as no answer rather than throwing', () => {
+  expect(readWide('null')).toBeNull()
+  expect(readRerank('null')).toBeNull()
+})
diff --git a/cli-tool/components/mods/productivity/jev-model-router/README.md b/cli-tool/components/mods/productivity/jev-model-router/README.md
index 8b04d2353..c75c1a9e9 100644
--- a/cli-tool/components/mods/productivity/jev-model-router/README.md
+++ b/cli-tool/components/mods/productivity/jev-model-router/README.md
@@ -30 +30 @@ The prompt is classified at `prompt.submit`, which runs before the turn starts,
-**With no key configured the mod still works**: it falls back to the engine's own `$.model.classify`, which answers the same question with the small fast model. That path reports no confidence, so the threshold does not apply to it.
+**With no key configured the mod still works**: it falls back to the engine's own `$.model.classify`, which answers the same question with the small fast model. That path reports no confidence, so it may only move a request up.
@@ -38 +38 @@ One request, three questions evaluated in parallel:
-- `risky` — whether the task touches production, money, credentials, or state that cannot be undone. A `noul` on TypeSafe's API, a `boolean` on the Gateway: the same question under two names.
+- `risky` — whether carrying out the task would itself change production, move real money, or alter data that cannot be restored (writing or testing such code does not count). A `noul` on TypeSafe's API, a `boolean` on the Gateway: the same question under two names.

Source: davila7/claude-code-templates