CI / test (push) Canceled after 0s
## Summary epic r04 - begin refactor ## Change Type - [x] Cowork feature - [ ] Bug fix - [ ] Core AI contribution - [ ] Test / hardening - [ ] Performance - [ ] Documentation ## Related Work Cowork Task: Core Repo: http://34.143.229.138/gitea-admin/fsg-ai-core-assets Core AI Issue: Core Task: Related PR: ## Scope What is intentionally included? What is intentionally NOT included? ## Validation - [ ] Unit tests - [ ] Integration tests - [ ] Manual verification - [ ] Regression check Commands / evidence: ## Security Impact Permission / credential / network / customer data impact: ## Compatibility - [ ] No breaking change - [ ] Breaking change documented ## Reviewer Notes Anything Cowork reviewers should pay attention to. --------- Co-authored-by: Anh Tran Nguyen Minh <anhtnm1@fpt.com> Co-authored-by: Huong Le Thi Thien <huongltt35@fpt.com> Co-authored-by: Nam Pham Dinh Thanh <nampdt@fpt.com> Co-authored-by: Vu Dam Tuan <vudt15@fpt.com> Co-authored-by: Hiep Ha Van <hiephv3@fpt.com> Co-authored-by: Lam Hoang Van <lamhv7@fpt.com> Reviewed-on: #7 Co-authored-by: Duy Le Huu <duylh19@fpt.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""R04-T05 — unit tests for the unattended-run prompt assembly.
|
|
|
|
``_run_agent`` used to build this by rebinding ``prompt`` three times, each with
|
|
its own ``f"{block}\n\n{prompt}"``. The ORDER that produced is load-bearing (the
|
|
plan reminder has to lead, the task's own words have to trail) and it was
|
|
readable only by replaying the rebindings in your head.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from cowork_local.core.task_executors import _unattended_prompt
|
|
|
|
|
|
def test_the_plan_reminder_leads_and_the_task_prompt_trails() -> None:
|
|
built = _unattended_prompt("write the report")
|
|
|
|
assert built.startswith("This runs unattended (Schedule Task)")
|
|
assert built.endswith("write the report")
|
|
|
|
|
|
def test_a_skill_block_sits_between_the_reminder_and_the_agent_persona() -> None:
|
|
built = _unattended_prompt("write the report", skill_text="SKILL",
|
|
agent_instructions="PERSONA")
|
|
|
|
assert built.index("This runs unattended") < built.index("SKILL")
|
|
assert built.index("SKILL") < built.index("PERSONA")
|
|
assert built.index("PERSONA") < built.index("write the report")
|
|
|
|
|
|
def test_absent_blocks_leave_no_extra_blank_lines() -> None:
|
|
built = _unattended_prompt("do it", skill_text="", agent_instructions=None)
|
|
|
|
assert "\n\n\n" not in built
|
|
assert built.count("do it") == 1
|