video-workbench/investigations/2026-06-24-thread-notificat.../README.md

141 lines
4.0 KiB
Markdown

# Thread Notification Wakeup Investigation
Date: 2026-06-24
## Status
- Status: Test 1 passed; workflow promotion pending production-shaped validation.
- Scope: Codex app thread notification / wakeup behavior for Video Workbench child-session orchestration.
- Not a stable workflow rule until accepted conclusions are promoted into `docs/workflows/`, `VIDEO_WORKBENCH.md`, or `AGENTS.md`.
## Problem
The current slide-task workflow uses parent-side waiting and polling:
```text
main session starts child session
-> main session sleeps
-> main session polls child session until completion or timeout
```
This keeps the parent session active for long child runs. The desired behavior is:
```text
main session starts child session
-> main session ends the current turn
-> child session completes work later
-> child session sends a callback to the parent thread
-> parent session wakes and consumes the child handoff
```
## User-Authorized Parent Thread Discovery
There is no known user-facing shell command for the user to obtain the current Codex thread id.
For this investigation, the user explicitly authorizes the parent session to discover the parent thread id through the Codex app thread list at runtime, with this precondition:
```text
The user guarantees only one active main Video Workbench session is running.
```
Discovery rule:
1. Query Codex app threads.
2. Select the thread with:
- `status: active`;
- `cwd: C:\Users\wangq\Documents\Codex\video-workbench`;
- title / preview matching the active notification-wakeup investigation.
3. Treat the result as a runtime observation, not as a stable external API.
Observed parent thread for Test 1:
```text
019ef999-07d2-7333-99b4-d5d2da040406
```
Observation caveat:
- The thread list may contain old idle or not-loaded sessions.
- The selection is considered safe only when the user-controlled precondition holds: one active main Video Workbench session.
## Test 1 Design
Goal:
```text
Prove whether a child Codex thread can wake the parent thread by sending a message to the observed parent thread id after a delay.
```
Carrier:
```text
Clean visible child Codex thread in the same local `video-workbench` project.
```
Steps:
1. Parent records this investigation design.
2. Parent creates one clean child thread.
3. Child waits for 2 minutes.
4. Child sends a callback message to the parent thread id using `send_message_to_thread`.
5. Child writes a local result file under this investigation directory.
6. Parent does not poll the child thread.
7. If the parent thread wakes from the child callback, the parent records the result report.
Success criteria:
- Parent receives a child callback without parent-side polling.
- Parent can continue from the callback and record a result report.
- Child result file exists and identifies the child thread, parent thread, callback time, and callback method.
Failure / inconclusive criteria:
- Child completes but parent is not activated.
- Child cannot access `send_message_to_thread`.
- Child cannot send to the parent thread id.
- Parent wakes only because of unrelated manual/user action.
## Test 1 Runtime Values
```text
parent_thread_id: 019ef999-07d2-7333-99b4-d5d2da040406
child_thread_id: 019ef9a5-5efc-7500-9a7d-4e7ec6920e84
parent_thread_observation_method: Codex app list_threads
workspace: C:\Users\wangq\Documents\Codex\video-workbench
delay: 2 minutes
parent_polling_allowed: no
```
Expected child result path:
```text
investigations/2026-06-24-thread-notification-wakeup/test-1-child-result.md
```
Expected parent report path if awakened:
```text
investigations/2026-06-24-thread-notification-wakeup/test-1-report.md
```
## Test 1 Result
Result:
```text
pass
```
Summary:
- The child slept 120 seconds.
- The child sent a callback with `send_message_to_thread`.
- The parent thread received the child callback without parent-side polling.
- Detailed report: `test-1-report.md`.
Promotion status:
```text
Do not promote into the production slide-task workflow until a production-shaped slide-package test confirms the same callback path.
```