fix(chat): reconcile thread deletion with append-only Agent history
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
Deleting a chat thread with Agent execution history cascades into agent_runs and agent_run_steps. The wave2_agent_run_step_append_only trigger permits lifecycle deletion only after the organization is gone, so normal thread deletion is rejected. The user-facing lifecycle needs a consistent retention/deletion design; do not disable the append-only trigger as a workaround.
Related release-probe fix: #3549 / #3551 explicitly retains a successful private probe as durable evidence. It does not claim to fix this user-facing deletion behavior.
Acceptance: reproduce with a real PostgreSQL fixture containing a completed Agent run; make authorized version-checked thread deletion or its documented retention behavior work without HTTP 500; preserve direct append-only tampering protections, billing usage, tenant isolation, and organization teardown semantics. Investigate all dependent append-only tables and token usage run_id SET NULL behavior before choosing a migration.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failure with a real PostgreSQL fixture containing a completed Agent run, then inspect all dependent append-only tables and token-usage run_id SET NULL behavior. Compare the related release-probe fixes in #3549 and #3551 without treating them as a solution. Done means authorized version-checked thread deletion or documented retention avoids HTTP 500 while preserving tampering protections, billing usage, tenant isolation, and organization teardown semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, typescript
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100