Negotiation Thread Auto-Close on Release Resolution
Negotiation Thread Auto-Close on Release Resolution
Overview
When a deposit release reaches a terminal state — either released or disputed — the platform automatically closes the associated negotiation thread if it is still open. This keeps thread state consistent with the underlying deposit lifecycle without requiring any manual intervention from landlords, agents, or tenants.
How It Works
Trigger Events
The workflow is event-driven and fires on either of the following transitions:
| Event | Description |
|---|---|
deposit/release.released | The deposit has been successfully released to one or more parties |
deposit/release.disputed | The deposit release has entered a formal dispute state |
Processing Steps
-
Locate the negotiation thread.
The system queriesnegotiationThreadswherereleaseIdmatches the ID of the deposit release that triggered the event. -
Check thread status.
If the matched thread has a status ofopen, the auto-close logic proceeds. If the thread is already closed or does not exist, no changes are made to thread data. -
Close the thread.
For an open thread, the system writes:status→closedclosedAt→ current UTC timestamp- A system-generated note is appended to the thread explaining the reason for automatic closure (release resolved or disputed).
-
Notify org admins.
A notification is sent to all administrators in the organisation:- ✅ Success — thread was found and closed successfully.
- ⚠️ Warning — no open thread was found (it may have already been closed, or no thread was linked to this release).
-
Write to audit log.
The auto-close event is recorded in theauditLogfor compliance and traceability purposes.
Affected Data Entities
| Entity | Role | Fields Modified |
|---|---|---|
negotiationThreads | Primary target | status, closedAt, system note |
depositReleases | Trigger source | Read-only (status transition detected) |
notifications | Output | New record created for org admins |
auditLog | Output | New entry recording the auto-close action |
Notification Behaviour
Org admins receive an in-platform notification whenever this workflow runs:
- Success notification confirms the thread ID that was closed and the event that triggered it.
- Warning notification indicates that no open thread was found for the resolved release, prompting admins to investigate if unexpected.
Notifications are created regardless of which terminal state triggered the workflow (released or disputed).
Important Notes
- Idempotent on closed threads. If a negotiation thread was already closed before the release resolved, the workflow takes no action on it and simply issues a warning notification.
- No user action required. The entire workflow is automated. Landlords, agents, and tenants do not need to manually close threads.
- Audit trail. Every auto-close is logged, making it straightforward to reconstruct the history of a thread closure during a compliance review.
- System note visibility. The system note appended to the closed thread is visible to participants in the thread, providing transparency about why it was closed.