github / github/copilot-cli

sessionStart hook stdout is not displayed in terminal UI

Đang mở
#1,352 3 bình luận 3 reaction 0 người được giao Xem trên GitHub
area:terminal-rendering
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

## Summary

`sessionStart` hook stdout is silently discarded — the hook executes successfully but its output is never displayed to the user in the terminal. This prevents common use cases like displaying reminders, checklists, or environment banners at session start.

## Current Behavior

The `sessionStart` hook runs and its stdout is captured at `[DEBUG]` level in the process log, but **nothing is shown to the user** in the terminal UI.

Process log confirms execution:
```
2026-02-08T03:53:23.596Z [DEBUG] Executing hook: ...
2026-02-08T03:53:24.912Z [DEBUG] [hook stdout] 🚨 On-Call Session Started
2026-02-08T03:53:24.921Z [DEBUG] [hook stdout] ⏰ Time (UTC): 2026-02-08 03:53:24
```

The user sees nothing.

## Expected Behavior

`sessionStart` hook stdout should be displayed in the terminal, similar to how startup messages (e.g., "Detected Azure DevOps repository", "Configured MCP servers: ...") are already shown.

## Reproduction

1. Create `.github/hooks/on-call-session.json`:
```json
{
"version": 1,
"hooks": {
"sessionStart": [
{
"type": "command",
"powershell": "$null = [Console]::In.ReadToEnd(); Write-Host 'Session hook fired'",
"bash": "cat > /dev/null; echo 'Session hook fired'",
"cwd": ".",
"timeoutSec": 10
}
]
}
}
```
2. Start a new session: `copilot`
3. Observe: no hook output is displayed, but the process log shows it ran.

## Use Case

On-call engineers want to display reminders at session start — links to dashboards, checklists, environment info. This is a natural use case for `sessionStart` hooks, but the output being silently discarded makes it impossible.

## Proposed Solution

Display `sessionStart` (and `sessionEnd`) hook stdout in the terminal UI, perhaps as a distinct styled block (like the existing MCP server or repo detection messages). For example:

```
● Hook (sessionStart): 🚨 On-Call Session Started
⏰ Time (UTC): 2026-02-08 03:53:24
📋 Reminder: Check On-Call Center → https://contoso.com/supportcenter
```

## Related Issues

- #1139 — Requests injecting hook output into the **LLM context** (complementary — that's about the AI seeing it; this is about the **user** seeing it)
- #991 — `sessionStart`/`sessionEnd` fire per-prompt instead of per-session (separate timing bug)

## Environment

- **OS**: Windows 11
- **Shell**: PowerShell 7.5.4
- **Copilot CLI version**: 0.0.406

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.