Skip to content

Ask Jev through one decision service - #257

Merged
BunsDev merged 4 commits into
mainfrom
decision-service
Oct 16, 2026
Merged

BunsDev merged 4 commits into
mainfrom
decision-service

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Routines Phase 0, step 2 of the routines spec: the shared decision service. "Move Auto routing and approval rules behind one module, with versioned question sets and a stored receipt for each judgment. Behaviour does not change."

What changes

  • routing/decisions.ts now owns the Jev connection, moved unchanged from Router: key resolution, CLI or HTTPS transport, the session-wide switch-off after an auth or billing rejection, the Settings test, and the connection half of status.

  • Versioned question sets. QUESTION_SETS = { routing: 1, follow_up: 1, approval: 1 }. The new APPROVAL_QUESTION_SET_VERSION (approvals/gate.ts) and FOLLOW_UP_QUESTION_SET_VERSION (routing/followup.ts) sit beside the routing set's existing QUESTION_SET_VERSION.

  • One door to Jev. decisions.connect(set, { threadId | preview }) returns a transport for one set, or says why there is none (disabled / unavailable). Auto routing, follow-up suggestions, the approval gate and Try it all go through it; router.jev() is gone.

  • Stored receipts. Every request through a connection appends one JSON line to ~/.modex/app/decisions.jsonl (mode 0600):

    • the set, version, model and transport;
    • the thread, or preview;
    • when it ran and how long it took;
    • Jev's typed answers (choice and confidence, score and confidence, or noul), or the error.

    The state sent to Jev is never stored. Past 4 MB the log starts over and keeps one previous file. A failed write is logged once and never touches a decision. The Settings ping is not a judgment and leaves no receipt.

Behaviour does not change

  • Router keeps its public API (status, test, setKey, clearKey, reset, route, followUp) and delegates.
  • Each caller keeps its own questions and failure handling. Routing falls back to the heuristic with byte-for-byte the same receipt reasons, follow-ups use the heuristic pick, and approvals fail closed.
  • An auth or billing rejection still switches Jev off for the whole session, now explicitly across all three sets.
  • The existing routing, follow-up, approval, settings-update and runner-routing tests pass unchanged.

Tests

test/decisions.test.ts:

  • the version registry, and that routing status still reports the routing set's version;
  • a routing receipt holds typed answers and never the request text;
  • an auth rejection on the approval set switches off routing and follow-ups, with routing's exact message, until reset();
  • an unconfigured judge asks nothing and stores nothing;
  • Try it receipts are marked preview;
  • receipt-log rotation, and that an unwritable log never throws.

Verification

  • pnpm build && pnpm test: all packages pass (desktop 1,426 passed, 0 failed).
  • playwright test e2e/approvals.spec.ts e2e/approval-policy.spec.ts: 6 passed.

Coven-Harness: Claude Code / claude-opus-5-5

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Oct 16, 2026 8:36am UTC

Request Review

@github-code-quality

github-code-quality Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main b8ac801 decision-service 81bb814 +/-
61% 61% 0%
View coverage of the 6 most impacted files.
File main b8ac801 decision-service 81bb814 +/-
apps/desktop/sr...ngine/runner.ts 99% 99% 0%
apps/desktop/sr...provals/gate.ts 100% 100% 0%
apps/desktop/sr...ckends/codex.ts 95% 95% 0%
apps/desktop/sr...uting/router.ts 100% 100% 0%
apps/desktop/sr...ing/followup.ts 94% 95% +1%
apps/desktop/sr...ng/decisions.ts 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 16, 2026 09:02 UTC

Routines Phase 0: Auto routing, follow-up suggestions and approval rules
(Try it included) now reach Jev through routing/decisions.ts. It owns the
key, the transport and the session-wide switch-off that the Router held,
names the three versioned question sets (routing, follow_up, approval),
and hands each caller a connection whose every request leaves a receipt
in app/decisions.jsonl: set, version, model, transport, thread or
preview, timing, and Jev's typed answers or the error. Receipts never
hold the state sent to Jev. The log starts over past 4 MB, keeping one
previous file.

Behaviour does not change: the Router keeps its API and delegates to the
service, each caller keeps its own questions and failure handling, and
the existing routing, follow-up and approval tests pass unchanged.

Coven-Harness: Claude Code / claude-opus-5-5
@BunsDev
BunsDev merged commit 79c5e2c into main Oct 16, 2026
13 checks passed
@BunsDev
BunsDev deleted the decision-service branch October 16, 2026 09:03
BunsDev added a commit that referenced this pull request Oct 19, 2026
… and the routines spec (#310)

v0.2.0 was published on 2026-10-18 (23:14Z) from the signed tag on 01b1b8a. This
follows Val's status layout (#290):

- Shipped gains a v0.2.0 row linking its release and its review.
- The 13 "On main, unreleased" items move unchanged to a new "Status summary"
  at the end of the v0.2.0 review, along with the old In flight entry. Each one
  was introduced by a commit in the tag (#248, #253, #254, #257 to #261, #263,
  #264, #266, #267, #269). The CF slices and #283's Markdown parser came after
  the tag, so they stay.
- In flight keeps a short follow-ups entry for the gates no receipt records yet:
  the independent download checks, the banner upgrade on the release Mac, and
  the Companion 0.2.0 (7) TestFlight upload.
- The routines spec and the README now say Phase 1, and most of Phase 0, ship
  from v0.2.0.

Unchanged: the website's static fallback (apps/site/release.json) and the
release evidence, which stay with the release owner. Claimed on #290.

Coven-Harness: Claude Code / claude-opus-5-5

This branch was successfully deployed

1 active deployment
Preview — 81bb8142 Deployed Oct 16, 2026 by vercel[bot]
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