@@ -249,12 +249,12 @@ describe("getReplyFromConfig message hooks", () => {
249249 ) ;
250250 } ) ;
251251
252- it ( "skips utility media understanding for a model-locked harness session " , async ( ) => {
253- const sessionKey = "agent:main:harness:codex:supervision: locked-media " ;
252+ it ( "runs configured audio transcription for a model-locked harness voice note " , async ( ) => {
253+ const sessionKey = "agent:main:harness:claude-cli: locked-audio " ;
254254 const sessionEntry = {
255255 sessionId : "locked-session" ,
256256 updatedAt : 1 ,
257- agentHarnessId : "codex " ,
257+ agentHarnessId : "claude-cli " ,
258258 modelSelectionLocked : true ,
259259 } ;
260260 mocks . resolveReplySessionPreprocessingState . mockReturnValueOnce ( {
@@ -276,26 +276,100 @@ describe("getReplyFromConfig message hooks", () => {
276276 await getReplyFromConfig (
277277 buildCtx ( { SessionKey : sessionKey } ) ,
278278 undefined ,
279- withFastReplyConfig ( { } ) ,
279+ withFastReplyConfig ( {
280+ tools : {
281+ media : {
282+ audio : {
283+ enabled : true ,
284+ models : [
285+ {
286+ type : "cli" ,
287+ command : "/usr/local/bin/stt-transcribe" ,
288+ args : [ "{{MediaPath}}" ] ,
289+ } ,
290+ ] ,
291+ } ,
292+ } ,
293+ } ,
294+ } ) ,
280295 ) ;
281296
282297 expect ( mocks . resolveReplySessionPreprocessingState ) . toHaveBeenCalledOnce ( ) ;
283298 expect ( mocks . initSessionState ) . toHaveBeenCalledOnce ( ) ;
284- expect ( mocks . applyMediaUnderstanding ) . not . toHaveBeenCalled ( ) ;
299+ expect ( mocks . applyMediaUnderstanding ) . toHaveBeenCalledOnce ( ) ;
300+ expect ( mocks . applyMediaUnderstanding . mock . calls [ 0 ] ?. [ 0 ] ) . toEqual (
301+ expect . objectContaining ( { processingMode : "audio-only" } ) ,
302+ ) ;
285303 expect ( mocks . resolveReplyDirectives . mock . calls [ 0 ] ?. [ 0 ] ) . toEqual (
286304 expect . objectContaining ( {
287305 sessionEntry : expect . objectContaining ( {
288- agentHarnessId : "codex " ,
306+ agentHarnessId : "claude-cli " ,
289307 modelSelectionLocked : true ,
290308 } ) ,
291- sessionCtx : expect . objectContaining ( {
292- BodyForAgent : "<media:audio> " ,
309+ ctx : expect . objectContaining ( {
310+ BodyForAgent : "[Audio]\nTranscript:\nvoice transcript " ,
293311 SessionKey : sessionKey ,
294312 } ) ,
295313 } ) ,
296314 ) ;
297315 } ) ;
298316
317+ it ( "runs normal media understanding for an unlocked voice note" , async ( ) => {
318+ await getReplyFromConfig (
319+ buildCtx ( ) ,
320+ undefined ,
321+ withFastReplyConfig ( {
322+ tools : {
323+ media : {
324+ audio : {
325+ enabled : true ,
326+ models : [
327+ {
328+ type : "cli" ,
329+ command : "/usr/local/bin/stt-transcribe" ,
330+ args : [ "{{MediaPath}}" ] ,
331+ } ,
332+ ] ,
333+ } ,
334+ } ,
335+ } ,
336+ } ) ,
337+ ) ;
338+
339+ expect ( mocks . applyMediaUnderstanding ) . toHaveBeenCalledOnce ( ) ;
340+ expect ( mocks . applyMediaUnderstanding . mock . calls [ 0 ] ?. [ 0 ] ) . not . toHaveProperty ( "processingMode" ) ;
341+ expect ( mocks . resolveReplyDirectives . mock . calls [ 0 ] ?. [ 0 ] ) . toEqual (
342+ expect . objectContaining ( {
343+ ctx : expect . objectContaining ( {
344+ BodyForAgent : "[Audio]\nTranscript:\nvoice transcript" ,
345+ } ) ,
346+ } ) ,
347+ ) ;
348+ } ) ;
349+
350+ it ( "keeps unconfigured audio with a model-locked harness" , async ( ) => {
351+ const sessionKey = "agent:main:harness:claude-cli:locked-unconfigured-audio" ;
352+ const sessionEntry = {
353+ sessionId : "locked-unconfigured-session" ,
354+ updatedAt : 1 ,
355+ agentHarnessId : "claude-cli" ,
356+ modelSelectionLocked : true ,
357+ } ;
358+ mocks . resolveReplySessionPreprocessingState . mockReturnValueOnce ( {
359+ sessionEntry,
360+ sessionKey,
361+ storePath : "/tmp/sessions.json" ,
362+ } ) ;
363+
364+ await getReplyFromConfig (
365+ buildCtx ( { SessionKey : sessionKey } ) ,
366+ undefined ,
367+ withFastReplyConfig ( { } ) ,
368+ ) ;
369+
370+ expect ( mocks . applyMediaUnderstanding ) . not . toHaveBeenCalled ( ) ;
371+ } ) ;
372+
299373 it ( "skips utility link understanding for a model-locked harness session" , async ( ) => {
300374 const sessionKey = "agent:main:harness:codex:supervision:locked-link" ;
301375 const body = "read https://example.test/page" ;
0 commit comments