Skip to content

Request drawer: the whole routing decision; name requests that reached no upstream - #209

Merged
fylorn merged 2 commits into
devfrom
fix/drawer-routing-decision
Sep 25, 2026
Merged

fylorn merged 2 commits into
devfrom
fix/drawer-routing-decision

Conversation

@fylorn

@fylorn fylorn commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Core 0.48 (#202) records the whole routing decision on every non-local row — route, deciding rule, group, rewritten_by, denied_by, attempts — and keeps a row for requests that went to no upstream (upstream ""). The request drawer showed only the rule and the group, and those rows came up as a "?" letter tile in the command palette.

Routing tab

  • Route, matched rule (marked Denied with the routing map's deny glyph when that rule refused the request before an upstream was chosen), via group, rewritten by (the rules that rewrote the request, in evaluation order), denied by (the phase-two rule), and reason — the rule's own deny text, or core's sentence when no selected upstream could serve the request.
  • A hop denied by a phase-two rule reads "Not sent · denied by rule X" (deny glyph, no latency) instead of an amber upstream failure.
  • The note under the chain only says what literally happened:
    • failover, then denied: "the first N upstreams failed, and after the switch to the next upstream, rule X denied the request before it was sent there"
    • denied on the only hop: "…after the upstream was chosen; it was not sent to any upstream"
    • phase one: "Rule X denied this request before an upstream was chosen; it was not sent to any upstream"
    • no selected upstream can serve it; routing not finished; no attempts recorded — as before.

The ordering is a pure function, routingFacts in src/requestRouting.ts, next to notSent (denied vs no upstream, read from the empty upstream plus core's gw.route.denied code — both core facts, nothing inferred from the config). Both are unit-tested.

Requests that reached no upstream

Traffic table, drawer header and timeline, and command palette results now show the deny glyph (red, same as the routing map) or a crossed-out upstream (neutral) with Denied / No upstream (zh 规则拒绝 / 无可用上游), instead of an empty cell, a missing header item or a "?" tile. Rows a phase-two rule denied keep the upstream core attributes them to; the timeline marks it "(not sent)".

Local answers (core records them with no model and the probe kind as the path) get the gateway icon and the probe name as their palette title and drawer title, instead of a letter tile made from "Answered locally".

Other places that draw an upstream logo were checked: the session header and session rows already skip empty upstreams, the security log guards e.provider, and core's per-upstream latency excludes ''.

IconDenied (Ban) and IconNoUpstream (ServerOff) join the icon vocabulary; the routing map, dry run and route dialog now use IconDenied, so the glyph has one source.

Verification

  • pnpm typecheck, pnpm test (415 passed), pnpm build.
  • Full preview harness with core-0.48-shaped rows: a phase-one denial, a phase-two denial on the second hop (anthropic 529 → openrouter denied), a request no selected upstream could serve, failovers rewritten by a phase-two rule, local answers. Checked zh/en and light/dark: drawer routing tab and header, traffic table (English labels stay on one line; table width unchanged), palette search by model and by id.

🤖 Generated with Claude Code

fylorn and others added 2 commits September 25, 2026 15:33
…d no upstream

Core 0.48 records the full routing decision on every non-local row (route,
deciding rule, group, rewritten_by, denied_by, attempts) and keeps a row for
requests that went to no upstream. The drawer showed only the rule and the
group, and rows with an empty upstream showed a "?" tile in the command palette.

- Routing tab: route, the deciding rule (marked when it denied the request
  before an upstream was chosen), group, the rules that rewrote the request in
  evaluation order, the phase-two rule that denied it, and the reason (the
  rule's own text, or core's sentence when no selected upstream could serve
  it). A hop denied by a phase-two rule reads "Not sent · denied by rule X"
  instead of looking like an upstream failure, and the note under the chain
  says only what happened: failed over and then denied, denied before or
  after the upstream was chosen, or no selected upstream can serve it.
- src/requestRouting.ts: `notSent` (denied vs no upstream, from the empty
  upstream and core's `gw.route.denied`) and `routingFacts` (RoutingView and
  the row's error into what the tab shows), with tests.
- Requests that reached no upstream: the traffic table, the drawer header and
  timeline, and the command palette show the routing map's deny glyph or a
  crossed-out upstream with "Denied" / "No upstream". Local answers in the
  palette get the gateway icon and the probe name as their title (core records
  them with no model and the probe kind as the path).
- IconDenied and IconNoUpstream join the icon vocabulary; the routing map, the
  dry run and the route dialog use IconDenied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…letter tile

A request that core started with no upstream is in flight only until its
failure arrives. Draw it with the request icon in that moment too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 92f6e8b into dev Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the fix/drawer-routing-decision branch September 25, 2026 07:42
@fylorn fylorn mentioned this pull request Sep 25, 2026
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