fix(7883): a lesson recorded for reply.report reaches the turn before the reply, and reply.ask is not offered to a lesson
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / integration (push) Successful in 2m0s
CI & Build / Python tests (push) Successful in 3m48s
CI & Build / Build & push image (push) Successful in 20s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / integration (push) Successful in 2m0s
CI & Build / Python tests (push) Successful in 3m48s
CI & Build / Build & push image (push) Successful in 20s
Situated lessons arrived only at tool acts and in MCP replies, so a lesson given a reply moment was accepted and never shown. The per-turn delivery now carries lessons confirmed on reply.report, once per session, between the turn's rules and its reply shape. reply.ask is known only after the reply is written, so lesson_situations refuses it and leaves it out of the catalog the pass and the lesson page offer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,11 +30,11 @@ SESSION_START = ROOT / "plugin" / "hooks" / "grimoire_session_context.sh"
|
||||
# ── the route ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
async def _retrieve(query_string, turn_context="CORE SHAPE"):
|
||||
async def _retrieve(query_string, turn_context="CORE SHAPE", turn_value=None):
|
||||
from grimoire.routes import plugin as routes
|
||||
|
||||
turn = AsyncMock(return_value={"context": turn_context, "rule_ids": [173],
|
||||
"shape_forms": {"core": reply_shapes.FULL}})
|
||||
turn = AsyncMock(return_value=turn_value or {"context": turn_context, "rule_ids": [173],
|
||||
"shape_forms": {"core": reply_shapes.FULL}})
|
||||
app = Quart(__name__)
|
||||
async with app.test_request_context("/api/plugin/retrieve", query_string=query_string):
|
||||
g.user = SimpleNamespace(id=7)
|
||||
@@ -57,6 +57,20 @@ async def test_the_turns_shape_follows_the_rules_and_its_key_comes_back():
|
||||
assert body["rule_ids"] == [11, 173]
|
||||
|
||||
|
||||
async def test_a_lesson_recorded_for_the_reply_sits_between_the_turns_rules_and_its_shape():
|
||||
from grimoire.services import hook_payload as hp
|
||||
|
||||
body, _turn = await _retrieve({"q": "write the report"}, turn_value={
|
||||
"context": "", "rule_ids": [173], "shape_forms": {"core": reply_shapes.FULL},
|
||||
"rule_parts": [hp.Part(text="TURN RULE", block="rules", ids={hp.RULE: (173,)})],
|
||||
"lesson_parts": [hp.Part(text="LESSON LINE", block="lessons", ids={hp.NOTE: (41,)})],
|
||||
"lesson_ids": [41],
|
||||
"shape_parts": [hp.Part(text="CORE SHAPE", ids={hp.SHAPE: ("core",)})],
|
||||
})
|
||||
ctx = body["context"]
|
||||
assert ctx.index("TURN RULE") < ctx.index("LESSON LINE") < ctx.index("CORE SHAPE") < ctx.index("NOTES MENU")
|
||||
|
||||
|
||||
async def test_the_route_hands_the_ledger_and_the_rules_just_named_to_the_turn():
|
||||
_body, turn = await _retrieve({"q": "x", "shapes_seen": "core,bogus",
|
||||
"exclude_rule_ids": "9", "held_rule_ids": "4"})
|
||||
|
||||
Reference in New Issue
Block a user