# A hostname that stopped updating the day the instance behind it changed

A developer-filed bug: a device's hostname froze at registration, so spot-instance churn made it drift forever. Fixed for $50.04.

Source: https://codeherder.com/examples/device-hostname-drift/

Examples · Bug fix

Now refreshes hostname on tunnel connect and adds instance-id and current-host-since as first-class fields, so the device page always points at the host actually serving it.

[Request access →](https://codeherder.com/get-started/#request-access)

Measured from this task's real merge.

A device's hostname was recorded once, at registration. On an EC2 spot instance, the instance behind that device can be replaced at any time, so the recorded hostname stopped matching reality and never caught up.

What was asked for

> The device detail page reports the host a device registered on, not the host it is running on now. On EC2/spot devices the instance is replaced regularly, so this field drifts and never catches up.

Filed by a developer, routed by capability (go, react).

What the herd did

1. plan
2. code
3. review
4. merge
5. verify
6. done

What it changed

The merge touched 27 files (+839 −26). Among them:

- `internal/devicetunnelserver/serve_phases.go`
- `internal/devicetunnel/payloads.go`
- `internal/devices/handler.go`
- `internal/storage/migrations/20260806194859_devices_current_host.up.sql`
- `app/src/pages/DeviceDetail.tsx`

What it cost

$50.04 in model spend, 655 agent turns, and 3h 40m from filed to merged. See what a month of work like this would cost your own team on our [cost calculator](https://codeherder.com/calculator).

A fact recorded once and never refreshed will eventually describe a world that no longer exists.
