feat(runtime): consume governed Activity Core closes
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a06ba0-10aa-7ea0-b20a-4f3fac39efe9
This commit is contained in:
parent
0e6d795aa4
commit
d00ffcb402
22 changed files with 1218 additions and 148 deletions
|
|
@ -161,6 +161,35 @@ def _cmd_claim_loop(args: argparse.Namespace) -> int:
|
|||
)
|
||||
|
||||
|
||||
def _cmd_close_outbox(args: argparse.Namespace) -> int:
|
||||
from rein_aharness.claim_loop import replay_close_outbox
|
||||
from rein_aharness.close_outbox import CloseOutbox
|
||||
from rein_aharness.ops_run_client import ActivityCoreOpsClient
|
||||
|
||||
outbox = CloseOutbox()
|
||||
if args.action == "replay":
|
||||
if not 1 <= args.limit <= 1000:
|
||||
print("error: --limit must be between 1 and 1000", file=sys.stderr)
|
||||
return 2
|
||||
report = replay_close_outbox(
|
||||
ActivityCoreOpsClient(),
|
||||
outbox,
|
||||
limit=args.limit,
|
||||
)
|
||||
payload = {
|
||||
"attempted": report.attempted,
|
||||
"delivered": report.delivered,
|
||||
"failed": report.failed,
|
||||
"quarantined_this_run": report.quarantined,
|
||||
"remaining": report.remaining,
|
||||
**outbox.status(),
|
||||
}
|
||||
else:
|
||||
payload = outbox.status()
|
||||
print(json.dumps(payload, indent=2, sort_keys=True))
|
||||
return 1 if payload["pending"] or payload["quarantined"] else 0
|
||||
|
||||
|
||||
def _cmd_run(args: argparse.Namespace) -> int:
|
||||
from rein_aharness.intake import IntakeError, IssueCoreClient, poll_next
|
||||
|
||||
|
|
@ -524,6 +553,18 @@ def main(argv: list[str] | None = None) -> int:
|
|||
claim_loop.add_argument("--no-commit", action="store_true")
|
||||
claim_loop.add_argument("-v", "--verbose", action="store_true")
|
||||
|
||||
close_outbox = sub.add_parser(
|
||||
"close-outbox",
|
||||
help="Inspect or replay durable Activity Core terminal-close evidence",
|
||||
)
|
||||
close_outbox.add_argument("action", choices=("status", "replay"))
|
||||
close_outbox.add_argument(
|
||||
"--limit",
|
||||
type=int,
|
||||
default=100,
|
||||
help="Maximum pending entries to replay (default: 100)",
|
||||
)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
if args.command == "validate":
|
||||
|
|
@ -538,6 +579,9 @@ def main(argv: list[str] | None = None) -> int:
|
|||
if args.command == "claim-loop":
|
||||
return _cmd_claim_loop(args)
|
||||
|
||||
if args.command == "close-outbox":
|
||||
return _cmd_close_outbox(args)
|
||||
|
||||
if args.command == "run":
|
||||
return _cmd_run(args)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue