Skip to content

fix(web): read conclusion level from the field Honcho actually sends - #92

Open
osyduck wants to merge 1 commit into
offendingcommit:mainfrom
osyduck:fix/dream-conclusion-level
Open

fix(web): read conclusion level from the field Honcho actually sends#92
osyduck wants to merge 1 commit into
offendingcommit:mainfrom
osyduck:fix/dream-conclusion-level

Conversation

@osyduck

@osyduck osyduck commented Aug 4, 2026

Copy link
Copy Markdown

Problem

Every dream card reports 0 deductive and 0 inductive, no matter what the backend actually produced.

inferConclusionType reads conclusion_type:

https://github.com/offendingcommit/openconcho/blob/main/packages/web/src/lib/dreams.ts#L55

No Honcho version returns that field. git grep conclusion_type finds it only in dreams.ts and its own tests — nothing produces it, so the ?? "explicit" fallback fires for every conclusion and the deductive/inductive chips are structurally pinned to zero.

The real field is level. From Honcho's own SDKs:

# sdks/python/src/honcho/api_types.py
class Conclusion(BaseModel):
    id: str
    content: str
    observer_id: str
    observed_id: str
    session_id: str | None = None
    level: ConclusionLevel = "explicit"
    created_at: datetime.datetime
// sdks/typescript/src/conclusions.ts
/**
 * Reasoning level: 'explicit' conclusions are extracted directly from
 * messages; 'deductive'/'inductive'/'contradiction' are derived during
 * dreaming.
 */
readonly level: ConclusionLevel

Verified against a live Honcho 3.0.11 instance — POST /v3/workspaces/{id}/conclusions/list returns:

{
  "id": "dTecvFzuSm3838v7aadlG",
  "content": "...",
  "observer_id": "claude",
  "observed_id": "claude",
  "session_id": "dudul-openconcho",
  "level": "deductive",
  "created_at": "2026-08-03T21:56:40.252268Z"
}

Across 800 conclusions on that instance: 740 explicit, 31 deductive, 29 inductive — all of which the dashboard was rendering as explicit.

Fix

Read level. Two details beyond the rename:

contradiction is a fourth level. A naive c.level ?? "explicit" would pass it straight through and crash two call sites that assume a closed 3-value set:

  • DreamDetail.tsxbuckets[inferConclusionType(c)].push(c) on a bucket record with only three keys → TypeError on undefined.push
  • PremiseTree.tsxTYPE_BADGE[type]TypeError reading cfg.bg

So contradiction is added as a first-class type: detail column, badge, and a list chip that stays hidden at zero (the three existing chips keep rendering dimmed at zero as before).

Unknown levels no longer reach the UI. level is typed string, not the union, and narrowed through CONCLUSION_TYPES. If Honcho adds a fifth level, the conclusion is counted as explicit instead of crashing the page or vanishing from the totals.

Notes for review

  • e2e/dreams.spec.ts has ~70 lines of re-indent noise. pnpm lint is biome check src/, so e2e/ was never formatted; the .husky/pre-commit hook (biome check --write --staged) reformatted the whole file when the mock rename was staged. No logic changed there beyond conclusion_type:level:. Happy to strip it if you'd rather keep the diff to the five renamed lines.
  • openapi.json is Honcho 3.0.5, which exposes neither field, so ExtendedConclusion is still needed. Regenerating against a newer spec would let level become a first-class typed field and drop the augmentation — left alone here since that's a bigger call.
  • premises and reasoning_tree are genuinely unserved. A full conclusion object from live 3.0.11 has exactly seven keys; neither field appears on the list or detail response. expandPremiseTree and PremiseTree therefore never render children today. Left untouched — separate concern from this fix.
  • Honcho main has since renamed observer_idobserver in src/schemas/api.py, so a future API bump will need a wider sweep than this.

Verification

  • pnpm check (lint + typecheck + test) passes
  • packages/web/src/test/dreams.test.ts — 15 tests pass, including a new case asserting an unrecognized level counts as explicit rather than being dropped
  • Confirmed in a running dashboard against the live instance above: dream cards now show 5 deductive, 6 deductive / 9 inductive, 6 inductive for three consecutive runs whose raw API timestamps and levels match exactly

Dream cards always showed 0 deductive and 0 inductive. The type inference read
`conclusion_type`, which no Honcho version returns; live 3.0.11 sends `level`.
Every conclusion therefore hit the "explicit" fallback.

Verified against a live instance: 87 explicit, 8 inductive, 5 deductive in the
first page of conclusions.

`premises` and `reasoning_tree` are still unserved, so the premise tree stays
empty until Honcho ships them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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