Skip to content

feat(plugin): add hook for PII and sensitive data redaction#35524

Open
agnusdei1207 wants to merge 1 commit into
anomalyco:devfrom
agnusdei1207:model-request-hook
Open

feat(plugin): add hook for PII and sensitive data redaction#35524
agnusdei1207 wants to merge 1 commit into
anomalyco:devfrom
agnusdei1207:model-request-hook

Conversation

@agnusdei1207

@agnusdei1207 agnusdei1207 commented Jul 6, 2026

Copy link
Copy Markdown

Issue for this PR

No issue. Small plugin API addition.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a model.request.before server plugin hook after OpenCode prepares the provider request and before it is sent. It exposes system messages, model messages, tools, params, and headers for final request mutation.

This is intended for plugins that need a last-mile request policy, such as redacting sensitive data or PII before provider calls. It does not add any redaction policy to OpenCode itself.

Tool arguments and results remain covered by the existing tool.execute.before and tool.execute.after hooks.

How did you verify your code works?

  • bun typecheck in packages/plugin
  • bun typecheck in packages/opencode
  • bun test test/session/llm-request.test.ts test/provider/transform.test.ts test/plugin/trigger.test.ts --timeout 30000 in packages/opencode

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

#33523 - feat: Add LLM and session observability hooks

This PR might be related as it also deals with LLM/model hooks and observability, which could have overlapping functionality with the model request hook being added in PR #35524. You may want to verify whether these PRs address different aspects of hooks (observability vs. mutation) or if they have conflicting scope.

All other results appear to be related to different aspects of plugins and tools, but not directly addressing the same model request hook feature.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@agnusdei1207 agnusdei1207 changed the title feat(plugin): add model request hook feat(plugin): add hook for PII and sensitive data redaction Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant