Skip to content

chore: tag all tasks runs under posthog code limits#1942

Merged
joshsny merged 1 commit intomainfrom
tag-all-tasks-posthog-code
Apr 29, 2026
Merged

chore: tag all tasks runs under posthog code limits#1942
joshsny merged 1 commit intomainfrom
tag-all-tasks-posthog-code

Conversation

@joshsny
Copy link
Copy Markdown
Contributor

@joshsny joshsny commented Apr 29, 2026

we were splitting out cloud and local runs, let’s use posthog_code for everything now so that we can limit all task runs under a posthog code subscription

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/agent/src/server/agent-server.configure-environment.test.ts
Line: 61-75

Comment:
**Prefer parameterised tests for same-outcome cases**

Tests at lines 61-67 and 69-75 both assert identical output (`posthog_code`) and differ only in argument shape (`{ isInternal: false }` vs omitted). Per the team's preference for parameterised tests, these could be collapsed into a single `it.each`:

```ts
it.each([
  ["explicit false", { isInternal: false } as Parameters<TestableServer["configureEnvironment"]>[0]],
  ["omitted (getTask failure fallback)", undefined],
])("tags as posthog_code when %s", (_, args) => {
  buildServer("background").configureEnvironment(args);

  expect(process.env.LLM_GATEWAY_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.ANTHROPIC_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.OPENAI_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code/v1");
});
```

This also adds the missing `ANTHROPIC_BASE_URL` / `OPENAI_BASE_URL` assertions (present in the `background_agents` case but absent here).

**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "tag all tasks runs under posthog code li..." | Re-trigger Greptile

Comment on lines +61 to +75
it("tags as posthog_code when the task is not internal", () => {
buildServer("background").configureEnvironment({ isInternal: false });

expect(process.env.LLM_GATEWAY_URL).toBe(
"https://gateway.us.posthog.com/posthog_code",
);
});

it("tags as posthog_code when isInternal is omitted (getTask failure fallback)", () => {
buildServer("background").configureEnvironment();

expect(process.env.LLM_GATEWAY_URL).toBe(
"https://gateway.us.posthog.com/posthog_code",
);
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Prefer parameterised tests for same-outcome cases

Tests at lines 61-67 and 69-75 both assert identical output (posthog_code) and differ only in argument shape ({ isInternal: false } vs omitted). Per the team's preference for parameterised tests, these could be collapsed into a single it.each:

it.each([
  ["explicit false", { isInternal: false } as Parameters<TestableServer["configureEnvironment"]>[0]],
  ["omitted (getTask failure fallback)", undefined],
])("tags as posthog_code when %s", (_, args) => {
  buildServer("background").configureEnvironment(args);

  expect(process.env.LLM_GATEWAY_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.ANTHROPIC_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.OPENAI_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code/v1");
});

This also adds the missing ANTHROPIC_BASE_URL / OPENAI_BASE_URL assertions (present in the background_agents case but absent here).

Context Used: Do not attempt to comment on incorrect alphabetica... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/agent/src/server/agent-server.configure-environment.test.ts
Line: 61-75

Comment:
**Prefer parameterised tests for same-outcome cases**

Tests at lines 61-67 and 69-75 both assert identical output (`posthog_code`) and differ only in argument shape (`{ isInternal: false }` vs omitted). Per the team's preference for parameterised tests, these could be collapsed into a single `it.each`:

```ts
it.each([
  ["explicit false", { isInternal: false } as Parameters<TestableServer["configureEnvironment"]>[0]],
  ["omitted (getTask failure fallback)", undefined],
])("tags as posthog_code when %s", (_, args) => {
  buildServer("background").configureEnvironment(args);

  expect(process.env.LLM_GATEWAY_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.ANTHROPIC_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code");
  expect(process.env.OPENAI_BASE_URL).toBe("https://gateway.us.posthog.com/posthog_code/v1");
});
```

This also adds the missing `ANTHROPIC_BASE_URL` / `OPENAI_BASE_URL` assertions (present in the `background_agents` case but absent here).

**Context Used:** Do not attempt to comment on incorrect alphabetica... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor

@k11kirky k11kirky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is internal pretask set? just double checking this is safe

@joshsny
Copy link
Copy Markdown
Contributor Author

joshsny commented Apr 29, 2026

how is internal pretask set? just double checking this is safe

it's fetched from the API, so we're all good

@joshsny joshsny merged commit 7bb9149 into main Apr 29, 2026
15 checks passed
@joshsny joshsny deleted the tag-all-tasks-posthog-code branch April 29, 2026 19:21
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.

2 participants