@@ -257,6 +257,51 @@ func TestRunTaskPrompt(t *testing.T) {
257257 }
258258}
259259
260+ func TestRunCheckJSONOmitsPromptContent (t * testing.T ) {
261+ root := setupEmptyRepo (t )
262+ origCheck := checkRepo
263+ origHash := repoStateHashFn
264+ repoStateHashFn = func (string ) string { return "deadbeef" }
265+ checkRepo = func (_ string , _ dun.Options ) (dun.Result , error ) {
266+ return dun.Result {
267+ Checks : []dun.CheckResult {
268+ {
269+ ID : "agent-check" ,
270+ Status : "prompt" ,
271+ Signal : "prompt signal" ,
272+ Prompt : & dun.PromptEnvelope {
273+ Kind : "dun.prompt.v1" ,
274+ ID : "agent-check" ,
275+ Prompt : "Check-ID: agent-check\n \n This is a big prompt." ,
276+ Callback : dun.PromptCallback {
277+ Command : "dun respond --id agent-check --response -" ,
278+ Stdin : true ,
279+ },
280+ },
281+ },
282+ },
283+ }, nil
284+ }
285+ t .Cleanup (func () {
286+ checkRepo = origCheck
287+ repoStateHashFn = origHash
288+ })
289+
290+ var stdout bytes.Buffer
291+ var stderr bytes.Buffer
292+ code := runInDirWithWriters (t , root , []string {"check" , "--format=json" }, & stdout , & stderr )
293+ if code != dun .ExitSuccess {
294+ t .Fatalf ("expected success, got %d: %s" , code , stderr .String ())
295+ }
296+ output := stdout .String ()
297+ if strings .Contains (output , "This is a big prompt." ) {
298+ t .Fatalf ("expected prompt content to be omitted" )
299+ }
300+ if ! strings .Contains (output , "dun task agent-check@deadbeef --prompt" ) {
301+ t .Fatalf ("expected prompt hint to include task id" )
302+ }
303+ }
304+
260305func TestRunCheckJSONEncodeError (t * testing.T ) {
261306 root := setupEmptyRepo (t )
262307 errWriter := & failWriter {err : errors .New ("write failed" )}
0 commit comments