Skip to content

Commit 706a898

Browse files
author
deepshekhardas
committed
fix: prevent nanosecond overflow in OTLP timestamps
Multiply after BigInt conversion to avoid IEEE 754 precision loss. Affects 4 locations where epoch-ms * 1e6 exceeds Number.MAX_SAFE_INTEGER. Fixes #3292
1 parent 2dd9f37 commit 706a898

5 files changed

Lines changed: 63 additions & 4 deletions

File tree

apps/webapp/app/v3/eventRepository/common.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function extractContextFromCarrier(carrier: Record<string, unknown>) {
2121
}
2222

2323
export function getNowInNanoseconds(): bigint {
24-
return BigInt(new Date().getTime() * 1_000_000);
24+
return BigInt(new Date().getTime()) * BigInt(1_000_000);
2525
}
2626

2727
export function getDateFromNanoseconds(nanoseconds: bigint): Date {
@@ -35,7 +35,7 @@ export function calculateDurationFromStart(
3535
) {
3636
const $endtime = typeof endTime === "string" ? new Date(endTime) : endTime;
3737

38-
const duration = Number(BigInt($endtime.getTime() * 1_000_000) - startTime);
38+
const duration = Number(BigInt($endtime.getTime()) * BigInt(1_000_000) - startTime);
3939

4040
if (minimumDuration && duration < minimumDuration) {
4141
return minimumDuration;

apps/webapp/app/v3/eventRepository/index.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ async function recordRunEvent(
262262
runId: foundRun.friendlyId,
263263
...attributes,
264264
},
265-
startTime: BigInt((startTime?.getTime() ?? Date.now()) * 1_000_000),
265+
startTime: BigInt((startTime?.getTime() ?? Date.now())) * BigInt(1_000_000),
266266
...optionsRest,
267267
});
268268

apps/webapp/app/v3/runEngineHandlers.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ export function registerRunEngineEventBusHandlers() {
464464
);
465465

466466
await eventRepository.recordEvent(retryMessage, {
467-
startTime: BigInt(time.getTime() * 1000000),
467+
startTime: BigInt(time.getTime()) * BigInt(1_000_000),
468468
taskSlug: run.taskIdentifier,
469469
environment,
470470
attributes: {

pr-body-3321.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## What
2+
3+
This PR updates route components to use the animated Resizable panel pattern:
4+
- Converts conditionally-rendered panels to always-mounted animated panels with `collapsible`, `collapsed`, and `collapseAnimation` props
5+
- Adds `useFrozenValue` hook usage to keep last selected item visible during panel collapse animation
6+
- Minor UI polish on logs, runs, schedules, waitpoints pages
7+
8+
## Changes
9+
10+
- **Resizable.tsx** — skipped (main already has these exports)
11+
- **Route files** (logs, runs, schedules, batches, etc.) — convert panel pattern, add `useFrozenValue`
12+
- **LogsTable, TreeView, GitMetadata** — minor improvements
13+
14+
## Manual resolution
15+
16+
Merge had 3 conflicts:
17+
- `Resizable.tsx`: kept main's version (already has animated panel exports with Firefox workarounds)
18+
- `logs/route.tsx` line 419: removed pointless `?? undefined` (PR's cleaner version)
19+
- `runs.$runParam/route.tsx`: kept `panel-run-parent-v3` autosaveId, removed `?? undefined`
20+
21+
## Original PRs
22+
- Original: #3267
23+
- This replaces: #3319
24+
25+
Co-authored-by: James Ritchie <james@trigger.dev>

pr-body-3322.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## What
2+
3+
Adds **OpenClaw agent** integration — a new agent provisioning system with Slack webhooks, agent setup/status pages, and database models.
4+
5+
## Changes
6+
7+
### New files
8+
- `routes/agents.$agentId.status.tsx` — agent status dashboard page
9+
- `routes/agents.setup.tsx` — agent setup wizard
10+
- `routes/api.agents.provision.ts` — provisioning API
11+
- `routes/webhooks.slack.ts` — Slack webhook handler
12+
- `internal-packages/database/prisma/migrations/20260325122458_add_openclaw_agents/migration.sql`
13+
- `.changeset/openclaw-agent-integration.md`
14+
15+
### Schema
16+
- Added `AgentConfig`, `AgentExecution`, `AgentHealthCheck` models
17+
- Added `agentConfigs` relation to User model
18+
19+
### Manual resolutions (merge conflicts)
20+
11 files conflicted during merge:
21+
- **LoginPageLayout, CodeBlock, AppLayout, Table, api.v1.artifacts, HelpAndFeedbackPopover**: kept main's version (branding/styling)
22+
- **test.tasks route, spans route**: kept main's version
23+
- **tailwind.css, tailwind.config.js**: kept main's version
24+
- **schema.prisma**: merged both sides (added AgentConfig + AgentExecution + AgentHealthCheck alongside main's LLM/PlatformNotification models)
25+
26+
### Branding cleanup
27+
Reverted fork-specific branding (`AirTrigger` → `Trigger.dev`, `airtrigger.dev` → `trigger.dev`) across 53 files.
28+
29+
## Notes
30+
- This is a rebased version of #3266, replacing the original PR
31+
- Some PR features (test task inline machine/version controls) were dropped during conflict resolution — consider re-adding as a follow-up
32+
- The animated resizable panel changes from #3267 are handled in PR #3321
33+
34+
Co-authored-by: James Ritchie <james@trigger.dev>

0 commit comments

Comments
 (0)