Issue #5: control chat must not create plans or rules unprompted #6

Merged
EduarD3V merged 5 commits from issue/5-chat-no-autoplan into develop 2026-10-05 08:18:08 +02:00
Owner

Refs #5.

The control-chat assistant could call create_plan / create_match_rule on its own initiative (e.g. to record work it had just done), so a chat session that ended with a plan created one the operator never asked for.

Change: create_plan and create_match_rule now require an explicit operator request in the message that started the current turn (ControlDeps.lastUserMessage, set by runControlAgent). The check is a conservative English guard rail - a request verb (create/make/add/save/build/draft/...) plus the noun plan/playbook/rule - and the tool throws, persisting nothing, otherwise. The tool descriptions state the rule; the model-visible text is net shorter than develop. UC-MW-137 updated before the behaviour change.

Commits:

  • 7c2abe9 docs(uc): UC-MW-137 gate AI plan/rule creation on operator request
  • 4a47de6 feat(control): create_plan/create_match_rule require an explicit operator request
  • 9152969 fix(control): keep plan/rule prompt text within the tiny context window

Gates (touched surface, all green):

  • python3 docs/use-cases/_check.py - 350 UCs conform
  • python3 scripts/check-ai-headers.py - 534 ok
  • python3 scripts/check-type-mirror.py - ok
  • bun test tests/uc-mw-137-ai-create-plan-rule.test.ts - 5/5 (2 new refusal tests, additive)
  • bun test tests/uc-mw-115-control-chat.test.ts - 12/12
  • bun test tests/uc-mw-plan-chat.test.ts - 11/11

Known red, NOT from this diff: the full 'cd middleware && bun test' suite fails ~18 unrelated tests (cross-user isolation, secrets, /metrics, UC-MW-19) with 'PGlite is closed' / ERR_HTTP_HEADERS_SENT. The untouched base (origin/develop 33143a0) fails the same set (541 pass/20 fail vs 545/18 here), so this is pre-existing environment flakiness, not a regression. Opened as draft for that reason only.

Not touched: dashboard (the manual 'Save as plan' button is already an explicit operator action) and /plans/compile (operator-initiated). A human merges into develop.

Refs #5. The control-chat assistant could call create_plan / create_match_rule on its own initiative (e.g. to record work it had just done), so a chat session that ended with a plan created one the operator never asked for. Change: create_plan and create_match_rule now require an explicit operator request in the message that started the current turn (ControlDeps.lastUserMessage, set by runControlAgent). The check is a conservative English guard rail - a request verb (create/make/add/save/build/draft/...) plus the noun plan/playbook/rule - and the tool throws, persisting nothing, otherwise. The tool descriptions state the rule; the model-visible text is net shorter than develop. UC-MW-137 updated before the behaviour change. Commits: - 7c2abe9 docs(uc): UC-MW-137 gate AI plan/rule creation on operator request - 4a47de6 feat(control): create_plan/create_match_rule require an explicit operator request - 9152969 fix(control): keep plan/rule prompt text within the tiny context window Gates (touched surface, all green): - python3 docs/use-cases/_check.py - 350 UCs conform - python3 scripts/check-ai-headers.py - 534 ok - python3 scripts/check-type-mirror.py - ok - bun test tests/uc-mw-137-ai-create-plan-rule.test.ts - 5/5 (2 new refusal tests, additive) - bun test tests/uc-mw-115-control-chat.test.ts - 12/12 - bun test tests/uc-mw-plan-chat.test.ts - 11/11 Known red, NOT from this diff: the full 'cd middleware && bun test' suite fails ~18 unrelated tests (cross-user isolation, secrets, /metrics, UC-MW-19) with 'PGlite is closed' / ERR_HTTP_HEADERS_SENT. The untouched base (origin/develop 33143a0) fails the same set (541 pass/20 fail vs 545/18 here), so this is pre-existing environment flakiness, not a regression. Opened as draft for that reason only. Not touched: dashboard (the manual 'Save as plan' button is already an explicit operator action) and /plans/compile (operator-initiated). A human merges into develop.
Gate the control-chat plan/rule tools on the operator's current message so
the assistant stops creating plans unprompted when a chat ends. Tighten the
system prompt and tool descriptions to match. UC-MW-137.
fix(control): keep plan/rule prompt text within the tiny context window
Some checks failed
CI and agent release / test-agent (pull_request) Successful in 1m25s
CI and agent release / check-docs (pull_request) Successful in 20s
CI and agent release / test-middleware (pull_request) Failing after 7m31s
CI and agent release / test-dashboard (pull_request) Successful in 2m19s
CI and agent release / build (pull_request) Has been skipped
CI and agent release / release (pull_request) Has been skipped
CI and agent release / publish-images (pull_request) Has been skipped
9152969e61
The added prompt sentence and long tool descriptions pushed UC-MW-115's
2048-token compaction harness over budget. Restore the original system
prompt line and shorten both tool descriptions; the explicit-request gate
lives in code, so the text only needs to state the rule.
EduarD3V changed title from Issue #5: control chat must not create plans or rules unprompted to WIP: Issue #5: control chat must not create plans or rules unprompted 2026-10-04 09:20:43 +02:00
Author
Owner

Correction to the gate note above: the authoritative full-suite run on this branch is 561 pass / 2 fail, not ~18. The earlier larger failure count came from two bun test runs sharing the machine (PGlite contention). The two remaining failures - UC-OP-02 /metrics counters and UC-MW-19 plan survives a second buildApp - also fail on the untouched base origin/develop 33143a0 (541 pass / 20 fail there), so they are pre-existing environment issues, not from this diff.

Correction to the gate note above: the authoritative full-suite run on this branch is 561 pass / 2 fail, not ~18. The earlier larger failure count came from two bun test runs sharing the machine (PGlite contention). The two remaining failures - UC-OP-02 /metrics counters and UC-MW-19 plan survives a second buildApp - also fail on the untouched base origin/develop 33143a0 (541 pass / 20 fail there), so they are pre-existing environment issues, not from this diff.
update
Some checks failed
CI and agent release / test-agent (pull_request) Successful in 1m29s
CI and agent release / check-docs (pull_request) Successful in 22s
CI and agent release / test-dashboard (pull_request) Has been cancelled
CI and agent release / build (pull_request) Has been cancelled
CI and agent release / release (pull_request) Has been cancelled
CI and agent release / publish-images (pull_request) Has been cancelled
CI and agent release / test-middleware (pull_request) Has been cancelled
1d96a04133
Merge branch 'develop' of https://git.eduard3v.com/EduarD3V/gotoi into issue/5-chat-no-autoplan
All checks were successful
CI and agent release / test-agent (pull_request) Successful in 1m27s
CI and agent release / test-middleware (pull_request) Successful in 8m4s
CI and agent release / test-dashboard (pull_request) Successful in 2m34s
CI and agent release / check-docs (pull_request) Successful in 21s
CI and agent release / build (pull_request) Has been skipped
CI and agent release / release (pull_request) Has been skipped
CI and agent release / publish-images (pull_request) Has been skipped
612ea75179
# Conflicts:
#	.claude/skills/gotoi-issue-flow/scripts/forgejo.py
EduarD3V changed title from WIP: Issue #5: control chat must not create plans or rules unprompted to Issue #5: control chat must not create plans or rules unprompted 2026-10-05 08:17:42 +02:00
EduarD3V merged commit 5dc62a75b2 into develop 2026-10-05 08:18:08 +02:00
Sign in to join this conversation.
No description provided.