BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Microsoft GH-600 Exam - Topic 5 Question 7 Discussion

Posted by Berry on Nov 27, 2026 at 07:56 PM

You have a GitHub repository that uses the GitHub Copilot coding agent and supports hooks stored under .github/hooks/*.json.

The repository contains a PowerShell script at scripts/escalate-to-human.ps1.

You need to ensure that a hook runs before any tool execution and invokes the escalation script.

Which hooks configuration should you use?

A)

{

"version": 1,

"hooks": {

"userPromptSubmitted": [

{

"type": "command",

"powershell": "./scripts/escalate-to-human.ps1",

"cwd": "./scripts",

"timeoutSec": 10

}

]

}

}

B)

{

"version": 1,

"hooks": {

"preToolUse": [

{

"type": "command",

"powershell": "./scripts/escalate-to-human.ps1",

"cwd": ".",

"timeoutSec": 10

}

]

}

}

C)

{

"version": 1,

"hooks": {

"sessionStart": [

{

"type": "command",

"powershell": "./scripts/escalate-to-human.ps1",

"cwd": ".github/hooks",

"timeoutSec": 10

}

]

}

}

D)

{

"version": 1,

"hooks": {

"postToolUse": [

{

"type": "command",

"powershell": "./scripts/escalate-to-human.ps1",

"cwd": ".github/hooks",

"timeoutSec": 10

}

]

}

}

Suggested Answer: B

The correct configuration is B because preToolUse is the lifecycle hook designed to execute before an agent invokes a tool. This makes it the appropriate interception point for controls such as human escalation, permission checks, policy validation, logging, or blocking potentially consequential operations. In this configuration, the escalation script is invoked immediately before tool execution, satisfying the requirement that the control occur before the agent performs the requested action.

The cwd: '.' setting is also appropriate for the command shown because ./scripts/escalate-to-human.ps1 is expressed relative to the repository root. Therefore, the script resolves to the repository's scripts directory as intended.

Option A uses userPromptSubmitted, which occurs when the user submits a prompt and therefore does not guarantee execution before every subsequent tool call. Option C uses sessionStart, which runs only when the agent session begins and is too early to act as a per-tool guardrail. Option D uses postToolUse, which executes only after the tool has already run and therefore cannot satisfy a pre-execution escalation requirement.

Study Guide Reference Topics: Implement Guardrails and Accountability; Copilot hooks; preToolUse; human-in-the-loop escalation; tool execution controls; policy enforcement.


Get Premium GH-600 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
0 comments · newest first

Currently there are no comments in this discussion, be the first to comment!

0/2000 characters

Save Cancel