[BUG]session in transcript_path not updated during subagent run

Resolved 💬 5 comments Opened Nov 11, 2025 by dashesy Closed Jan 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

transcript_path in the hook points to the current session, but as soon as the tool is Task i.e. a subagent, it does not get updated until the subagent is finished.
We still get PreHook, PostHook calls but cannot see what the subagent is really up to

What Should Happen?

Instrad of waiting for subagent to finish and flush the file, it should be flushed more frequently

Error Messages/Logs

Steps to Reproduce

    async def _pre_tool_hook(self, input_data: Dict, tool_use_id: str | None, context):
        """
        Hook: Called BEFORE tool execution
        """
        tool_name = input_data.get("tool_name", "unknown")
        transcript_path = input_data.get("transcript_path")
        def _read():
            with open(transcript_path, 'r') as f:
                return f.readlines()
        lines = await asyncio.to_thread(_read)
        logger.info(f"{transcript_path=} len={len(lines)}")        

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.36

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗