@@ -957,14 +957,19 @@ func TestContext_Run_Commands(t *testing.T) {
957957 check : checkTaskNotEmpty ,
958958 },
959959 {
960- name : "command not found returns error " ,
960+ name : "command not found passes through as-is " ,
961961 setup : func (t * testing.T , dir string ) {
962962 t .Helper ()
963963 createTask (t , dir , "missing-cmd" , "" , "/nonexistent" )
964964 },
965- taskName : "missing-cmd" ,
966- wantErr : true ,
967- errContains : "command not found" ,
965+ taskName : "missing-cmd" ,
966+ wantErr : false ,
967+ check : func (t * testing.T , result * Result ) {
968+ t .Helper ()
969+ if ! strings .Contains (result .Prompt , "/nonexistent" ) {
970+ t .Errorf ("expected pass-through of /nonexistent, got %q" , result .Prompt )
971+ }
972+ },
968973 },
969974 {
970975 name : "command parameter overrides context parameter" ,
@@ -1249,16 +1254,22 @@ func TestContext_Run_Errors(t *testing.T) {
12491254 taskName string
12501255 wantErr bool
12511256 errContains string
1257+ check func (t * testing.T , result * Result )
12521258 }{
12531259 {
1254- name : "command not found in task" ,
1260+ name : "command not found in task passes through as-is " ,
12551261 setup : func (t * testing.T , dir string ) {
12561262 t .Helper ()
12571263 createTask (t , dir , "bad-cmd" , "" , "/missing-command\n " )
12581264 },
1259- taskName : "bad-cmd" ,
1260- wantErr : true ,
1261- errContains : "command not found" ,
1265+ taskName : "bad-cmd" ,
1266+ wantErr : false ,
1267+ check : func (t * testing.T , result * Result ) {
1268+ t .Helper ()
1269+ if ! strings .Contains (result .Prompt , "/missing-command" ) {
1270+ t .Errorf ("expected pass-through of /missing-command, got %q" , result .Prompt )
1271+ }
1272+ },
12621273 },
12631274 {
12641275 name : "invalid agent in task frontmatter" ,
@@ -1298,6 +1309,10 @@ func TestContext_Run_Errors(t *testing.T) {
12981309 t .Errorf ("expected error to contain %q, got %v" , tt .errContains , err )
12991310 }
13001311 }
1312+
1313+ if ! tt .wantErr && tt .check != nil {
1314+ tt .check (t , result )
1315+ }
13011316 })
13021317 }
13031318}
@@ -1839,17 +1854,22 @@ func TestUserPrompt(t *testing.T) {
18391854 check : checkTaskContains ("${issue_number}" ), // expand:false applies to user_prompt too
18401855 },
18411856 {
1842- name : "user_prompt with invalid slash command" ,
1857+ name : "user_prompt with invalid slash command passes through as-is " ,
18431858 setup : func (t * testing.T , dir string ) {
18441859 t .Helper ()
18451860 createTask (t , dir , "invalid" , "" , "Task content\n " )
18461861 },
18471862 opts : []Option {
18481863 WithUserPrompt ("/nonexistent-command\n " ),
18491864 },
1850- taskName : "invalid" ,
1851- wantErr : true ,
1852- errContains : "command not found" ,
1865+ taskName : "invalid" ,
1866+ wantErr : false ,
1867+ check : func (t * testing.T , result * Result ) {
1868+ t .Helper ()
1869+ if ! strings .Contains (result .Prompt , "/nonexistent-command" ) {
1870+ t .Errorf ("expected pass-through of /nonexistent-command, got %q" , result .Prompt )
1871+ }
1872+ },
18531873 },
18541874 {
18551875 name : "both task prompt and user prompt parse correctly" ,
0 commit comments