Files
PaperClipAI/server
馨冉and馨冉 67e6a6aa2a fix(plugins): bridge issue.child_created activity to issue.created plugin event (#13728)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Plugins subscribe to core domain events such as `issue.created`
through the `events.subscribe` capability
> - Issues created through `POST /issues/:id/children` or accepted-plan
decompositions only log the `issue.child_created` activity action, and
that action was not in the plugin event bridge in `activity-log.ts`
> - Subscribers to `issue.created` therefore never observe child issues,
so plugin workflows that track every new issue silently miss
decompositions
> - This pull request maps `issue.child_created` to the `issue.created`
plugin event type
> - The benefit is that plugin subscribers observe every new issue
through one event type, and the bridged payload matches a top-level
creation because the activity row already carries `entityType: "issue"`
and the new child issue id

## Linked Issues or Issue Description

Fixes: #13466

## What Changed

- Added `issue_child_created: "issue.created"` to
`ACTIVITY_ACTION_TO_PLUGIN_EVENT` in
`server/src/services/activity-log.ts`, with a comment explaining why the
bridge is safe (same entity shape as top-level creation)
- Added `server/src/__tests__/activity-plugin-event-bridge.test.ts`
covering:
- `issue.child_created` is bridged to `issue.created` with the child
issue id as the event entity
  - a native `issue.created` action still passes through unchanged
  - unmapped actions still emit no plugin event

## Verification

```sh
./node_modules/.bin/vitest run server/src/__tests__/activity-plugin-event-bridge.test.ts
```

All 3 tests pass against an embedded Postgres instance. Also ran `git
diff --check`.

## Risks

Low risk. The change only adds a mapping entry; no existing activity
action is remapped or removed. Plugins that already handle
`issue.created` will now also receive child creations. The activity
details payload carries an extra `parentId` field for child creations,
which additive subscribers should tolerate. No migration or schema
change.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

OpenAI Codex (GPT-5, coding-agent mode, repository tool use) — assisted
with root-cause analysis, the mapping change, and the new test file.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

Co-authored-by: 馨冉 <xinxincui239@gmail.com>
2026-12-04 17:35:55 -08:00
..