@@ -122,7 +122,7 @@ def _build_parser() -> argparse.ArgumentParser:
122122 "action" ,
123123 choices = (
124124 "init" , "add" , "drop" , "restore" , "status" , "finish" , "list" ,
125- "escalate" , "refresh-procedure" ,
125+ "escalate" , "refresh-procedure" , "lease" , "release" ,
126126 ),
127127 )
128128 hunt .add_argument ("hunt_id" , nargs = "?" )
@@ -132,6 +132,16 @@ def _build_parser() -> argparse.ArgumentParser:
132132 hunt .add_argument (f"--{ role } -model" )
133133 hunt .add_argument ("--reason" )
134134 hunt .add_argument ("--evidence" )
135+ hunt .add_argument (
136+ "--owner" ,
137+ help = "this coordinator's lease token, printed by hunt init. One hunt "
138+ "has one owner; a second coordinator must take it over explicitly" ,
139+ )
140+ hunt .add_argument (
141+ "--takeover" ,
142+ action = "store_true" ,
143+ help = "take a live lease from another coordinator; needs --reason" ,
144+ )
135145 hunt .add_argument ("--attempted" )
136146 hunt .add_argument ("--why-user" )
137147 hunt .add_argument ("--user-action" )
@@ -288,6 +298,14 @@ def _build_parser() -> argparse.ArgumentParser:
288298 )
289299 duplicate .add_argument ("run_id" )
290300 duplicate .add_argument ("--query" , required = True )
301+ duplicate .add_argument (
302+ "--symbol" ,
303+ action = "append" ,
304+ dest = "symbols" ,
305+ default = [],
306+ help = "a function, class or file the change touches, repeatable. "
307+ "Searched with the issue number before the broad listing" ,
308+ )
291309 duplicate .add_argument ("--limit" , type = int , default = 30 )
292310 duplicate .add_argument ("--executable" )
293311 duplicate .add_argument ("--timeout" , type = float , default = 60 )
@@ -480,6 +498,13 @@ def _build_parser() -> argparse.ArgumentParser:
480498 help = "how hard a Codex model is asked to think, recorded with the run" ,
481499 )
482500 orchestrate_parser .add_argument ("--max-revisions" , type = int , default = 1 )
501+ orchestrate_parser .add_argument (
502+ "--max-review-cycles" ,
503+ type = int ,
504+ default = 3 ,
505+ help = "reviewer passes this run may spend in total, counted across "
506+ "every orchestrate and resume-review call" ,
507+ )
483508 orchestrate_parser .add_argument (
484509 "--acknowledge-prior-attempts" ,
485510 action = "store_true" ,
@@ -665,7 +690,8 @@ def _hunt(arguments: argparse.Namespace) -> int:
665690 raise ValueError ("ask for primary and reviewer model IDs, then pass all four model flags" )
666691 record = hunt .create_hunt (root , int (arguments .hunt_id ), primary = arguments .primary ,
667692 primary_model = arguments .primary_model , reviewer = arguments .reviewer ,
668- reviewer_model = arguments .reviewer_model )
693+ reviewer_model = arguments .reviewer_model ,
694+ owner = arguments .owner )
669695 print (json .dumps (record , indent = 2 ))
670696 return 0
671697 if arguments .action == "refresh-procedure" :
@@ -677,6 +703,19 @@ def _hunt(arguments: argparse.Namespace) -> int:
677703 record ["procedure_sha256" ] = hashlib .sha256 (hunt .PROCEDURE .read_bytes ()).hexdigest ()
678704 hunt .save (path , record )
679705 record = hunt .load_hunt (root , arguments .hunt_id )
706+ if arguments .action == "lease" :
707+ lease = hunt .acquire_lease (
708+ root , record , owner = arguments .owner ,
709+ takeover_reason = arguments .reason if arguments .takeover else None ,
710+ )
711+ print (json .dumps (lease , indent = 2 ))
712+ return 0
713+ if arguments .action == "release" :
714+ hunt .release_lease (root , record , owner = arguments .owner )
715+ print (json .dumps ({"hunt_id" : record ["hunt_id" ], "lease" : None }, indent = 2 ))
716+ return 0
717+ if arguments .action in ("add" , "drop" , "restore" , "escalate" , "finish" ):
718+ hunt .require_lease (record , arguments .owner )
680719 if arguments .action == "add" :
681720 if not arguments .run_id :
682721 raise ValueError ("provide the run ID to add" )
@@ -901,12 +940,14 @@ def _duplicate_search(arguments: argparse.Namespace) -> int:
901940 executable = arguments .executable ,
902941 timeout_seconds = arguments .timeout ,
903942 limit = arguments .limit ,
943+ symbols = arguments .symbols ,
904944 )
905945 print (
906946 json .dumps (
907947 {
908948 "run_id" : run .run_id ,
909949 "repository" : record ["repository" ],
950+ "decided_by" : record .get ("decided_by" ),
910951 "query" : record ["query" ],
911952 "success" : record ["success" ],
912953 "complete" : record ["complete" ],
@@ -1409,6 +1450,7 @@ def _orchestrate(arguments: argparse.Namespace) -> int:
14091450 agent_timeout_seconds = arguments .agent_timeout ,
14101451 verification_timeout_seconds = arguments .verification_timeout ,
14111452 max_revisions = arguments .max_revisions ,
1453+ max_review_cycles = arguments .max_review_cycles ,
14121454 announce = _emit ,
14131455 acknowledge_prior_attempts = arguments .acknowledge_prior_attempts ,
14141456 acknowledge_claims = arguments .acknowledge_claims ,
0 commit comments