MCPcopy
hub / github.com/openai/plugins / mark_handoff_delivered

Function mark_handoff_delivered

plugins/codex-security/scripts/workbench_db.py:1959–1995  ·  view source on GitHub ↗
(
    connection: sqlite3.Connection, args: argparse.Namespace
)

Source from the content-addressed store, hash-verified

1957
1958
1959def mark_handoff_delivered(
1960 connection: sqlite3.Connection, args: argparse.Namespace
1961) -> dict[str, Any]:
1962 scan_id = require_uuid(args.scan_id, "scan-id")
1963 claim_token = require_handoff_claim_token(args.claim_token)
1964 thread_id = optional_text(args.thread_id, maximum=512)
1965 connection.execute("BEGIN IMMEDIATE")
1966 try:
1967 timestamp = now()
1968 scan = require_scan(connection, scan_id)
1969 if thread_id is not None:
1970 workspace = require_workspace(connection, scan["workspace_id"])
1971 validate_handoff_delivery_thread(workspace["thread_id"], thread_id, claim_token)
1972 if scan["handoff_status"] == "delivered":
1973 if scan["handoff_claim_token"] != claim_token:
1974 raise SystemExit(
1975 "Codex Security handoff delivery is owned by another continuation."
1976 )
1977 connection.commit()
1978 return workspace_state(connection, scan["workspace_id"])
1979 updated = connection.execute(
1980 """
1981 UPDATE scans
1982 SET handoff_status = 'delivered', handoff_claimed_at = NULL,
1983 updated_at = ?
1984 WHERE id = ? AND handoff_status = 'pending'
1985 AND handoff_claim_token = ?
1986 """,
1987 (timestamp, scan["id"], claim_token),
1988 )
1989 if updated.rowcount != 1:
1990 raise SystemExit("Codex Security handoff delivery could not be recorded.")
1991 connection.commit()
1992 except BaseException:
1993 connection.rollback()
1994 raise
1995 return workspace_state(connection, scan["workspace_id"])
1996
1997
1998def set_finding_triage(connection: sqlite3.Connection, args: argparse.Namespace) -> dict[str, Any]:

Callers 1

mainFunction · 0.85

Calls 8

require_uuidFunction · 0.90
optional_textFunction · 0.90
nowFunction · 0.85
require_scanFunction · 0.85
require_workspaceFunction · 0.85
workspace_stateFunction · 0.85

Tested by

no test coverage detected