chore: tag all tasks runs under posthog code limits#1942
Conversation
Prompt To Fix All With AIThis 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 |
| 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", | ||
| ); | ||
| }); |
There was a problem hiding this 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:
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!
k11kirky
left a comment
There was a problem hiding this comment.
how is internal pretask set? just double checking this is safe
it's fetched from the API, so we're all good |
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