が来たとき

when ... came

→ が
phrase Uncommon #15,682
when ... came Used to say when someone or something came. Although 来た is the past form of 来る, the phrase can also refer to a future event depending on context, such as “when ... comes.”
JA: 友達が来たとき、私は料理をしていた。
EN: When my friend came, I was cooking.

が来たとき私は宿題をしていた

I was doing my homework when he arrived.

あの子が来たとき君は何をしていたんだ

What were you doing when that kid came?

わたしが来たときパーティーはもうかなり進んでいた

The party was already well underway when I arrived.

土曜の夜デイブが来たとき私は眠っていた

I was asleep when Dave came over on Saturday night.

— ミスティック・リバー (2003)

彼女が来たときパーティーは終わった

The party was over when she arrived.

由美が来たとき私はテレビを見ていた

I was watching TV when Yumi arrived.