Skip to content

Add hints for orgSlug/{project,team}Slug - #69

Merged
dcramer merged 1 commit into
mainfrom
feat/improve-project-parsing
Apr 18, 2025
Merged

dcramer merged 1 commit into
mainfrom
feat/improve-project-parsing

Conversation

@dcramer

@dcramer dcramer commented Apr 18, 2025

Copy link
Copy Markdown
Member

No description provided.

@dcramer
dcramer merged commit 8a535f3 into main Apr 18, 2025
@dcramer
dcramer deleted the feat/improve-project-parsing branch April 18, 2025 05:43
dcramer added a commit that referenced this pull request May 8, 2026
#942)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Problem

The Flue issue-triage workflow ([failing
run](https://github.com/getsentry/sentry-mcp/actions/runs/25576059392/job/75083371051))
404s on the first multi-turn round-trip after a tool call:

```
[flue] Error: [flue] skill("issue-triage") failed: 404 Item with id 'rs_...' not found.
Items are not persisted when `store` is set to false.
```

Same root cause every framework keeps tripping on (vercel/ai#7543,
openai/openai-agents-python#2265, openclaw/openclaw#16803,
earendil-works/pi#3369): `@mariozechner/pi-ai` — the LLM client Flue uses
internally — hardcodes `store: false` on the OpenAI Responses API and
then replays `rs_*` reasoning IDs from the previous turn. Without
server-side persistence the IDs don't resolve and OpenAI 404s.

## Why we don't downgrade to a non-reasoning model

The previous revision worked around this by switching the default to
`openai/gpt-4.1`. That bypasses the bug (gpt-4.1 is `reasoning: false`
in pi-ai's registry, so the entire reasoning code path is skipped), but
it also throws away gpt-5's reasoning quality on a hook whose whole job
is judgment calls (duplicate detection, severity, validity). We want to
stay on gpt-5.

## Why we don't patch pi-ai or fork it

- The earlier `pnpm patch` against `@mariozechner/[email protected]` flipped
the hardcoded `store: false` to `true`. That works narrowly but vendors
an upstream library mid-version, so any future bump silently invalidates
the patch.
- The same upstream PR (earendil-works/pi#1504) was
[auto-closed](earendil-works/pi#1504) by the
maintainer; we shouldn't carry it locally.
- pi-ai migrated to `@earendil-works/[email protected]` (May 7) but Flue
0.3.11 still depends on `@mariozechner/pi-ai`, so an override doesn't
help.
- The Flue PR that exposes a `reasoning`/`thinkingLevel` knob
([withastro/flue#69](withastro/flue#69)) is
merged into `main` but unreleased.

## Fix

OpenAI's documented escape hatch for `store: false` + reasoning is
`include: ["reasoning.encrypted_content"]`. With it, OpenAI returns the
full encrypted reasoning blob inline; pi-ai already serializes that blob
into `thinkingSignature` and ships it back on replay
(`convertResponsesMessages` in `openai-responses-shared.js`). No
`store=true`, no provider-side retention, no patch.

`@flue/sdk` 0.3.11 has no public knob to set this, but the underlying
pi-agent-core `Agent` does: it forwards an `onPayload` hook into
`streamFn`, and pi-ai's `openai-responses` provider invokes
`options?.onPayload?.(params, model)` after building the request. So we
reach into the Session's harness once, install a tiny `onPayload`, and
let pi-ai do the rest.

The hook is a no-op for non-reasoning models and for any provider that
isn't OpenAI Responses / Azure OpenAI Responses, so flipping
`FLUE_TRIAGE_MODEL` to a Claude or non-reasoning model still works
unchanged. We can drop the hook the moment Flue ships #69 or pi-ai stops
hardcoding `store: false`.

### Files

- `.flue/agents/issue-triage.ts` — install
`enableEncryptedReasoning(session)` and switch the default back to
`openai/gpt-5`.
- `docs/flue-hooks.md` — document the hook, the new default, and the
upstream tracking issues.

## Verification

- `pnpm install` —
`node_modules/.pnpm/@mariozechner[email protected]_…/dist/providers/openai-responses.js`
is back to unmodified upstream `store: false`; no `patches/` directory.
- `pnpm run tsc && pnpm run lint && pnpm run test` — all green.
- `pnpm exec flue build --target node` — agent compiles;
`dist/server.mjs` contains the bundled hook (`enableEncryptedReasoning`,
`harness.onPayload`, the literal `"reasoning.encrypted_content"`).
- Reconstructed the harness wiring with `pi-agent-core`'s `Agent` +
`pi-ai`'s `getModel`. Confirmed:
1. The hook adds `reasoning.encrypted_content` to a real
`getModel("openai", "gpt-5")` payload.
2. The same hook leaves `getModel("openai", "gpt-4.1")` payloads
untouched (no `include` field).
3. `pi-agent-core.createLoopConfig` forwards `harness.onPayload` into
the `streamFn` options object — i.e. exactly the path pi-ai's
openai-responses provider invokes after `buildParams`.

End-to-end execution of the triage workflow itself still requires
`OPENAI_API_KEY` / `GH_TOKEN`, which aren't available in this
environment. Once merged, re-running on issue #941 (or any new issue)
will exercise the gpt-5 path with the encrypted reasoning replay.
<!-- CURSOR_AGENT_PR_BODY_END -->

[Slack
Thread](https://sentry.slack.com/archives/C08J1NSPU6S/p1778269683926819?thread_ts=1778269683.926819&cid=C08J1NSPU6S)

<div><a
href="https://cursor.com/agents/bc-b3537aa0-e7d2-5ed6-accf-3446aae3ed2f"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-b3537aa0-e7d2-5ed6-accf-3446aae3ed2f"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Junior (bot) <junior[bot]@sentry.io>

This branch was previously deployed

1 inactive deployment
Actions — 33b96565 Deployed Apr 18, 2025 by dcramer
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