@@ -772,29 +772,6 @@ async function runSubAgentInner(
772772 if ( params . capabilities !== undefined ) {
773773 tools = applyCapabilityFilter ( tools , params . capabilities ) ;
774774 }
775- // CL-9476 mount echo: dispatch verified requires_tools pre-spawn, but the
776- // filter or mount may have shifted since — a stamped tool missing here is
777- // a stale snapshot, a setup_error that never retries (non-continuable).
778- // Dispatch-side rejection is the normal path; this throw never fires for
779- // a dispatch that passed preflight against the same mount.
780- if ( params . requiresTools !== undefined && params . requiresTools . length > 0 ) {
781- const mountedNames = tools . map ( ( tool ) => tool . definition . name ) ;
782- const mountedCheck = checkMountedRequiresTools (
783- params . requiresTools ,
784- mountedNames ,
785- ) ;
786- if ( ! mountedCheck . ok ) {
787- throw new Error (
788- formatCapabilityUnavailable (
789- {
790- code : "stale_snapshot" ,
791- tool : mountedCheck . missing [ 0 ] ?? "unknown" ,
792- } ,
793- params . directorId ?? params . description ,
794- ) ,
795- ) ;
796- }
797- }
798775 backgroundCollectMounted = tools . some (
799776 ( tool ) => tool . definition . name === "shell_collect" ,
800777 ) ;
@@ -1022,6 +999,31 @@ async function runSubAgentInner(
1022999 ] ;
10231000 }
10241001
1002+ // CL-9476 mount echo: dispatch verified requires_tools pre-spawn, but the
1003+ // filter or mount may have shifted since — a stamped tool missing here is
1004+ // a stale snapshot, a setup_error that never retries (non-continuable).
1005+ // Dispatch-side rejection is the normal path. This check runs after ALL
1006+ // mounts (manage_tasks, leaf submit_result/ask_director, fleet verbs), so
1007+ // a dispatch that passed preflight against the same mount never throws.
1008+ if ( params . requiresTools !== undefined && params . requiresTools . length > 0 ) {
1009+ const mountedNames = tools . map ( ( tool ) => tool . definition . name ) ;
1010+ const mountedCheck = checkMountedRequiresTools (
1011+ params . requiresTools ,
1012+ mountedNames ,
1013+ ) ;
1014+ if ( ! mountedCheck . ok ) {
1015+ throw new Error (
1016+ formatCapabilityUnavailable (
1017+ {
1018+ code : "stale_snapshot" ,
1019+ tool : mountedCheck . missing [ 0 ] ?? "unknown" ,
1020+ } ,
1021+ params . directorId ?? params . description ,
1022+ ) ,
1023+ ) ;
1024+ }
1025+ }
1026+
10251027 tools = wrapAgentToolsWithResultTruncation ( tools , {
10261028 getBlobWriter : ( ) => childBlobWriter ,
10271029 getContextDir : ( ) => childContextDir ,
0 commit comments