Skip to content

The ontology agent writes labels and definitions in the base's ontology_lang, since an empty ontology has no language to follow - #1468

Merged
WaylandYang merged 1 commit into
deeplethe:devfrom
Schro-code:fix/ontology-agent-language
Nov 4, 2026
Merged

WaylandYang merged 1 commit into
deeplethe:devfrom
Schro-code:fix/ontology-agent-language

Conversation

@Schro-code

@Schro-code Schro-code commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

Refs #1467. #1129 retired Suggest, and with it the only prompt that named kb.ontology_lang for generated labels and descriptions (0004 decisions 3 and 5). The 0061 agent asked for "the language of the ontology", and that fails in two cases:

Labels had no language rule at all. On one Spanish base, a single round left 183 class proposals, and about two thirds of them had English definitions.

What changes

  • crates/utopia-extract/src/ontology_agent.rs: build_proposal_messages takes the base's ontology_lang. The system prompt now says "Write every label and definition in {LANGUAGE}, even where the shapes, the ontology or these instructions use another; keys stay snake_case ASCII." zh reads as Chinese and anything else as English, the same rule describe_data uses in mappings.rs.
  • crates/utopia-server/src/ontology_agent.rs: propose_with already loads the base, and now hands it to propose_locked, so the caller states the language.
  • docs/decisions/0004-language-and-localization.md: decision 5 keeps its text, with a dated revision note in place where it named lang_name(). The status line says it was revised.

Record: this revises 0004 decision 5, and the status line is updated.

Not in this PR:

  • Rewriting proposals that already exist. signatures_already_proposed keeps the agent from proposing a shape again.
  • Other model-written reasons, such as errata and adjudication.

How it was checked

  • On macOS (arm64), on dev @ fbe13bd:
    • cargo fmt --all --check: clean.
    • cargo clippy --locked --workspace --all-targets -- -D warnings: clean.
    • cargo test --locked --workspace: 1810 passed, 0 failed, 6 ignored.
  • UTOPIA_DATABASE_URL was not set, so the store's SQL tests and the server tests that run propose skipped locally; CI runs them.
  • the_prompt_names_every_input_once now passes zh and asserts that the system prompt says "definition in Chinese". The assertion fails on dev.
  • Not run against a model.

Before review

  • Every commit is signed off (git commit -s)
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass
  • A change to the data model, the ontology contract or a public API has its ADR in docs/decisions/: 0004 decision 5 revised in place

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this. 0004 decisions 3 and 5 make `kb.ontology_lang` the language of generated labels and descriptions, and the caller states it. The documents' language would ignore that setting on a base set to `zh` with English documents. Please take the alternative from #1467: pass the base's `ontology_lang` into the prompt, for labels and definitions, with keys staying ASCII. The stale `lang_name()` mention in 0004 decision 5 should be updated in the same PR.

…gy_lang, since an empty ontology has no language to follow

Signed-off-by: Schro-code <78734653+Schro-code@users.noreply.github.com>
@Schro-code
Schro-code force-pushed the fix/ontology-agent-language branch from 0200896 to 398de58 Compare November 3, 2026 08:50
@Schro-code Schro-code changed the title The ontology agent writes labels and definitions in the documents' language, since an empty ontology has none to follow The ontology agent writes labels and definitions in the base's ontology_lang, since an empty ontology has no language to follow Nov 3, 2026
@Schro-code

Copy link
Copy Markdown
Contributor Author

Thanks, done. The agent now takes kb.ontology_lang from its caller (propose_with hands the base to propose_locked) and names it in the prompt for labels and definitions, with keys staying snake_case ASCII. zh reads as Chinese and anything else as English, as in describe_data. 0004 decision 5 has a dated revision note in place, covering lang_name() and the cold-start path, which both went in #1129. The branch is one commit on current dev.

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this matches 0004. Merging.

@WaylandYang
WaylandYang merged commit d026704 into deeplethe:dev Nov 4, 2026
6 checks passed
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.

2 participants