Skip to content

Commit e059de8

Browse files
committed
Add manual test for infinite block scenario
This test verifies that a rule with no safety file option will always block when its trigger file is edited. The only way to proceed is by providing a promise tag in the correct format: <promise>Manual Test: Infinite Block</promise> This tests the promise mechanism for rules that cannot be satisfied by editing additional files, useful for enforcing policies where explicit acknowledgment is the only valid response.
1 parent 79b36ad commit e059de8

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: "Manual Test: Infinite Block"
3+
trigger: manual_tests/test_infinite_block/test_infinite_block.py
4+
compare_to: prompt
5+
---
6+
7+
# Manual Test: Infinite Block (Promise Required)
8+
9+
You edited `{trigger_files}` which triggers an infinite block.
10+
11+
## Why this blocks
12+
13+
This rule has NO safety file option. The only way to proceed is to provide
14+
a promise acknowledging that you understand the restriction.
15+
16+
## What to do
17+
18+
You MUST include the following promise tag in your response:
19+
20+
```
21+
<promise>Manual Test: Infinite Block</promise>
22+
```
23+
24+
This simulates scenarios where:
25+
- An operation requires explicit acknowledgment before proceeding
26+
- There is no alternative action that can suppress the rule
27+
- The agent must demonstrate understanding of the constraint
28+
29+
## This tests
30+
31+
The promise mechanism for rules that cannot be satisfied by editing additional
32+
files. This is useful for enforcing policies where acknowledgment is the only
33+
valid response.

manual_tests/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Each test has two cases: one where the rule SHOULD fire, and one where it should
3434
| **Pair Mode (reverse)** || Edit `_expected.md` only (should NOT fire) | Manual Test: Pair Mode |
3535
| **Command Action** | Edit `.txt` → log appended | — (always runs) | Manual Test: Command Action |
3636
| **Multi Safety** | Edit `.py` only | Edit `.py` AND any safety file | Manual Test: Multi Safety |
37+
| **Infinite Block** | Edit `.py` (always blocks) | Provide `<promise>` tag | Manual Test: Infinite Block |
3738

3839
## Test Results Tracking
3940

@@ -45,6 +46,7 @@ Each test has two cases: one where the rule SHOULD fire, and one where it should
4546
| Pair Mode (reverse - expected only) |||
4647
| Command Action |||
4748
| Multi Safety |||
49+
| Infinite Block |||
4850

4951
## Test Folders
5052

@@ -55,6 +57,7 @@ Each test has two cases: one where the rule SHOULD fire, and one where it should
5557
| `test_pair_mode/` | Pair (Directional) | One-way: trigger requires expected, but not vice versa |
5658
| `test_command_action/` | Command Action | Automatically runs command on file change |
5759
| `test_multi_safety/` | Multiple Safety | Fires unless ANY of the safety files also edited |
60+
| `test_infinite_block/` | Infinite Block | Always blocks; only promise can bypass |
5861

5962
## Corresponding Rules
6063

@@ -64,3 +67,4 @@ Rules are defined in `.deepwork/rules/`:
6467
- `manual-test-pair-mode.md`
6568
- `manual-test-command-action.md`
6669
- `manual-test-multi-safety.md`
70+
- `manual-test-infinite-block.md`
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""
2+
MANUAL TEST: Infinite Block Rule (Promise Required)
3+
4+
=== WHAT THIS TESTS ===
5+
Tests a rule with NO safety file option - it will ALWAYS block when the
6+
trigger file is edited. The only way to proceed is to provide a promise
7+
in the correct format.
8+
9+
This verifies:
10+
1. The rule correctly blocks when the file is edited
11+
2. The promise mechanism works to bypass the block
12+
3. The promise must be in the exact format: <promise>Rule Name</promise>
13+
14+
=== TEST CASE 1: Rule SHOULD fire (infinite block) ===
15+
1. Edit this file (add a comment below the marker)
16+
2. Run: echo '{}' | python -m deepwork.hooks.rules_check
17+
3. Expected: "Manual Test: Infinite Block" appears in output with decision="block"
18+
4. The block message should explain that a promise is required
19+
20+
=== TEST CASE 2: Rule should NOT fire (promise provided) ===
21+
1. Edit this file (add a comment below the marker)
22+
2. Create a transcript with: <promise>Manual Test: Infinite Block</promise>
23+
3. Run the hook with the transcript
24+
4. Expected: Empty JSON {} (allow) - promise bypasses the block
25+
26+
=== HOW TO TEST WITH PROMISE ===
27+
The promise must be in the conversation transcript. To test:
28+
29+
1. Create a temp transcript file with the promise:
30+
echo '{"role":"assistant","message":{"content":[{"type":"text","text":"<promise>Manual Test: Infinite Block</promise>"}]}}' > /tmp/transcript.jsonl
31+
32+
2. Run with transcript:
33+
echo '{"transcript_path":"/tmp/transcript.jsonl"}' | python -m deepwork.hooks.rules_check
34+
35+
3. Expected: {} (empty JSON = allow)
36+
37+
=== RULE LOCATION ===
38+
.deepwork/rules/manual-test-infinite-block.md
39+
40+
=== KEY DIFFERENCE FROM OTHER TESTS ===
41+
Other tests have a "safety" file that can be edited to suppress the rule.
42+
This test has NO safety option - the ONLY way to proceed is with a promise.
43+
This simulates scenarios where the agent must explicitly acknowledge a
44+
constraint before proceeding.
45+
"""
46+
47+
48+
def restricted_operation():
49+
"""An operation that requires explicit acknowledgment to proceed."""
50+
return "This operation always requires a promise to proceed"
51+
52+
53+
# Edit below this line to trigger the rule
54+
# -------------------------------------------

0 commit comments

Comments
 (0)