@@ -120,27 +120,18 @@ impl AgentIntegration for CodexIntegration {
120120 }
121121 }
122122
123- if ! refreshed. is_empty ( ) {
124- if legacy_config_install {
125- sweep_legacy_global_codex_config ( & ctx . home ) ;
123+ if refreshed. is_empty ( ) {
124+ if ! codex_plugin_manifest_path ( & ctx . home ) . exists ( ) && ! legacy_config_install {
125+ return Ok ( UpdatePluginOutcome :: NotInstalled ) ;
126126 }
127- return Ok ( UpdatePluginOutcome :: Refreshed ( refreshed) ) ;
127+ install_codex_personal_bootstrap ( & ctx. home , & ctx. tracedecay_bin ) ?;
128+ refreshed. push ( plugin_dir) ;
128129 }
129130
130- let target = if codex_plugin_manifest_path ( & ctx. home ) . exists ( ) || legacy_config_install {
131- Some ( plugin_dir. clone ( ) )
132- } else {
133- None
134- } ;
135-
136- let Some ( target) = target else {
137- return Ok ( UpdatePluginOutcome :: NotInstalled ) ;
138- } ;
139- install_codex_personal_bootstrap ( & ctx. home , & ctx. tracedecay_bin ) ?;
140131 if legacy_config_install {
141132 sweep_legacy_global_codex_config ( & ctx. home ) ;
142133 }
143- Ok ( UpdatePluginOutcome :: Refreshed ( vec ! [ target ] ) )
134+ Ok ( UpdatePluginOutcome :: Refreshed ( refreshed ) )
144135 }
145136
146137 fn export_managed_skills (
@@ -1228,7 +1219,7 @@ fn doctor_check_plugin(dc: &mut DoctorCounters, home: &Path) {
12281219 doctor_check_hooks (
12291220 dc,
12301221 & plugin_dir. join ( "hooks/hooks.json" ) ,
1231- Some ( & home. join ( ".codex/config.toml" ) ) ,
1222+ & home. join ( ".codex/config.toml" ) ,
12321223 ) ;
12331224
12341225 doctor_check_marketplace_entry (
@@ -1320,13 +1311,13 @@ fn doctor_check_plugin_dir(dc: &mut DoctorCounters, plugin_dir: &Path, config_pa
13201311 ) ) ;
13211312 }
13221313 if let Some ( config_path) = config_path {
1323- doctor_check_hooks ( dc, & plugin_dir. join ( "hooks/hooks.json" ) , Some ( config_path) ) ;
1314+ doctor_check_hooks ( dc, & plugin_dir. join ( "hooks/hooks.json" ) , config_path) ;
13241315 }
13251316}
13261317
13271318/// Check hooks.json registers the tracedecay lifecycle hooks, and report Codex
1328- /// hook trust state when the user-level config is available .
1329- fn doctor_check_hooks ( dc : & mut DoctorCounters , hooks_path : & Path , config_path : Option < & Path > ) {
1319+ /// hook trust state from the user-level config.
1320+ fn doctor_check_hooks ( dc : & mut DoctorCounters , hooks_path : & Path , config_path : & Path ) {
13301321 if !hooks_path. exists ( ) {
13311322 dc. warn ( & format ! (
13321323 "{} not found — run `tracedecay install --agent codex` to add lifecycle hooks" ,
@@ -1341,34 +1332,35 @@ fn doctor_check_hooks(dc: &mut DoctorCounters, hooks_path: &Path, config_path: O
13411332 ( !codex_hook_present ( & hooks, hook. event , hook. subcommand ) ) . then_some ( hook. event )
13421333 } )
13431334 . collect ( ) ;
1344- if missing. is_empty ( ) {
1345- dc. pass ( & format ! (
1346- "All {} Codex lifecycle hooks registered in {}" ,
1347- CODEX_MANAGED_HOOKS . len( ) ,
1348- hooks_path. display( )
1349- ) ) ;
1350- match config_path. and_then ( |path| load_toml_file ( path) . ok ( ) . map ( |config| ( path, config) ) ) {
1351- Some ( ( path, config) ) => match codex_plugin_hook_trust_state ( & config) {
1352- CodexHookTrustState :: Trusted => dc. info ( & format ! (
1353- "Codex hook trust entries recorded in {}" ,
1354- path. display( )
1355- ) ) ,
1356- CodexHookTrustState :: Missing ( missing) => dc. info ( & format ! (
1357- "Codex skips new/changed command hooks until trusted — missing trust for {} in {}; run `/hooks` in Codex" ,
1358- missing. join( ", " ) ,
1359- path. display( )
1360- ) ) ,
1361- } ,
1362- None => dc. info (
1363- "Codex skips new/changed command hooks until trusted — run `/hooks` in Codex to trust the tracedecay hooks" ,
1364- ) ,
1365- }
1366- } else {
1335+ if !missing. is_empty ( ) {
13671336 dc. warn ( & format ! (
13681337 "tracedecay hook(s) missing for {} in {} — run `tracedecay install --agent codex`" ,
13691338 missing. join( ", " ) ,
13701339 hooks_path. display( ) ,
13711340 ) ) ;
1341+ return ;
1342+ }
1343+
1344+ dc. pass ( & format ! (
1345+ "All {} Codex lifecycle hooks registered in {}" ,
1346+ CODEX_MANAGED_HOOKS . len( ) ,
1347+ hooks_path. display( )
1348+ ) ) ;
1349+ match load_toml_file ( config_path) {
1350+ Ok ( config) => match codex_plugin_hook_trust_state ( & config) {
1351+ CodexHookTrustState :: Trusted => dc. info ( & format ! (
1352+ "Codex hook trust entries recorded in {}" ,
1353+ config_path. display( )
1354+ ) ) ,
1355+ CodexHookTrustState :: Missing ( missing) => dc. info ( & format ! (
1356+ "Codex skips new/changed command hooks until trusted — missing trust for {} in {}; run `/hooks` in Codex" ,
1357+ missing. join( ", " ) ,
1358+ config_path. display( )
1359+ ) ) ,
1360+ } ,
1361+ Err ( _) => dc. info (
1362+ "Codex skips new/changed command hooks until trusted — run `/hooks` in Codex to trust the tracedecay hooks" ,
1363+ ) ,
13721364 }
13731365}
13741366
0 commit comments