Skip to content

[FEATURE]: Pass sessionID and callID to shell.env hook input #13661

Closed

Description

@tesdal

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The shell.env hook currently receives only { cwd: string } as input. Unlike tool.execute.before and tool.execute.after, which both receive sessionID and callID, shell.env has no way to identify which tool invocation triggered it.

Proposed change: Add optional sessionID and callID fields to the shell.env input:

"shell.env"?: (
  input: { cwd: string; sessionID?: string; callID?: string },
  output: { env: Record<string, string> },
) => Promise<void>

The fields are optional because the PTY call site (pty/index.ts) has no session context. The two tool-related call sites (bash.ts, prompt.ts) already have both values in scope.

This is the same pattern used when sessionID was added to chat.system.transform (#7718) and args was added to tool.execute.after (56ad2db). Additive, non-breaking, backward-compatible.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Feb 15, 2026
  2. smola commented on Feb 15, 2026

    @smola

    Not exactly a duplicate, but see this related issue: #9292

  3. tesdal commented on Feb 15, 2026

    @tesdal
    ContributorAuthor

    Thanks @smola – I think this is more symmetric and consistent with how it's done in other events/hooks, and with this change you can easily make your own plugin to get the functionality in #9292 if it takes a while to decide on whether #9292 should land and you want to experiment a bit without having to work opencode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions