Repository navigation
[Bug][Cursor] After restart of 2.7.35, agent/tool flow without checkpoint continuously reports active context as output-only #373
Description
요약
#245의 후속 보고입니다. #245 및 PR #274는 같은 Cursor conversation에서 이미 관측한 checkpoint를 tool-turn early finalize 뒤에도 carry-forward하도록 수정했습니다.
그러나 OpenCodex를 2.7.35로 업데이트하고 프록시가 재시작된 뒤, cursor/grok-4.5 agent session의 모든 새 요청이 다시 inputTokens = 0, totalTokens = outputTokens로 기록되고 있습니다. 재시작으로 process-local tracker가 비어 있는 상태에서 checkpoint가 한 번도 seed되지 않는 흐름을 현재 fallback이 처리하지 못하는 것으로 보입니다.
이 이슈는 실제 Grok이 수백 토큰만 받거나 사용했다는 주장이 아닙니다. Cursor transport가 authoritative usage를 매 응답 제공하지 않는 상황에서, Codex에 전달되는 active-context usage가 수십~수천 output token으로 축소되어 Context 상태/compaction 판단이 잘못 보이는 문제입니다.
#245와의 관계 및 차이
- #245가 해결한 범위: 같은 Cursor conversation에서 앞서 받은 absolute checkpoint가 존재할 때, checkpoint 없는 tool finalize가 그 값을 작은 output-only total로 덮어쓰지 않도록 carry-forward.
- 이번 범위: 프록시 재시작 직후 또는 처음부터 checkpoint 없는 agent/tool-heavy 흐름에서는 carry-forward의 seed가 없습니다. 이 경우 새 2.7.35 코드도
0 + tokenDelta를 그대로 usage로 내보냅니다. - request/conversation id가 매 요청마다 달라지는지 여부는
usage.jsonl만으로 단정하지 않았습니다. 다만 current checkpoint와 carry-forward checkpoint가 모두 없는 61개 연속 요청에서 동일한 output-only 결과가 관측됐습니다.
환경
| 항목 | 값 |
|---|---|
| OpenCodex | 2.7.35 (2.7.33에서 업데이트) |
| 업데이트 완료 | 2026-07-24T02:16:47.010Z |
| 새 프록시 process 시작 | 2026-07-24 11:16:46 KST |
| OS | Linux / WSL2 |
| Provider | Cursor OAuth, api2.cursor.sh |
| Model | cursor/grok-4.5 |
| Requested effort | 관측된 업데이트 후 요청 61/61 high |
| Local context cap | providerContextCaps.cursor = 250000 (catalog context_window=250000, auto-compact limit 225000) |
위 context cap은 visible window의 상한을 낮추는 별도 설정입니다. totalTokens가 111, 487, 2,912처럼 output token 수치로 리셋되는 현상을 설명하지는 못합니다.
관측 결과
~/.opencodex/usage.jsonl에서 업데이트 완료 시각 이후 provider=cursor, model=grok-4.5 항목을 집계했습니다.
- 관측 구간:
2026-07-24 11:33:41~11:47:04 KST - 성공 요청: 61 / 61 (
HTTP 200) - effort: 61 / 61
high usageStatus: 61 / 61estimated- absolute context가 보고된 행 (
totalTokens > outputTokens): 0 / 61 - output-only 행: 61 / 61
- 최근 output token 예:
722,170,4,048,114,941,875,2,994,494,154,2,912,111,487
대표 형태(프롬프트, 인증 정보, request id는 제외):
{
"provider": "cursor",
"model": "grok-4.5",
"status": 200,
"usageStatus": "estimated",
"usage": {
"inputTokens": 0,
"outputTokens": 487,
"totalTokens": 487,
"estimated": true
}
}업데이트 전 같은 provider/model에서는 수만~십수만 단위 totalTokens가 간헐적으로 관측됐습니다. 따라서 Catalog window나 Codex가 custom usage를 무시하는 문제라기보다, checkpoint/carry가 없는 turn의 fallback 문제로 보입니다.
현재 코드 경로에서의 해석
Cursor live transport의 유효한 token 신호는 서로 다른 의미를 가집니다.
conversationCheckpointUpdate.tokenDetails.usedTokens
-> absolute active context (optional checkpoint)
interactionUpdate.tokenDelta
-> current turn output delta only
2.7.35의 CursorContextUsageTracker는 conversation id별 마지막 checkpoint를 process-local, numeric-only TTL/LRU Map에 유지합니다. finalizeTurnEvents()는 다음 순서로 total을 선택합니다.
current turn checkpoint
-> use it
else prior carry-forward checkpoint for same conversation
-> use it
else
-> emit state.usage only (input=0, total=output tokenDelta)
프록시 재시작 후 tracker는 비어 있습니다. 위 관측에서는 61개 요청 모두에 현재 checkpoint도 carry-forward checkpoint도 없었으므로 마지막 분기가 선택된 것으로 해석됩니다.
기대 동작
checkpoint가 없는 요청에서 정확한 active context를 알 수 없다면, Codex가 실제로 거의 빈 context라고 해석하는 input=0, total=output-only를 보내면 안 됩니다.
다음 중 하나가 필요합니다.
- 안전한 compaction/reset 경계를 보존하면서 numeric last-known context를 response/conversation state에 지속해 restart 후에도 seed로 사용
- seed가 전혀 없는 요청에서는 outgoing request/state로부터 보수적 input estimate를 만들고 계속
estimated: true유지 - 신뢰 가능한 estimate가 불가능하다면, near-empty context로 오인될
totalTokens대신 context usage를 명시적으로 unknown/unavailable로 표현
제안하는 회귀 테스트
- checkpoint를 받은 conversation을 proxy restart 뒤 복원하고, 다음 turn이 checkpoint 없이 tool/client-tool finalize되는 경우
- 새 conversation의 첫 agent/tool turn이 checkpoint 없이 끝나는 경우
- request/conversation id rotation 후 carry가 없거나 rekey가 실패하는 경우
- compaction 직후에는 stale carry를 사용하지 않는 경계
- diagnostic log에 raw prompt 없이
checkpoint=current|carry|missing, context source, reset 여부, 해시된 conversation correlation만 기록
재현에 필요한 최소 조건
- Cursor provider를 OpenCodex의 live transport로 사용
- Responses/Codex client가 tool을 사용할 수 있는 agent turn 생성
- proxy restart 직후 또는 아직 checkpoint가 기록되지 않은 conversation에서 여러 turn 실행
usage.jsonl또는 dashboard Logs에서inputTokens=0및totalTokens=outputTokens반복 확인
원본 프롬프트, OAuth token/cookie, tool arguments, raw provider payload, request id는 의도적으로 첨부하지 않았습니다.
Activity
[-][Bug][Cursor] 2.7.35 재시작 직후 checkpoint 없는 agent/tool 흐름이 active context를 output-only로 계속 보고함[/-][+][Bug][Cursor] After restart of 2.7.35, agent/tool flow without checkpoint continuously reports active context as output-only[/+]github-actions commentedon Jul 24, 2026
English translation (original: ko)
Summary
This is a follow-up report to #245. #245 and PR #274 modified the system to carry forward already observed checkpoints in the same Cursor conversation even after an early finalize of tool-turn.
However, after updating OpenCodex to
2.7.35and restarting the proxy, all new requests from thecursor/grok-4.5agent session are once again recorded asinputTokens = 0,totalTokens = outputTokens. It seems that the current fallback is unable to handle the flow where the process-local tracker is empty after the restart and the checkpoint is never seeded.This issue does not claim that the actual Grok used only hundreds of tokens. In the situation where the Cursor transport does not provide authoritative usage in every response, the active-context usage being passed to Codex is reduced to dozens or thousands of output tokens, resulting in incorrect perceptions of the state/compaction of the Context.
Relationship and Differences with #245
0 + tokenDeltaas usage.usage.jsonl. However, identical output-only results were observed in 61 consecutive requests where both the current checkpoint and carry-forward checkpoint were absent.Environment
2.7.35(updated from2.7.33)2026-07-24T02:16:47.010Z2026-07-24 11:16:46 KSTapi2.cursor.shcursor/grok-4.5highproviderContextCaps.cursor = 250000(catalogcontext_window=250000, auto-compact limit225000)The above context cap is a separate setting that lowers the upper limit of the visible window. It cannot explain the phenomenon where
totalTokensresets to output token numbers like 111, 487, 2,912.Observations
Aggregated the items with
provider=cursor,model=grok-4.5in~/.opencodex/usage.jsonlafter the update completion time.2026-07-24 11:33:41~11:47:04 KSTHTTP 200)highusageStatus: 61 / 61estimatedtotalTokens > outputTokens): 0 / 61722,170,4,048,114,941,875,2,994,494,154,2,912,111,487Representative form (prompt, authentication info, request id excluded):
{ "provider": "cursor", "model": "grok-4.5", "status": 200, "usageStatus": "estimated", "usage": { "inputTokens": 0, "outputTokens": 487, "totalTokens": 487, "estimated": true } }Prior to the update, several tens of thousands to hundreds of thousands of
totalTokenswere sporadically observed with the same provider/model. Therefore, this issue seems more related to the fallback problem of turns without checkpoint/carry rather than the Catalog window or Codex disregarding custom usage.Interpretation in Current Code Path
The valid token signals in Cursor live transport have different meanings.
In
2.7.35, theCursorContextUsageTrackerkeeps the last checkpoint per conversation in a process-local, numeric-only TTL/LRUMap. ThefinalizeTurnEvents()chooses the total in the following order:After a proxy restart, the tracker is empty. In the above observations, since there was neither a current checkpoint nor a carry-forward checkpoint for all 61 requests, it can be interpreted that the last branch was chosen.
Expected Behavior
If accurate active context cannot be known for requests without checkpoints, Codex should not send
input=0,total=output-only, interpreting it as nearly an empty context.One of the following is required:
estimated: true.totalTokens, which may be mistaken for near-empty context.Suggested Regression Tests
checkpoint=current|carry|missing, context source, reset status, and hashed conversation correlation without the raw prompt.Minimum Conditions Required for Reproduction
usage.jsonlor dashboard Logs forinputTokens=0andtotalTokens=outputTokens.The original prompt, OAuth token/cookie, tool arguments, raw provider payload, and request ID have been intentionally omitted.
jhste102lab commentedon Jul 24, 2026
추가 증거: Cursor usage export와 OpenCodex usage 로그 비교
캐시가 실제로 사용되는지와 active-context telemetry 문제를 분리하기 위해, 동일 기간의 Cursor usage CSV와 OpenCodex
usage.jsonl을 비교했습니다. 관련 cache-display 이슈는 #275입니다.첨부 예정 artifact
opencodex-cursor-grok-cache-evidence-issue-373-20260724.zip구성:
cursor-usage-events-2026-07-24.csv: 제공된 Cursor usage export 원본opencodex-cursor-grok-usage-redacted.jsonl: 같은 시간 범위의provider=cursor,model=grok-4.5OpenCodex usage 행. request id, prompt/input, tool arguments, headers, credentials, raw upstream payload 및 상세 오류는 제거됨cache-comparison-summary.json,README.md,manifest.jsonCursor export 관측
CSV의 token 필드가 있는
Included행 859개(2026-07-22 11:28:27~2026-07-24 11:57:54 KST)를 집계했습니다.Cache Read > 0Cache Read합계Input (w/o Cache Write)합계Output Tokens합계Total Tokens합계Input (w/ Cache Write)Cache Read / (Input (w/o Cache Write) + Cache Read)를 단순 cache-read share proxy로 계산하면 전체 가중 비중은 **27.3%**입니다. 이는 CSV가 제공하는 공식 hit-rate 필드는 아니며, event/agent correlation id가 비어 있으므로 request별 정확한 cache hit rate로 해석하면 안 됩니다.proxy restart 뒤의 교차 관측
2.7.35 update/restart 완료(
2026-07-24 11:16:47 KST) 이후 CSV 범위에서:Cache Read > 0입니다. 즉 proxy restart가 Cursor-side cache를 완전히 없앤 것으로 보이지는 않습니다.inputTokens=0,totalTokens=outputTokens였습니다.cachedInputTokens,cacheReadInputTokens,cacheCreationInputTokens를 수집·기록하는 경로가 현재 없습니다.해석
Cloud Agent ID,Automation ID, request id가 없으므로, export 행을 OpenCodex response와 안전하게 1:1 join하여 cache 값을 실시간 backfill할 수는 없습니다.후속 진단에 유용한 instrumentation 제안
raw prompt나 credential을 남기지 않고 다음의 숫자/상태만 debug telemetry에 추가하면 원인 구분에 도움이 됩니다.
checkpoint=current|carry|missingabsent인지, 향후 별도 usage source를 사용했는지이 자료는 "캐시가 꺼졌다"는 주장보다는, Cursor export와 OpenCodex live telemetry가 서로 다른 usage plane을 보고 있으며 OpenCodex가 cache 세부값을 얻지 못한다는 재현 증거입니다.
jhste102lab commentedon Jul 24, 2026
opencodex-cursor-grok-cache-evidence-issue-373-20260724.zip
fix(cursor): estimate context after restart
docs(devlog): 260725_bug_sweep 로드맵 — 미해결 비-GUI 버그 5건 diff-level 계획
docs(devlog): 260725_bug_sweep r2 — A-gate blocker 12건 반영
docs(devlog): #373 prepared-request 구현 계약 (A-gate PASS)
fix(cursor): estimate context from the sent payload when no checkpoin…
lidge-jun commentedon Jul 25, 2026
Fixed on
devin 28066934, included in integration SHAa5ec15e3.When a restarted/checkpoint-less Cursor turn has neither a current checkpoint nor carry-forward total, OpenCodex now derives a request-local input estimate from the bytes actually sent after pruning. Authoritative current checkpoints and carry-forward totals still win, and the estimate is never persisted into the conversation tracker. Regression tests cover restart/no-checkpoint, precedence, pruning, UTF-8 byte budgets, and live-transport wiring.
Validation: Cross-platform CI and Service lifecycle passed for the exact integration SHA. PR #376 is being closed separately as superseded by the integrated implementation.
docs(devlog): 260725_bug_sweep 로드맵 — 미해결 비-GUI 버그 5건 diff-level 계획
docs(devlog): 260725_bug_sweep r2 — A-gate blocker 12건 반영
docs(devlog): lidge-jun#373 prepared-request 구현 계약 (A-gate PASS)
fix(cursor): estimate context from the sent payload when no checkpoin…