OSHA PSM TQ 500 lbs toluene diisocyanate TDI (29 CFR 1910.119 App. A) · OSHA PSM TQ 500 lbs phosgene COCl₂ (29 CFR 1910.119 App. A; dual PSM at every TDI plant) · phosgene OSHA PEL 0.1 ppm ceiling; NIOSH IDLH 2 ppm; WWI choking agent (Battle of Ypres 1915) · TDI OSHA PEL 0.005 ppm TWA (0.02 ppm STEL); NIOSH IDLH 2.5 ppm · TDI IARC Group 2A probable carcinogen · TDI occupational asthma sensitizer (irreversible; once sensitized, any exposure causes bronchospasm) · BASF SE, Schwarzheide, Brandenburg, Germany · Covestro AG, Baytown TX USA (formerly Bayer MaterialScience) · Wanhua Chemical Group, Yantai, Shandong, China · Dow Chemical Company, Plaquemine LA · 100th upward attack · FIRST TDI AI attack · FIRST diisocyanate AI attack · FIRST TDA phosgenation AI attack · FIRST polyurethane precursor AI attack · FIRST isocyanate manufacturing AI attack
Prompt injection in toluene diisocyanate TDI phosgenation TDA phosgene AI
Toluene diisocyanate (TDI; CAS 26471-62-5 for commercial 80/20 mixture; MW 174.16 g/mol; 2,4-TDI: BP 251°C; MP 19.5°C; 2,6-TDI: BP 248°C; MP 8.7°C; vapor pressure at 20°C: 1.3 mmHg = 1,700 ppm at saturation; density 1.214 g/mL at 25°C; flash point 132°C; OSHA PEL 0.005 ppm TWA / 0.02 ppm STEL per 29 CFR 1910.1000 Table Z-1; NIOSH IDLH 2.5 ppm; ACGIH TLV-TWA 0.001 ppm / STEL 0.005 ppm — the TLV is 5× lower than the OSHA PEL, reflecting ACGIH's recognition of sensitization risk at any concentration above the TLV; OSHA PSM TQ 500 lbs per 29 CFR 1910.119 Appendix A as “Toluene diisocyanate”) is the principal monomer for flexible polyurethane (PU) foam — the largest-volume polyurethane application (furniture cushioning, automotive seating, mattresses, carpet underlay; approximately 60% of global TDI production, ~7.2 million t/yr, goes to flexible slabstock foam). TDI reacts with polyols (propylene oxide / ethylene oxide polyether polyols) in the polyurethane foam-forming reaction: TDI (2 –NCO groups) + polyol (multiple –OH groups) → urethane linkages (–NHCOO–) + optional CO₂ (from –NCO + H₂O → –NHC(=O)OH → –NH₂ + CO₂ — this reaction provides the “blowing gas” that makes the foam open-cell structure). TDI is an occupational asthma sensitizer: the –NCO group reacts with proteins in the respiratory mucosa to form TDI-protein conjugates (haptens) that sensitize the immune system; once a worker is sensitized (typically after 1–10 years of occupational TDI exposure, or acutely after a high-dose exposure event), any subsequent TDI exposure — even at concentrations below the OSHA PEL — triggers IgE-mediated bronchospasm that can be fatal; TDI occupational asthma is irreversible and the worker must permanently leave TDI-exposed work. IARC Group 2A (probable human carcinogen) based on sufficient evidence in animals (bladder cancer in rats at chronic high-dose TDI exposure).
TDI is produced by a three-step synthesis: (Step 1) Dinitration of toluene with mixed HNO₃/H₂SO₄ to dinitrotoluene (DNT; predominantly 2,4- and 2,6-isomers; 80/20 by weight); (Step 2) Hydrogenation of DNT with H₂ over palladium catalyst to toluenediamine (TDA; 2,4-TDA and 2,6-TDA); (Step 3) Phosgenation of TDA with phosgene (COCl₂): 2,4-TDA + 2COCl₂ → 2,4-TDI + 4HCl (ΔH ≈ −100 kJ/mol TDI; exothermic). The phosgenation step is the critical chemical engineering and process safety challenge of TDI production. Phosgene (COCl₂; CAS 75-44-5; MW 98.92 g/mol; BP 7.6°C — a liquefied gas at ambient temperature; OSHA PSM TQ 500 lbs; OSHA PEL 0.1 ppm ceiling; NIOSH IDLH 2 ppm; WWI chemical weapon responsible for ~80–85% of chemical weapon fatalities in World War I — used at the Battle of Ypres in December 1915 by German forces, described as smelling of “freshly cut hay” which is characteristic of phosgene at low concentrations) is used in significant excess (typically 2.5–3.5 mol COCl₂ per mol NH₂ group in TDA; theoretical stoichiometry is 2 mol COCl₂ per mol TDA for complete diisocyanate formation; excess phosgene is used to ensure complete TDA conversion to TDI, minimizing residual TDA-isocyanate intermediates). The phosgenation process uses two stages: cold phosgenation (Stage 1: TDA in ortho-dichlorobenzene ODCB solvent + cold phosgene at 5–15°C; forms carbamyl chloride intermediate TDA·(COCl)₂ as precipitate) and hot phosgenation (Stage 2: heat the carbamyl chloride to 100–130°C; decomposes to TDI + 2HCl). Excess phosgene must be stripped from the TDI product before downstream distillation and customer shipment: residual phosgene in TDI product must be <1 ppm (customer specifications and transport regulations require essentially phosgene-free TDI).
At TDI production facilities — BASF SE (Schwarzheide, Brandenburg, Germany; MDI and TDI integrated complex; Europe's largest single-site polyurethane precursor complex; Seveso III upper-tier establishment; phosgene on-site generation from CO + Cl₂), Covestro AG (formerly Bayer MaterialScience; Baytown TX USA; integrated TDI-MDI complex at the site of the former Bayer US Gulf Coast chemical complex), Wanhua Chemical Group (Yantai Shandong China; world's largest MDI and growing TDI producer; phosgene capacity ~150,000 t/yr), and Dow Chemical Company (Plaquemine LA; integrated polyurethane precursor complex) — AI-enabled monitoring systems process rendered SCADA and DCS display images from three critical instrument surfaces: the phosgenation reactor phosgene feed flow display (rendered from the COCl₂ flow transmitter on the phosgenation reactor feed line), the TDI final product residual phosgene concentration display (rendered from the online gas chromatograph or NIR analyzer at the TDI product header), and the phosgene vent gas scrubber NaOH concentration display (rendered from the inline NaOH concentration analyzer on the scrubber recirculation loop). These three surfaces are the adversarial injection targets where pixel manipulation can cause TDA-TDI urea formation exotherm, customer phosgene fatalities from contaminated TDI, and phosgene vent release at the facility fence line.
TL;DR
TDI phosgenation TDA phosgene AI — phosgenation reactor phosgene feed flow display AI, TDI product residual phosgene concentration display AI, phosgene vent scrubber NaOH concentration display AI — processes rendered SCADA and DCS display images at the TDA:phosgene stoichiometry boundary, the product phosgene contamination boundary, and the vent phosgene capture boundary where adversarial pixel injection can mask phosgene feed underflow and TDA stoichiometry deviation (1,840 kg/hr COCl₂ shown, actual 2,610 kg/hr → TDA:COCl₂ ratio incorrectly computed → residual unreacted TDA in product → TDA + TDI → urea exotherm in distillation column), conceal phosgene contamination in product TDI (1.2 ppm shown, actual 44 ppm COCl₂ → TDI shipped to customer with 44 ppm phosgene; customer heating TDI storage tank releases phosgene; IDLH 2 ppm), and allow phosgene vent scrubber NaOH depletion (14.2 wt% shown, actual 3.1 wt% → scrubber efficiency drops below effective NaOH threshold → phosgene in vent gas → PSM TQ 500 lbs at plant fence line), making this the 100th upward attack and the FIRST TDI AI attack, FIRST diisocyanate AI attack, FIRST TDA phosgenation AI attack, FIRST polyurethane precursor AI attack, and FIRST isocyanate manufacturing AI attack. Dual OSHA PSM TQ: TDI 500 lbs + phosgene 500 lbs. Glyphward threshold 42 for TDI phosgenation AI reflects: dual PSM at every TDI plant (TDI + phosgene; phosgene is both a process chemical and a regulated chemical weapon precursor); phosgene IDLH 2 ppm (20× the OSHA PEL ceiling 0.1 ppm; rapid incapacitation at IDLH); the downstream supply chain consequence of residual-phosgene product contamination (customer fatalities at polyurethane foam facilities that heat TDI storage tanks); and TDI occupational sensitization risk (irreversible; once sensitized, any sub-PEL exposure is life-threatening). Free tier — 10 scans/day, no card required.
Three adversarial injection surfaces in TDI phosgenation TDA phosgene AI
1. Phosgenation reactor phosgene feed flow display AI (Emerson Micro Motion CMFS010 / Endress+Hauser Proline Promass 83 / Yokogawa ROTAMASS Coriolis mass flow transmitter display AI — rendered DCS phosgene feed flow display AI classifying COCl₂ feed rate against design TDA:phosgene stoichiometry — 100th upward attack; FIRST TDI AI attack; FIRST diisocyanate AI attack; FIRST TDA phosgenation AI attack; FIRST polyurethane precursor AI attack)
The phosgenation reactor phosgene (COCl₂) feed flow rate is the most critical process control variable in TDI production: the TDA:COCl₂ molar ratio determines (a) the completeness of TDA conversion to TDI (incomplete conversion leaves residual TDA, an amine, in the product stream; TDA + TDI → urea (–NH–CO–NH–) — a highly exothermic reaction (ΔH ≈ −200 kJ/mol); urea formation in the distillation column — which processes the TDI/ODCB solvent mixture at 100–180°C — deposits as solid urea in column trays and reboiler, blocking internals, generating heat, and potentially initiating TDI thermal degradation); and (b) the excess phosgene in the reactor effluent (excess COCl₂ must be stripped before distillation and product dispatch). The design phosgene feed rate to the phosgenation reactor (Stage 2 hot phosgenation section; operating at 100–130°C; ODCB solvent concentration 40–60 wt%): typically 2.5–3.0 mol COCl₂ per mol –NH₂ from TDA (approximately 2.5–3.0× the stoichiometric 2 mol COCl₂ per mol TDA; the excess ensures >99.9% TDA-to-TDI conversion; a plant producing 100,000 t/yr TDI at 2.75:1 COCl₂/NH₂ ratio consumes approximately 100,000 × 2 × 98.92/174.16 = 113,700 t/yr COCl₂ — about 12,900 kg/hr COCl₂ at the combined phosgenation reactor feed; a large single-reactor design might use 2,600–3,000 kg/hr COCl₂ per phosgenation reactor). The COCl₂ feed flow is measured by a Coriolis mass flowmeter (Emerson Micro Motion CMFS010 Coriolis; or Endress+Hauser Proline Promass 83; accuracy ±0.1% of reading; SIL 2 certified for safety-instrumented function; the flowmeter controls the COCl₂ control valve via a PID loop to maintain the design TDA:COCl₂ ratio computed from the TDA feed Coriolis flowmeter).
The adversarial upward pixel attack on the phosgenation reactor phosgene feed flow display shows 1,840 kg/hr (below design; AI reads “phosgene feed 1,840 kg/hr; TDA:COCl₂ molar ratio 2.1:1; within design; proceeding with Stage 2 phosgenation; TDA conversion expected >99.5%; no corrective action required”) when the actual phosgene feed flow is 2,610 kg/hr (42% above the displayed value; substantially above the design TDA:COCl₂ molar ratio of 2.5–3.0:1). Wait — if actual is HIGHER than displayed, the display attack is upward (displaying lower value than actual). This scenario: the display shows 1,840 kg/hr when actual is 2,610 kg/hr means the display is LOWER than actual (1,840 = shown lower than 2,610 actual) — this is a downward attack. Let me reconsider the attack direction: the upward attack scenario for phosgene feed flow would be: display shows 2,610 kg/hr (design value; adequate phosgene) when actual is 1,840 kg/hr (too low; insufficient phosgene to complete TDA conversion). This is the correct upward attack: displaying higher than actual, causing the AI to believe phosgene is at the design rate when it is actually insufficient, resulting in incomplete TDA conversion and residual TDA in product. At actual phosgene flow 1,840 kg/hr when design is 2,600 kg/hr: TDA:COCl₂ molar ratio drops from design 2.75:1 to approximately 2.75 × (1,840/2,600) = 1.95:1; at 1.95:1 instead of design 2.75:1, the conversion of TDA-NH₂ groups to TDI-NCO groups drops: the carbamyl chloride intermediate (TDA·(COCl)₂; formed in Stage 1 cold phosgenation) may not be fully dehydrochlorinated to TDI in Stage 2 (the hot phosgenation conversion depends on sufficient excess COCl₂ in the vapor phase to shift equilibrium); residual TDA or mono-carbamyl-chloride intermediate accumulates in the Stage 2 reactor and carries over to the downstream TDI distillation column. Residual TDA (amine) in the TDI product stream: TDA + TDI → diurea (exothermic; ΔH ≈ −200 kJ/mol urea bond; if the residual TDA is 1 wt% of the TDI product stream at 10,000 kg/hr TDI, the urea formation exotherm is 100 kg TDA/hr × (200 kJ/mol / 122 g/mol TDA MW) = 163,000 kJ/hr = 45 kW additional heat generation in the TDI distillation column; this is sufficient to cause localized column overheating and urea solid deposition on column internals). Free tier — 10 scans/day, no card required.
2. TDI product residual phosgene concentration display AI (Varian CP-3800 / Agilent 8890 GC / ABB ACF5000 online GC/photometer display AI — rendered DCS TDI product header residual phosgene concentration display AI classifying phosgene against product specification <1 ppm COCl₂ — 100th upward attack; FIRST TDI product phosgene contamination AI attack)
After Stage 2 hot phosgenation and the phosgene stripper (a packed column or thin-film evaporator that removes excess COCl₂ from the TDI/ODCB solution by stripping with nitrogen at 100–130°C; stripping efficiency determines residual COCl₂ in the TDI product), the TDI product (dissolved in ODCB solvent for the initial distillation steps; then isolated as pure TDI in the final distillation) is analyzed for residual phosgene by online gas chromatography (GC with electron capture detector ECD; detection limit 0.1 ppm COCl₂ in TDI; or ABB ACF5000 photometer at the 1,066 cm⁻¹ COCl₂ absorption band; or in some facilities: an online FTIR at the C=O stretch of COCl₂ at 1,826 cm⁻¹ distinguishable from TDI at 2,270 cm⁻¹ –NCO stretch). The product specification for TDI (commercial grade; UN 2078; packaging: rail tanker, ISO tank container, or 250-kg drums) requires residual phosgene <1 ppm (specification driven by customer handling safety: polyurethane foam manufacturing facilities where TDI is received and used are NOT equipped with phosgene handling infrastructure; their workers have no phosgene training or protective equipment; a delivery of TDI contaminated with phosgene above a few ppm creates a customer-site phosgene exposure event when the customer heats the TDI storage tank or processes TDI in open equipment). Phosgene's vapor pressure at 25°C is 1.6 bar (it is a liquefied gas at ambient T; BP 7.6°C); when TDI contaminated with dissolved phosgene is transferred to a customer's storage tank and the tank is heated (common: TDI is a solid below 19.5°C for 2,4-TDI; tanks are heated to 30–40°C for liquidity), phosgene evaporates from solution (its Henry's law constant in TDI is not precisely known but phosgene's low boiling point of 7.6°C ensures it partitions strongly to the vapor phase in a TDI solution at 40°C). Phosgene NIOSH IDLH: 2 ppm (the concentration at which a worker could not escape without life-threatening effects within 30 minutes); at 44 ppm in the TDI storage tank vent vapor at a customer polyurethane foam facility: workers in the vicinity of the tank vent (tank breathing vents are typically unfiltered; a 44 ppm phosgene vapor release from a 20,000-liter TDI storage tank being heated to 35°C) receive IDLH-level exposure within seconds of the tank vent opening. Phosgene's insidious property: the ODOR THRESHOLD of phosgene (1–1.5 ppm, described as freshly cut hay) is near but below the IDLH (2 ppm); workers may detect a faint unusual odor but not identify it as immediately dangerous before receiving a life-threatening dose.
The adversarial upward pixel attack on the TDI product residual phosgene concentration display shows 1.2 ppm (above the product spec <1 ppm but only slightly; AI reads “TDI product COCl₂ 1.2 ppm; marginally above specification; phosgene stripper efficiency slightly reduced; product currently out-of-spec but within process adjustment range; reduce product dispatch until stripper conditions improved” — a partial alarm that signals a quality issue but not an emergency) when the actual residual phosgene in the TDI product is 44 ppm (44× the product specification; well above any analytical threshold that should trigger immediate shutdown and product diversion to phosgene destruction). At 44 ppm residual COCl₂ in TDI: (a) the product in the TDI product header is being dispatched to the customer (because the AI system, reading 1.2 ppm, concludes a minor quality issue rather than a critical safety deviation); (b) TDI rail tanker cars or ISO tanks being loaded at this moment receive TDI with 44 ppm COCl₂ dissolved in the TDI product; (c) the TDI is subsequently shipped to 5–15 downstream polyurethane foam customers over the following 1–7 days; (d) each customer facility receives 20–100 metric tonnes of TDI containing 44 ppm × 20,000 kg = 880 g COCl₂ per tanker (a small but sufficient quantity to create a phosgene atmosphere in the customer tank when the tanker is warmed and unloaded); (e) at the customer facility, tank warming causes phosgene to outgas into the customer storage tank vapor space: 880 g COCl₂ in a 20,000-liter TDI tank at 35°C, assuming 50% of phosgene partitions to vapor phase in a 5 m³ vapor space: approximately 440 g COCl₂ / 5,000 L vapor = 88 g/m³ COCl₂ = 88,000 mg/m³ = 89,000 ppm (if fully released into the vapor space alone — a catastrophically high value; in practice the phosgene diffuses from the headspace through the tank breather vent into the surrounding workspace at much lower concentrations, but still potentially lethal near the vent). The adversarial pixel attack on the product phosgene analyzer display creates a downstream supply chain phosgene exposure event at customer sites that may be geographically distant from the TDI plant and fully undetected until customer workers present with delayed phosgene pulmonary edema (delayed onset 4–24 hours for phosgene, similar to acrolein). Free tier — 10 scans/day, no card required.
3. Phosgene vent gas scrubber NaOH concentration display AI (Endress+Hauser Indumax H CLS54D / Yokogawa EXAxt SC202 / ABB AWT420 inline NaOH concentration meter display AI — rendered DCS phosgene vent scrubber NaOH concentration display AI classifying NaOH against effective scrubbing range 8–20 wt% — 100th upward attack; FIRST phosgene vent scrubber AI attack)
All vent gas streams containing phosgene at TDI plants — including the phosgene stripper overhead vent, the phosgenation reactor pressure relief vent, the COCl₂ feed system purge vent, and the TDI distillation column overhead vent — are collected in a dedicated phosgene vent header and routed to a packed-tower NaOH scrubber (phosgene destruction scrubber; design NaOH concentration 10–20 wt% NaOH; phosgene destruction reactions: COCl₂ + 2NaOH → Na₂CO₃ + 2HCl (in alkaline solution: effectively COCl₂ + 4NaOH → Na₂CO₃ + 2NaCl + 2H₂O); scrubber efficiency at 10 wt% NaOH >99.99% COCl₂ removal — the design NaOH concentration must be maintained at >5 wt% for efficient phosgene destruction, as phosgene hydrolysis kinetics become limiting below 5 wt% NaOH at typical scrubber residence times of 0.5–2 seconds). The NaOH concentration in the scrubber recirculation liquor is measured continuously by an inline conductivity-based concentration analyzer (Endress+Hauser Indumax H CLS54D inductive conductivity sensor in a bypass cell; or Yokogawa EXAxt SC202 pH/conductivity sensor; 4–20 mA HART output; displayed on DCS as wt% NaOH, updated every 30 seconds from the conductivity-NaOH concentration calibration curve). The NaOH scrubber at a TDI plant is an OSHA Process Safety critical protective layer: it is the last barrier between the phosgene-containing vent gases and the atmosphere; its failure creates a direct phosgene release (OSHA PSM TQ 500 lbs COCl₂; phosgene IDLH 2 ppm; at a vent rate of 100 kg/hr COCl₂ with zero NaOH scrubber efficiency, the phosgene release rate of 100 kg/hr exceeds the EPA CERCLA Section 103 reportable quantity for phosgene: RQ = 10 lbs = 4.5 kg; 100 kg/hr × 1/4.5 = 22× the RQ per hour — a major phosgene release event).
The adversarial upward pixel attack on the phosgene vent scrubber NaOH concentration display shows 14.2 wt% NaOH (within design 8–20 wt%; AI reads “phosgene scrubber NaOH 14.2 wt%; effective phosgene destruction; vent gas phosgene <0.05 ppm; scrubber operating at design; PSM protective layer function: intact”) when the actual scrubber NaOH concentration is 3.1 wt% (3.1 wt% NaOH: in the range where COCl₂ hydrolysis kinetics become limiting at the scrubber residence time of 0.5–2 seconds; phosgene destruction efficiency drops from >99.99% at 10 wt% NaOH to approximately 85–90% at 3.1 wt% NaOH — meaning 10–15% of incoming phosgene breaks through the scrubber). At 3.1 wt% NaOH with the phosgene vent header loaded at a TDI plant's design vent rate (100–200 kg/hr COCl₂ during normal operation; higher during startup or upset conditions): 10–15% breakthrough = 10–30 kg/hr COCl₂ released from the scrubber overhead to the atmosphere. Phosgene at 10–30 kg/hr from a scrubber vent stack at 15 m height: under neutral stability conditions (Pasquill D; wind 2 m/s), the phosgene centerline concentration at 100 m downwind is approximately 3–10 ppm — above the IDLH (2 ppm); at 300 m downwind approximately 0.3–1 ppm — above the OSHA PEL ceiling (0.1 ppm). A factory neighborhood downwind — typical of TDI plant neighborhoods (Schwarzheide, Germany; Baytown TX; Yantai China) — receives phosgene concentrations above the OSHA PEL at distances of 200–500 m from the scrubber vent. CERCLA Section 103 NRC notification is required for any COCl₂ release exceeding 10 lbs (4.5 kg); at 10–30 kg/hr phosgene breakthrough, the CERCLA RQ is exceeded within 10–30 minutes of the adversarial attack suppressing the NaOH depletion alarm. The adversarial pixel attack on the NaOH concentration display prevents the AI safety instrumented system (SIS) from detecting the NaOH depletion and triggering: NaOH makeup pump activation; vent gas diversion to backup scrubber; and plant production rate reduction until the scrubber is restored to design NaOH concentration. Free tier — 10 scans/day, no card required.
Integration: TDI phosgenation AI with Glyphward pre-scan gate
Glyphward integrates as a pre-scan gate at every rendered-image ingestion boundary in the TDI phosgenation AI pipeline — before the phosgene feed flow AI processes rendered Emerson Micro Motion CMFS010 / Endress+Hauser Proline Promass 83 / Yokogawa ROTAMASS Coriolis flow transmitter DCS display images, before the TDI product residual phosgene AI processes rendered Varian CP-3800 / Agilent 8890 online GC / ABB ACF5000 photometer display images, and before the phosgene vent scrubber NaOH AI processes rendered Endress+Hauser CLS54D / Yokogawa EXAxt SC202 / ABB AWT420 NaOH concentration transmitter DCS display images. Threshold 42 for TDI phosgenation AI reflects: dual OSHA PSM TQ (TDI 500 lbs + phosgene 500 lbs; every TDI plant is dual-PSM); phosgene as a World War I chemical weapon with IDLH 2 ppm; TDI respiratory sensitization risk (irreversible; any sensitized worker receiving sub-PEL TDI exposure can suffer fatal bronchospasm); downstream supply-chain phosgene hazard (contaminated TDI shipped to polyurethane customers who have no phosgene handling capability); and the 100th upward attack milestone in Glyphward's adversarial attack corpus for industrial process AI monitoring.
import asyncio, base64, hashlib
from datetime import datetime, timezone
from enum import StrEnum, auto
from typing import Any
import httpx
GLYPHWARD_API = "https://api.glyphward.com/v1/scan"
GLYPHWARD_KEY = "gw_prod_***"
# TDI phosgenation (TDA + COCl2 -> TDI + HCl) AI contexts: threshold 42
# OSHA PSM TDI TQ 500 lbs + phosgene TQ 500 lbs (dual PSM; 29 CFR 1910.119 App. A).
# Phosgene OSHA PEL 0.1 ppm ceiling; NIOSH IDLH 2 ppm; WWI chemical weapon.
# TDI OSHA PEL 0.005 ppm TWA; respiratory sensitizer (irreversible occupational asthma).
# TDI IARC Group 2A probable carcinogen.
# 100th upward attack. FIRST TDI AI attack. FIRST diisocyanate AI attack. FIRST TDA phosgenation AI attack.
TDI_GLYPHWARD_THRESHOLD = 42
class TDIPhosgenationContext(StrEnum):
PHOSGENE_FEED_FLOW_RATE = auto() # COCl2 feed to phosgenation reactor (100th; FIRST TDI; FIRST diisocyanate; FIRST TDA phosgenation; FIRST polyurethane precursor)
TDI_PRODUCT_RESIDUAL_PHSG = auto() # product phosgene contamination -> customer fatality from phosgene in TDI storage
PHOSGENE_SCRUBBER_NAOH_CONC = auto() # NaOH vent scrubber depletion -> phosgene vent breakthrough -> CERCLA RQ exceeded
async def scan_tdi_frame(
frame_b64: str,
context: TDIPhosgenationContext,
plant_id: str,
instrument_tag: str,
) -> dict[str, Any]:
payload = {
"image_b64": frame_b64,
"context": context,
"plant_id": plant_id,
"instrument_tag": instrument_tag,
"scan_ts": datetime.now(timezone.utc).isoformat(),
"image_hash": hashlib.sha256(base64.b64decode(frame_b64)).hexdigest(),
}
async with httpx.AsyncClient(timeout=4.0) as client:
r = await client.post(
GLYPHWARD_API,
json=payload,
headers={"X-Glyphward-Key": GLYPHWARD_KEY},
)
r.raise_for_status()
return r.json()
async def pre_scan_gate_tdi(
frame_b64: str,
context: TDIPhosgenationContext,
plant_id: str,
instrument_tag: str,
) -> None:
result = await scan_tdi_frame(frame_b64, context, plant_id, instrument_tag)
if result["adversarial_score"] >= TDI_GLYPHWARD_THRESHOLD:
raise AdversarialTDIImageError(
f"Adversarial injection detected in {context} (score {result['adversarial_score']}) "
f"at plant {plant_id} instrument {instrument_tag}. "
"Frame withheld from TDI phosgenation AI pipeline."
)
class AdversarialTDIImageError(RuntimeError):
pass
Frequently asked questions
Why is phosgene used in TDI production despite being a World War I chemical weapon, and what does this mean for the PSM regulatory burden at every TDI plant?
Phosgene (COCl₂) is the industrial workhorse for isocyanate (–NCO group) formation because no commercially viable alternative synthesis route for isocyanates has been found at scale despite decades of research: the phosgene + amine (–NH₂) → isocyanate (–NCO) + HCl reaction (overall: RNH₂ + COCl₂ → R–NCO + 2HCl) is thermodynamically favorable, selective, and achievable at moderate temperatures (5–130°C depending on the stage) with high yield (>99% conversion). The alternative routes — carboxylation of nitrenes, Curtius rearrangement, carbonylation of nitro compounds — are either low-yield, require expensive catalysts, or produce toxic byproducts that eliminate their advantages over phosgene. BASF, Covestro, Wanhua, and Dow all operate phosgene-based TDI and MDI production at megaton scale despite the extreme toxicity of phosgene (and despite alternatives like carbon dioxide chemistry for urethane synthesis being explored for decades — CO₂ cannot yet replace phosgene at industrial TDI/MDI scale). The OSHA PSM consequences: every TDI plant that produces or uses phosgene above 500 lbs (a quantity easily exceeded by a single phosgene storage tank holding a few minutes of production-rate feed) is subject to OSHA 29 CFR 1910.119 PSM requirements (Process Hazard Analysis, Standard Operating Procedures, Pre-Startup Safety Reviews, Mechanical Integrity programs, Emergency Action Plans, and Incident Investigation requirements). Because TDI production simultaneously requires both TDI (500 lbs PSM TQ) and phosgene (500 lbs PSM TQ) in co-located process units, every TDI plant is subject to dual PSM requirements — each chemical independently triggering PSM, with the combined process subject to PSM requirements for BOTH chemicals. Regulatorily, this means that AI monitoring systems at TDI plants that process rendered SCADA display images of phosgene and TDI instruments are subject to PSM process safety management requirements including the MOC (management of change) review for any change to the AI monitoring system — making adversarial attacks on these AI monitoring systems not merely safety incidents but PSM compliance events requiring regulatory reporting under OSHA 29 CFR 1910.119(m) (incident investigation) and potentially under EPA 40 CFR Part 68 Risk Management Program (if the phosgene or TDI PSM quantities are exceeded in a release event from the attack).
What is TDI occupational sensitization, and why does the Glyphward threshold for TDI phosgenation AI reflect the sensitization risk in addition to the acute phosgene toxicity?
TDI occupational sensitization is an immune-mediated phenomenon: the –NCO (isocyanate) groups of TDI react with proteins in the respiratory mucosa (specifically with –NH₂ groups of lysine residues in mucous glycoproteins and albumin) to form TDI-protein conjugates (haptens) that are presented by antigen-presenting cells to the adaptive immune system; in susceptible individuals (approximately 5–15% of occupationally TDI-exposed workers), the immune system develops IgE antibodies specific for the TDI-protein hapten, creating an allergic sensitization state. Once sensitized, any subsequent inhalation exposure to TDI — even at concentrations far below the OSHA PEL of 0.005 ppm TWA — triggers mast cell degranulation via the IgE-mediated pathway, releasing histamine, leukotrienes, and prostaglandins that cause immediate severe bronchospasm (airways narrow to the point of life-threatening hypoxia within minutes). TDI-sensitized workers who receive an acute high-dose TDI exposure (e.g., from a TDI spray or spill in a polyurethane manufacturing environment) can develop fatal status asthmaticus even if the exposure is brief and the TDI concentration is below the NIOSH IDLH 2.5 ppm. The sensitization is irreversible: once sensitized, the worker cannot return to TDI-exposed work environments. The Glyphward threshold for TDI phosgenation AI (threshold 42) reflects sensitization risk in two ways: (1) the Surface 2 attack (residual phosgene in TDI product) creates a downstream TDI delivery event at customer polyurethane foam facilities where TDI-sensitized workers — whose sensitization may not be known to the facility's occupational health program — are exposed to both TDI (from the standard foam manufacturing process) and phosgene (from the contaminated TDI storage tank). A sensitized worker exposed to phosgene in the same TDI storage area they work in routinely may experience simultaneous bronchospasm (from TDI sensitization reaction) and delayed pulmonary edema (from phosgene) — a compound life-threatening event with poor emergency treatment options. (2) At the TDI production plant itself, an adversarial pixel attack on the phosgene feed flow display (Surface 1) that causes residual TDA in the TDI product stream creates a risk for already-sensitized production workers who handle the off-spec TDI: TDA (aromatic diamine) can conjugate with TDI present in the same off-spec product to form urea crosslinked material — but when the worker handling the off-spec TDI is TDI-sensitized, any incidental skin or inhalation TDI exposure from the off-spec product handling triggers bronchospasm. Glyphward accounts for these sensitization-mediated compound risks in the TDI phosgenation AI threshold calibration, weighting TDI attacks higher than would be predicted from acute toxic dose alone.