tinker_tickets#123 is on prod (#124, released in #125). This PR fixes what Thor still needed before any check leaves shadow. No UI change. Every check stays in shadow until the operator flips one in /etc/thor/thor.json.
Checked against Tinker prod
Create replies:create() already reads every reply from #124: created, deduplicated, updated, reopened, recurrence_noted, new_recurrence. Each one returns the ticket_id the incident now lives on. A new test covers each reply.
Keys: every key Thor emits matches Tinker's format (A-Za-z0-9_.:-, case sensitive), including cluster:ceph_alert:<CODE>.
Write access: from CT 173, a GET to https://t.lotusguild.org/api/ticket_link_api.php with Thor's key returned 405, not 403 and not an Authelia redirect. That means the NPM exemption is in place and the key has read_write scope.
Changes
Bug fix: comments followed an attached ticket.
incident_ticket() returned the newest action row with a ticket number. attach (and now link) rows record another app's ticket.
So after attach_ticket, Thor's "Also seen" and "Cleared" comments would have gone to that ticket.
It now reads only Thor's own creates (open, escalate, refresh). Tested against the fake store and against MariaDB.
Link API.TinkerClient.link() posts to api/ticket_link_api.php.
A 409 (already linked) or a 404 (ticket gone) counts as done, so a retry after a lost reply never loops.
A 401 or 403 turns writes off, the same as create and comment do.
New link outbox action: it waits until both tickets exist, then links "other relates_to Thor's".
It is queued by attach_ticket, and by root-cause absorption when the lower incident was live and so has a ticket of its own.
This is the "Root cause comment + relates_to link" from the thor#1 contract.
Adopting an open shadow incident at go-live.
If a check goes live while one of its incidents is open in shadow, that incident never had an open sent.
Before this fix, every later comment would have waited for a ticket that didn't exist, until it gave up after 30 attempts.
Now the incident sends its open on the first live cycle, then carries on as normal.
Tests
Local: ruff is clean, and 147 passed, 7 skipped. The skipped ones are the MariaDB tests, which the integration job runs.
New tests:
The link client's status handling.
Every contract reply from create.
Comments staying on Thor's ticket after an attach.
A link waiting for both tickets.
A live root cause linking the lower ticket it explains.
tinker_tickets#123 is on prod (#124, released in #125). This PR fixes what Thor still needed before any check leaves shadow. No UI change. Every check stays in shadow until the operator flips one in `/etc/thor/thor.json`.
## Checked against Tinker prod
- **Create replies:** `create()` already reads every reply from #124: `created`, `deduplicated`, `updated`, `reopened`, `recurrence_noted`, `new_recurrence`. Each one returns the `ticket_id` the incident now lives on. A new test covers each reply.
- **Keys:** every key Thor emits matches Tinker's format (`A-Za-z0-9_.:-`, case sensitive), including `cluster:ceph_alert:<CODE>`.
- **Write access:** from CT 173, a GET to `https://t.lotusguild.org/api/ticket_link_api.php` with Thor's key returned **405**, not 403 and not an Authelia redirect. That means the NPM exemption is in place and the key has `read_write` scope.
## Changes
1. **Bug fix: comments followed an attached ticket.**
- `incident_ticket()` returned the newest action row with a ticket number. `attach` (and now `link`) rows record *another app's* ticket.
- So after `attach_ticket`, Thor's "Also seen" and "Cleared" comments would have gone to that ticket.
- It now reads only Thor's own creates (`open`, `escalate`, `refresh`). Tested against the fake store and against MariaDB.
2. **Link API.** `TinkerClient.link()` posts to `api/ticket_link_api.php`.
- A 409 (already linked) or a 404 (ticket gone) counts as done, so a retry after a lost reply never loops.
- A 401 or 403 turns writes off, the same as `create` and `comment` do.
- New `link` outbox action: it waits until both tickets exist, then links "other `relates_to` Thor's".
- It is queued by `attach_ticket`, and by root-cause absorption when the lower incident was live and so has a ticket of its own.
- This is the "Root cause comment + relates_to link" from the thor#1 contract.
3. **Adopting an open shadow incident at go-live.**
- If a check goes live while one of its incidents is open in shadow, that incident never had an `open` sent.
- Before this fix, every later comment would have waited for a ticket that didn't exist, until it gave up after 30 attempts.
- Now the incident sends its `open` on the first live cycle, then carries on as normal.
## Tests
- Local: ruff is clean, and 147 passed, 7 skipped. The skipped ones are the MariaDB tests, which the integration job runs.
- New tests:
- The link client's status handling.
- Every contract reply from `create`.
- Comments staying on Thor's ticket after an attach.
- A link waiting for both tickets.
- A live root cause linking the lower ticket it explains.
- A shadow incident adopted at go-live.
- MariaDB `incident_ticket` ignoring an attach row.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
tinker_tickets#123 is on prod. Before any check goes live:
- incident_ticket() only reads Thor's own creates. attach and link rows record
another app's ticket number, and after an attach every later comment would
have gone to that ticket.
- TinkerClient.link() calls api/ticket_link_api.php (409 and 404 count as done).
attach_ticket and a live root-cause absorption now queue a relates_to link
beside their comment, as the thor#1 contract says.
- An incident open in shadow when its check goes live gets its open then,
instead of comments waiting forever for a ticket that was never created.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged and deployed. Note: Gitea merged as soon as I asked, without waiting for the PR checks, because they aren't required checks. Both runs then finished green: PR run 4069 and main run 4070.
The only ERROR line is gunicorn 27's "Control server error: Read-only file system /var/lib/thor/.gunicorn". It has been logged on every start since 2026-11-26 and is harmless; a small follow-up will silence it.
Memory is live (operator's choice, 2026-11-27): /etc/thor/thor.jsonchecks.memory = "live", with a backup at thor.json.bak-20261127. thor-monitor restarted cleanly. reboots, cluster, ceph_alerts, scrapes, pvestatd and maintenance stay in shadow:
Reboots and fencing wait for Gandalf's /covering pre-check, to avoid duplicate host-down tickets.
Ceph waits for phase 2.
There are no active incidents, so nothing has been sent yet. The 7-day reopen is tinker_tickets#126.
Merged and deployed. Note: Gitea merged as soon as I asked, without waiting for the PR checks, because they aren't required checks. Both runs then finished green: PR run 4069 and main run 4070.
Post-merge check on CT 173:
- prod HEAD bd1241d.
- `thor` and `thor-monitor` active, `/health` 200.
- No tracebacks.
- The only ERROR line is gunicorn 27's "Control server error: Read-only file system /var/lib/thor/.gunicorn". It has been logged on every start since 2026-11-26 and is harmless; a small follow-up will silence it.
**Memory is live** (operator's choice, 2026-11-27): `/etc/thor/thor.json` `checks.memory = "live"`, with a backup at `thor.json.bak-20261127`. `thor-monitor` restarted cleanly. `reboots`, `cluster`, `ceph_alerts`, `scrapes`, `pvestatd` and `maintenance` stay in shadow:
- Reboots and fencing wait for Gandalf's `/covering` pre-check, to avoid duplicate host-down tickets.
- Ceph waits for phase 2.
There are no active incidents, so nothing has been sent yet. The 7-day reopen is tinker_tickets#126.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
tinker_tickets#123 is on prod (#124, released in #125). This PR fixes what Thor still needed before any check leaves shadow. No UI change. Every check stays in shadow until the operator flips one in
/etc/thor/thor.json.Checked against Tinker prod
create()already reads every reply from #124:created,deduplicated,updated,reopened,recurrence_noted,new_recurrence. Each one returns theticket_idthe incident now lives on. A new test covers each reply.A-Za-z0-9_.:-, case sensitive), includingcluster:ceph_alert:<CODE>.https://t.lotusguild.org/api/ticket_link_api.phpwith Thor's key returned 405, not 403 and not an Authelia redirect. That means the NPM exemption is in place and the key hasread_writescope.Changes
incident_ticket()returned the newest action row with a ticket number.attach(and nowlink) rows record another app's ticket.attach_ticket, Thor's "Also seen" and "Cleared" comments would have gone to that ticket.open,escalate,refresh). Tested against the fake store and against MariaDB.TinkerClient.link()posts toapi/ticket_link_api.php.createandcommentdo.linkoutbox action: it waits until both tickets exist, then links "otherrelates_toThor's".attach_ticket, and by root-cause absorption when the lower incident was live and so has a ticket of its own.opensent.openon the first live cycle, then carries on as normal.Tests
create.incident_ticketignoring an attach row.🤖 Generated with Claude Code
Merged and deployed. Note: Gitea merged as soon as I asked, without waiting for the PR checks, because they aren't required checks. Both runs then finished green: PR run 4069 and main run 4070.
Post-merge check on CT 173:
bd1241d.thorandthor-monitoractive,/health200.Memory is live (operator's choice, 2026-11-27):
/etc/thor/thor.jsonchecks.memory = "live", with a backup atthor.json.bak-20261127.thor-monitorrestarted cleanly.reboots,cluster,ceph_alerts,scrapes,pvestatdandmaintenancestay in shadow:/coveringpre-check, to avoid duplicate host-down tickets.There are no active incidents, so nothing has been sent yet. The 7-day reopen is tinker_tickets#126.