Skip to content

feat: add machine_id column to microdollar_usage_metadata#88

Closed
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
session/agent_c54087a4-990e-4c20-a486-f2971abed0d6
Closed

feat: add machine_id column to microdollar_usage_metadata#88
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
session/agent_c54087a4-990e-4c20-a486-f2971abed0d6

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented Feb 10, 2026

Summary

This PR adds a machine_id column to the microdollar_usage_metadata table to track the machine identifier from which API requests originate.

Changes

  • Schema: Added machine_id text column to microdollar_usage_metadata table in src/db/schema.ts
  • Header extraction: Added machine_id field to getFraudDetectionHeaders() in src/lib/utils.ts, extracting from the X-KiloCode-MachineId HTTP header
  • Type definitions: Added machine_id to UsageMetaData type in src/lib/processUsage.ts
  • SQL INSERT: Updated the metadata INSERT statement to include machine_id
  • Tests & helpers: Updated test files and helper functions to include the new field

How it works

The machine_id is extracted from the X-KiloCode-MachineId HTTP header (following the existing X-KiloCode-* header naming convention) and flows through:

  1. getFraudDetectionHeaders() extracts it from request headers
  2. It's included in FraudDetectionHeaders type (via type inference)
  3. Passed through MicrodollarUsageContextUsageContextInfoUsageMetaData
  4. Inserted into the database via the SQL INSERT statement

Note

No database migration is included - only code/model definitions are updated as requested.


Built for Christiaan by Kilo for Slack

- Add machine_id column to microdollar_usage_metadata table schema
- Extract machine_id from X-KiloCode-MachineId HTTP header in getFraudDetectionHeaders
- Add machine_id to UsageMetaData type and SQL INSERT statement
- Update test files and helper functions to include machine_id field
@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented Feb 10, 2026

@chrarnoldus chrarnoldus deleted the session/agent_c54087a4-990e-4c20-a486-f2971abed0d6 branch February 10, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant