From ca7ae1bcfb9d96c500db1dd230c9f55468aecca8 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 17 Oct 2026 23:03:21 +0200 Subject: [PATCH] fix(harness): realign SKILL projection and tests with question-language detection bd416f73 hand-edited SKILL.md; port the same Language contract change to projection.md.tmpl so the rendered projection is byte-identical again, and update the approved baseline hash. The Postgres language-authority test predated question detection: give the legacy manifest a too-short question so it still proves the workspace fallback is pinned once and never re-read. Also fix ruff E701 in test_administration.py. Co-Authored-By: Claude Opus 5.5 --- harness/.pi/skills/tht-sessione/projection.md.tmpl | 12 +++++++++--- harness/tests/memory/test_administration.py | 3 ++- harness/tests/test_pi_skill_projection.py | 4 ++-- harness/tests/test_postgres_session_repository.py | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/harness/.pi/skills/tht-sessione/projection.md.tmpl b/harness/.pi/skills/tht-sessione/projection.md.tmpl index 01adf777..bc5af11f 100644 --- a/harness/.pi/skills/tht-sessione/projection.md.tmpl +++ b/harness/.pi/skills/tht-sessione/projection.md.tmpl @@ -17,19 +17,25 @@ confirmation and is persisted directly — an option without a payload only asks Continue records the complete join set), `reviewer_confirm` (gate on an artifact / phase transition). Free text arrives via the "Altro/Other" option or by prefixing `!` in chat. -**Language contract:** the session manifest's `interaction_language` controls all +**Language contract:** session creation detects the original question's language and +pins it as `interaction_language` (the UI/CLI preference is only a fallback for +short or ambiguous input). The session manifest's `interaction_language` controls all new reviewer questions, explanations, option labels and rationales, including prose you generate inside review artifacts. It remains authoritative throughout the session, including resume and steering from a browser using a different UI locale. The gate injects this persisted language into each model turn; the language of these instructions -and examples does not select the output language. +and examples does not select the output language. Before each reviewer tool call, +check that every generated title, intro, question, option label, rationale and +artifact explanation is in that language. Rewrite mismatched prose before calling +the tool; retain identifiers and quoted source values verbatim. `workspace.language` controls workspace-owned documents, catalog descriptions, Evidence and interpretation of domain terms. Preserve quoted source content and prior decisions verbatim. Keep SQL, identifiers, literal values and workspace artifacts unchanged by the interaction preference. Ask about ambiguous domain terms in the interaction language. For a legacy manifest without the field, run `tht session ensure-interaction-language - --json` before interacting: it pins workspace language once and accepts no override. + --json` before interacting: it detects the original question's language with +workspace language as fallback, pins it once and accepts no override. ## Phase map (advance cheat-sheet) diff --git a/harness/tests/memory/test_administration.py b/harness/tests/memory/test_administration.py index 5830f613..49e4eea3 100644 --- a/harness/tests/memory/test_administration.py +++ b/harness/tests/memory/test_administration.py @@ -798,7 +798,8 @@ def test_physical_cleanup_uses_exact_dependencies_and_recovers_failed_vector_del vectors.fail = True result = cleanup(s, request) assert result == {"deleted": 1, "indexed": False} - with pytest.raises(MemoryNotFound): s.get(removed) + with pytest.raises(MemoryNotFound): + s.get(removed) assert {c["id"] for c in s.list(CardQuery())["items"]} == set(surviving) vectors.fail = False assert cleanup(s, request) == {"deleted": 1, "indexed": True} diff --git a/harness/tests/test_pi_skill_projection.py b/harness/tests/test_pi_skill_projection.py index 1e9705f0..0014ae97 100644 --- a/harness/tests/test_pi_skill_projection.py +++ b/harness/tests/test_pi_skill_projection.py @@ -9,8 +9,8 @@ from tht.pi_skill_projection import ( render_projection, ) -# Approved session-language contract (#35); unrelated workflow fragments stay byte-identical. -BASELINE_SHA256 = "a2e6608e1aa07735ef92d96b3a87fca3bfbe3636754330ff6749178c87a37493" +# Approved session-language contract (#35) with question-language detection; unrelated workflow fragments stay byte-identical. +BASELINE_SHA256 = "ffa660b15defe89290f4a6f7de1b8372fb71e25935b0eef22a4575b5d97d2603" def test_modular_pi_skill_renders_the_byte_identical_approved_projection(): diff --git a/harness/tests/test_postgres_session_repository.py b/harness/tests/test_postgres_session_repository.py index 91e2ac13..bb6edf0e 100644 --- a/harness/tests/test_postgres_session_repository.py +++ b/harness/tests/test_postgres_session_repository.py @@ -118,7 +118,8 @@ def test_cli_creation_and_resume_use_postgres_language_authority(database_url, m session_id = json.loads(invoke("new", "Pazienti", "--interaction-language", "en", "--json"))["id"] invoke("reopen", session_id) assert json.loads(invoke("show", session_id, "--json"))["interaction_language"] == "en" - legacy = _manifest(str(uuid.uuid4())) + # Too short to detect: the legacy pin falls back to the workspace language, once. + legacy = _manifest(str(uuid.uuid4())).model_copy(update={"question": "Ablazioni?"}) _repository(database_url, "cli-language").create(legacy) invoke("reopen", legacy.id) cfg.language = "en"