@@ -22,7 +22,8 @@ if (phase === "exhaust") await exhaustRecoveryBudget();
2222else await reconcileParkedReviews ( ) ;
2323
2424async function exhaustRecoveryBudget ( ) {
25- for ( const number of [ 114100 , 114101 ] ) {
25+ for ( const number of [ 114100 , 114101 , 114102 ] ) {
26+ const commandContext = number === 114102 ;
2627 const result = await signedPost (
2728 "/internal/exact-review/enqueue" ,
2829 {
@@ -31,10 +32,18 @@ async function exhaustRecoveryBudget() {
3132 targetRepo : "openclaw/openclaw" ,
3233 targetBranch : "main" ,
3334 itemNumber : number ,
34- itemKind : "issue" ,
35+ itemKind : commandContext ? "pull_request" : "issue" ,
3536 sourceEvent : "issues" ,
36- sourceAction : "opened" ,
37+ sourceAction : commandContext ? "legacy_dispatch" : "opened" ,
3738 supersedesInProgress : false ,
39+ ...( commandContext
40+ ? {
41+ commandStatusMarker :
42+ "<!-- clawsweeper-command-status:114102:re_review:0123456789abcdef0123456789abcdef01234567 -->" ,
43+ statusCommentId : 114102 ,
44+ additionalPrompt : "Check the maintainer-requested regression path." ,
45+ }
46+ : { } ) ,
3847 } ,
3948 } ,
4049 webhookSecret ,
@@ -64,10 +73,12 @@ async function exhaustRecoveryBudget() {
6473 prior = progress ;
6574 }
6675 if (
67- rows . length === 2 &&
76+ rows . length === 3 &&
6877 rows . every (
6978 ( row ) => row . parked_reason === "dispatch_rejected" && row . parked_recovery_attempts === 3 ,
70- )
79+ ) &&
80+ rows . find ( ( row ) => row . item_key === "openclaw/openclaw#114102" ) ?. excluded_reason ===
81+ "command_context"
7182 ) {
7283 await writeJson ( "parked-inventory-exhausted.json" , inventory . body ) ;
7384 await writeJson ( "exhaustion-summary.json" , {
@@ -89,7 +100,11 @@ async function reconcileParkedReviews() {
89100 const control = await fetch ( `${ githubOrigin } /__proof/control` , {
90101 method : "POST" ,
91102 headers : { "content-type" : "application/json" } ,
92- body : JSON . stringify ( { reject_dispatch : false , issue_114101_state : "closed" } ) ,
103+ body : JSON . stringify ( {
104+ reject_dispatch : false ,
105+ issue_114101_state : "closed" ,
106+ issue_114102_state : "closed" ,
107+ } ) ,
93108 } ) ;
94109 assert . equal ( control . status , 200 ) ;
95110
@@ -117,7 +132,7 @@ async function reconcileParkedReviews() {
117132 resolved_targets : 1 ,
118133 open_targets : 1 ,
119134 recovered_targets : 1 ,
120- skipped_targets : 0 ,
135+ skipped_targets : 1 ,
121136 } ,
122137 ) ;
123138
@@ -127,13 +142,17 @@ async function reconcileParkedReviews() {
127142 const terminal = await getJson (
128143 "/api/exact-review-queue/item?target_repo=openclaw%2Fopenclaw&item_number=114101" ,
129144 ) ;
145+ const commandContext = await getJson (
146+ "/api/exact-review-queue/item?target_repo=openclaw%2Fopenclaw&item_number=114102" ,
147+ ) ;
130148 const finalInventory = await signedPost (
131149 "/internal/exact-review/parked-reviews/list" ,
132150 { limit : 50 } ,
133151 operatorSecret ,
134152 ) ;
135153 await writeJson ( "open-target-after.json" , open . body ) ;
136154 await writeJson ( "terminal-target-after.json" , terminal . body ) ;
155+ await writeJson ( "command-context-target-after.json" , commandContext . body ) ;
137156 await writeJson ( "parked-inventory-final.json" , finalInventory . body ) ;
138157 assert . equal ( open . status , 200 ) ;
139158 assert . equal ( open . body . items . length , 1 ) ;
@@ -142,8 +161,52 @@ async function reconcileParkedReviews() {
142161 assert . equal ( open . body . items [ 0 ] . parked_recovery_attempts , 0 ) ;
143162 assert . equal ( terminal . status , 200 ) ;
144163 assert . equal ( terminal . body . items . length , 0 ) ;
164+ assert . equal ( commandContext . status , 200 ) ;
165+ assert . equal ( commandContext . body . items . length , 1 ) ;
166+ assert . equal ( commandContext . body . items [ 0 ] . state , "parked" ) ;
167+ assert . equal ( commandContext . body . items [ 0 ] . attempts , 0 ) ;
168+ assert . equal ( commandContext . body . items [ 0 ] . parked_recovery_attempts , 3 ) ;
145169 assert . equal ( finalInventory . status , 200 ) ;
146- assert . deepEqual ( finalInventory . body . parked_reviews , [ ] ) ;
170+ assert . equal ( finalInventory . body . parked_reviews . length , 1 ) ;
171+ const commandRow = finalInventory . body . parked_reviews [ 0 ] ;
172+ assert . equal ( commandRow . item_key , "openclaw/openclaw#114102" ) ;
173+ assert . equal ( commandRow . excluded_reason , "command_context" ) ;
174+ const commandMutation = {
175+ item_key : commandRow . item_key ,
176+ revision : commandRow . revision ,
177+ updated_at_ms : commandRow . updated_at_ms ,
178+ } ;
179+ const refusedResolve = await signedPost (
180+ "/internal/exact-review/parked-reviews/resolve" ,
181+ {
182+ items : [ commandMutation ] ,
183+ note : "proof: command-context record must retain its acknowledgement obligation" ,
184+ } ,
185+ operatorSecret ,
186+ ) ;
187+ const refusedRecover = await signedPost (
188+ "/internal/exact-review/parked-reviews/recover-fresh" ,
189+ {
190+ items : [ commandMutation ] ,
191+ idempotency_key : "parked-proof:command-context-refusal" ,
192+ } ,
193+ operatorSecret ,
194+ ) ;
195+ await writeJson ( "command-context-resolve-refusal.json" , refusedResolve . body ) ;
196+ await writeJson ( "command-context-recover-refusal.json" , refusedRecover . body ) ;
197+ assert . equal ( refusedResolve . status , 200 ) ;
198+ assert . deepEqual ( refusedResolve . body , { ok : true , resolved : 0 , skipped : 1 } ) ;
199+ assert . equal ( refusedRecover . status , 200 ) ;
200+ assert . deepEqual ( refusedRecover . body , {
201+ ok : true ,
202+ recovered : 0 ,
203+ deduped : 0 ,
204+ skipped : 1 ,
205+ } ) ;
206+ const commandAfterRefusals = await getJson (
207+ "/api/exact-review-queue/item?target_repo=openclaw%2Fopenclaw&item_number=114102" ,
208+ ) ;
209+ assert . deepEqual ( commandAfterRefusals . body , commandContext . body ) ;
147210
148211 const proofSummary = {
149212 proof : "parked review inventory and reconcile" ,
@@ -154,7 +217,9 @@ async function reconcileParkedReviews() {
154217 automatic_recovery_attempts_exhausted : 3 ,
155218 terminal_target_resolved : true ,
156219 open_target_recovered_pending : true ,
157- final_parked_inventory_rows : 0 ,
220+ command_context_target_untouched : true ,
221+ command_context_mutations_refused : true ,
222+ final_parked_inventory_rows : 1 ,
158223 } ,
159224 operator : result ,
160225 } ;
0 commit comments