Skip to content

feat(subagents): expose frozen final metadata on ended hook#75973

Closed
anyech wants to merge 1 commit into
openclaw:mainfrom
anyech:feat/subagent-final-metadata-hook
Closed

feat(subagents): expose frozen final metadata on ended hook#75973
anyech wants to merge 1 commit into
openclaw:mainfrom
anyech:feat/subagent-final-metadata-hook

Conversation

@anyech

@anyech anyech commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add privacy-minimal frozen-final metadata to subagent_ended hook events
  • include only availability, SHA-256 over exact frozen-result UTF-8 bytes, byte length, and capture timestamp
  • keep raw final text out of hook payloads

Motivation

Hook consumers sometimes need to correlate a subagent lifecycle completion with the frozen child final result without receiving raw conversation content or inferring delivery/routing from channel state. This adds a narrow, generic signal on the existing subagent_ended hook while preserving privacy and avoiding any send/delivery behavior.

Non-goals

  • no raw final text in hook events
  • no Discord/thread routing
  • no bridge-back policy
  • no final delivery sender
  • no config or Gateway lifecycle changes

Tests

  • corepack pnpm exec vitest run src/agents/subagent-registry-completion.test.ts src/plugins/wired-hooks-subagent.test.ts

Notes

corepack pnpm tsgo:core was also run before the panel-requested amendment. It still reports unrelated existing recordToolPrepStage typing errors in src/agents/pi-*; this patch does not introduce errors in the touched files.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels May 2, 2026
@clawsweeper

clawsweeper Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR adds privacy-minimal frozen final-result metadata to subagent_ended hook events, updates the public hook type, adds focused subagent hook tests, and records the feature in the changelog.

Reproducibility: not applicable. as a bug reproduction. The feature is source-verifiable by comparing current main, where the ended hook lacks final, with the PR path that emits metadata from an existing frozenResultText record.

Next step before merge
No repair lane is needed because the PR has no discrete blocking defect from this review; normal maintainer review and CI should decide whether to accept the new public hook metadata.

Security
Cleared: The diff adds typed hook metadata, tests, and a changelog entry without new dependencies, workflow changes, secret handling, or raw final text exposure.

Review details

Best possible solution:

Land the narrow public hook metadata change after normal maintainer review and CI, preserving the no-raw-final-text boundary.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction. The feature is source-verifiable by comparing current main, where the ended hook lacks final, with the PR path that emits metadata from an existing frozenResultText record.

Is this the best way to solve the issue?

Yes. Reusing the existing frozen-result capture and adding a privacy-minimal object to the existing ended-hook event is narrower than adding a new delivery path, exposing raw text, or inferring state from channel routing.

What I checked:

Likely related people:

  • steipete: Recent current-main history and local blame show Peter Steinberger maintaining the subagent lifecycle/completion extraction area and adjacent plugin-hook surfaces shortly before this PR. (role: recent maintainer and adjacent owner; confidence: high; commits: 59fb9e5ca7fe, 2218ce46fe2e, 6f3b5f8666f3; files: src/agents/subagent-registry-completion.ts, src/agents/subagent-registry-lifecycle.ts, src/plugins/hook-types.ts)
  • onutc: The thread-bound subagents feature introduced the subagent lifecycle hook events, the subagent_ended contract, and the channel-agnostic hook architecture this PR extends. (role: introduced behavior; confidence: high; commits: 8178ea472db1; files: src/plugins/hook-types.ts, src/plugins/hooks.ts, src/agents/subagent-registry-lifecycle.ts)
  • tyler6204: Tyler Yust authored the frozen-result refresh and push-based announce delivery work that provides the stored final-result fields this PR exposes as metadata. (role: adjacent owner; confidence: medium; commits: 81b93b9ce04b, e554c59aac68; files: src/agents/subagent-registry.types.ts, src/agents/subagent-registry-lifecycle.ts, src/agents/subagent-announce.ts)
  • vincentkoc: Vincent Koc recently touched plugin hook/type surfaces and subagent ended hook loading behavior, making him relevant for public hook contract review. (role: recent hook/type maintainer; confidence: medium; commits: 48042c387556, 1b25dcf57a9f; files: src/plugins/hook-types.ts, src/agents/subagent-registry-completion.ts)

Remaining risk / open question:

  • Focused tests were not executed in this read-only review; the PR author's stated Vitest run was inspected from the PR body but not independently rerun.

Codex review notes: model gpt-5.5, reasoning high; reviewed against f4f98f45c72f.

@anyech
anyech force-pushed the feat/subagent-final-metadata-hook branch 5 times, most recently from 4641832 to a79903d Compare May 4, 2026 06:47
Add privacy-minimal metadata to subagent_ended hook events when a frozen child final result is available. Include only availability, hash, byte length, and capture timestamp so hook consumers can correlate final-ready completion without receiving raw final text.

Document and test that the digest covers the exact UTF-8 bytes of frozenResultText for non-blank values.
@anyech

anyech commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR to reduce my active authored PR queue after a newer PR was auto-closed for exceeding the repo's active-PR limit.

Preserved rationale for this closure:
Lower-priority follow-up; related completion/final-delivery ownership work is now being handled in newer PRs. Revisit as a smaller hook-metadata follow-up if still needed after those land.

This is not intended to discard the idea permanently. I will reopen or resubmit a smaller focused PR if maintainers want this direction after the current queue is reduced.

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

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant