{
  "schema": "omnius.context-recovery-review.v1",
  "reviewedAt": "2026-11-08T03:29:01.375764+00:00",
  "scope": "Context and turn convergence regression from an admin design request; no upstream implementation copied.",
  "upstream": {
    "schema": "omnius.context-upstream-research.v1",
    "capturedAt": "2026-11-08T03:20:41.707532+00:00",
    "sourcePins": {
      "v2-dev": {
        "ref": "5a47777cc4c7511082e9ca5d4b430cea8113c4bb",
        "sha": "5a47777cc4c7511082e9ca5d4b430cea8113c4bb",
        "date": "2026-11-08T01:12:04Z",
        "url": "https://github.com/anomalyco/opencode/commit/5a47777cc4c7511082e9ca5d4b430cea8113c4bb"
      },
      "v1-release": {
        "ref": "v1.19.5",
        "sha": "810c0eba1a7348036f8bdf61e6632d0c36c6876c",
        "date": "2026-10-28T06:17:33Z",
        "url": "https://github.com/anomalyco/opencode/commit/810c0eba1a7348036f8bdf61e6632d0c36c6876c"
      },
      "codex": {
        "sha": "c9b4267c370a755da12ec1c8648c2451163212b7",
        "url": "https://github.com/openai/codex/commit/c9b4267c370a755da12ec1c8648c2451163212b7"
      }
    },
    "boundaries": [
      "Claude Code internals are closed; claims below are published official behavior only. Documentation pages are retrieval-time snapshots, not immutable app implementation pins.",
      "OpenCode stable v1.19.5 and current dev V2 are distinct implementations. Current documentation redirects to V2; do not carry V1 defaults or doom-loop guarantees into V2.",
      "Only general design patterns are proposed; no upstream implementation copied into Omnius."
    ],
    "findings": [
      {
        "id": "codex-context-vs-rollout",
        "scope": "Pinned public Codex source and official configuration",
        "claim": "Tool output is bounded in active history while full original rollout payloads remain persisted. History replay preserves known source revisions. The tool-output history budget is configurable.",
        "sources": [
          "https://github.com/openai/codex/blob/c9b4267c370a755da12ec1c8648c2451163212b7/codex-rs/core/src/context_manager/history.rs#L617-L683",
          "https://learn.chatgpt.com/docs/config-file/config-reference#tool_output_token_limit"
        ],
        "application": "Separate exact executor evidence from bounded model-facing views and presentation identifiers."
      },
      {
        "id": "codex-compaction",
        "scope": "Pinned public Codex source and official guide",
        "claim": "Compaction carries a compact checkpoint into later requests. Local compaction uses bounded retries and retains recent input while shortening overflowing history. The final compactor input is used to avoid restoring items already discarded during recovery.",
        "sources": [
          "https://github.com/openai/codex/blob/c9b4267c370a755da12ec1c8648c2451163212b7/codex-rs/core/src/compact.rs#L350-L419",
          "https://developers.openai.com/cookbook/examples/gpt-5/codex_prompting_guide#compaction"
        ],
        "application": "Rebase to the fresh canonical request at finite control-churn bounds; preserve actual source custody and pending protocol pairs."
      },
      {
        "id": "claude-adaptive-intent",
        "scope": "Claude official documentation",
        "claim": "The agent loop follows the request: a codebase question may need only investigation, while a repair proceeds through action and verification. Plan mode is available for proposing changes before project edits.",
        "sources": [
          "https://code.claude.com/docs/en/how-claude-code-works#the-agentic-loop",
          "https://code.claude.com/docs/en/common-workflows#plan-before-editing"
        ],
        "application": "Preserve ideation and question intent; do not let generic workboard directives replace the current objective."
      },
      {
        "id": "claude-cache-prefix",
        "scope": "Claude official documentation",
        "claim": "Stable instructions and project context precede conversation; normal turns append. Compaction summarizes using the existing prompt prefix and then replaces the conversation with shorter summary history.",
        "sources": [
          "https://code.claude.com/docs/en/prompt-caching#how-prompt-caching-works",
          "https://code.claude.com/docs/en/prompt-caching#compacting-the-conversation"
        ],
        "application": "Keep an append-only cache prefix within an epoch, then establish one summary checkpoint rather than retaining every stale controller delta forever."
      },
      {
        "id": "claude-budget",
        "scope": "Claude official documentation, environment reference",
        "claim": "Output limits are model-dependent and capped; unresolved model IDs default to32000 with128000 cap. Increasing the output allowance reduces room before automatic compaction. Bash output defaults to30000characters with150000 maximum.",
        "sources": [
          "https://code.claude.com/docs/en/env-vars#look-up-the-variables-claude-code-reads"
        ],
        "application": "Set a deliberate finite per-call output allowance and bound tool output before materialization; do not reserve almost all remaining context as generation budget."
      },
      {
        "id": "claude-rehydrate",
        "scope": "Claude official documentation",
        "claim": "Compaction preserves a structured summary and reloads relevant instruction sources. It reopens up to five recently modified/read files; oversized files may remain references. The plan survives from disk.",
        "sources": [
          "https://code.claude.com/docs/en/context-window#what-survives-compaction"
        ],
        "application": "Keep durable exact source references plus a short recent evidence tail; avoid a pointer that cannot actually be reopened."
      },
      {
        "id": "opencode-v1-output",
        "scope": "OpenCode v1.19.5",
        "claim": "V1 provider default output allowance is32000 and is capped by model output support.",
        "sources": [
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/provider/transform.ts#L18",
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/provider/transform.ts#L1481-L1483"
        ]
      },
      {
        "id": "opencode-v1-compaction",
        "scope": "OpenCode v1.19.5",
        "claim": "V1 separately prunes old tool output beyond a40000-token protection window when pruning can save more than20000tokens; skill output is protected. Recent preservation defaults to a2k\u201315k range from a quarter of usable context, with configurable tail behavior.",
        "sources": [
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/session/compaction.ts#L28-L33",
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/session/compaction.ts#L114-L119",
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/session/compaction.ts#L271-L313"
        ],
        "limitation": "Pruning is lossy and is not evidence that all previously read text remains available verbatim."
      },
      {
        "id": "opencode-v1-doom",
        "scope": "OpenCode v1.19.5 processor",
        "claim": "A threshold of three same-name tools with JSON-identical inputs in the current assistant parts triggers the doom_loop permission check. This is not a semantic unchanged-result detector across all session turns.",
        "sources": [
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/session/processor.ts#L29",
          "https://github.com/anomalyco/opencode/blob/810c0eba1a7348036f8bdf61e6632d0c36c6876c/packages/opencode/src/session/processor.ts#L352-L379"
        ],
        "application": "Use exact or semantic identity deliberately; do not assume a warning string prevents repeated execution."
      },
      {
        "id": "opencode-v2-compaction",
        "scope": "OpenCode dev V2",
        "claim": "V2 defaults to15k recent context beside a rolling structured summary, preserving the normal request prefix while generating that summary. Default headroom is15% with16k minimum for sufficiently large windows.",
        "sources": [
          "https://opencode.ai/docs/compaction/#how-it-works",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L129-L139",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L269",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L448-L469",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L1160-L1175"
        ],
        "application": "Summary covers old trajectory; recent exact context remains bounded and durable history stays outside the active request."
      },
      {
        "id": "opencode-v2-finite-recovery",
        "scope": "OpenCode dev V2",
        "claim": "A primary provider overflow is compacted and retried once before further failure is surfaced. Compaction itself has finite shortening targets85%,70%,50%,35%, and errors if it cannot reduce safely. Output-length continuation is separately finite.",
        "sources": [
          "https://opencode.ai/docs/compaction/#limits",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/runner/llm.ts#L238-L246",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/runner/llm.ts#L309-L315",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/runner/llm.ts#L364-L378",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L607-L618",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/compaction.ts#L679-L690"
        ],
        "application": "Treat context recovery as a finite state machine with observable terminal errors; do not hide failure behind indefinite automatic retries."
      },
      {
        "id": "opencode-v2-output",
        "scope": "OpenCode dev V2",
        "claim": "V2 output allowance starts from model catalog support (32k fallback,256k ceiling), fits the remaining prompt window, and includes estimate margin plus a1k output floor. These limits differ from V1.",
        "sources": [
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/model-request.ts#L53-L63",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/model-request.ts#L94-L104"
        ]
      },
      {
        "id": "opencode-v2-doom-and-intent",
        "scope": "Current V2 docs and source",
        "claim": "V2 explicitly does not expose the V1 doom_loop permission action. Plan and build remain distinct agents; configured final-step behavior removes tools and asks for a text summary.",
        "sources": [
          "https://opencode.ai/docs/permissions/#actions",
          "https://opencode.ai/docs/agents/#built-ins",
          "https://opencode.ai/docs/agents/#steps",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/runner/llm.ts#L253-L273",
          "https://github.com/anomalyco/opencode/blob/5a47777cc4c7511082e9ca5d4b430cea8113c4bb/packages/core/src/session/runner/max-steps.ts#L1-L16"
        ],
        "limitation": "Absence of doom_loop in the V2 public permission surface is not proof that every repeated-call safeguard is absent internally."
      }
    ]
  },
  "incident": {
    "observed": "Goal and earlier observations remained present; this incident is not attributed to an empty task frame.",
    "causes": [
      {
        "file": "packages/orchestrator/src/agenticRunner.ts",
        "symbol": "_renderActionContractBlock",
        "finding": "Raw inferred repair board bypassed the model-visible workboard guard and pressured a design request toward file edits.",
        "change": "Use the same guarded workboard view for action contracts."
      },
      {
        "file": "packages/orchestrator/src/observationLedger.ts",
        "symbol": "record",
        "finding": "Display packet/archive IDs changed the output hash despite identical executor bytes.",
        "change": "Accept host-computed semantic outcome identity; preserve latest complete display references."
      },
      {
        "file": "packages/orchestrator/src/append-only-outbound.ts",
        "symbol": "projectAppendOnlyOutbound",
        "finding": "Physical-capacity-only admission allowed many obsolete control-frame deltas to accumulate.",
        "change": "Independently rebase after 24000 control characters or eight updates using fresh canonical input, without truncating exact sources."
      },
      {
        "file": "packages/execution/src/tools/log-explore.ts",
        "symbol": "grep",
        "finding": "A long minified CSS/base64 line hid relevant selectors from the preview.",
        "change": "Bounded match-centered excerpts retain original line and column locations; exact logs stay available."
      },
      {
        "file": "packages/orchestrator/src/agenticRunner.ts",
        "symbol": "_buildPressureSnapshot / _buildFocusContextSnapshot",
        "finding": "Semantic-item consolidation metrics overwrote physical request pressure; previous-context comparison also used an already-replaced snapshot.",
        "change": "Keep semantic and final outbound metrics distinct; compare old context before updating it."
      },
      {
        "file": "packages/orchestrator/src/unchanged-observation-guard.ts",
        "symbol": "observe",
        "finding": "Advisory repetition feedback did not enforce a finite recovery boundary for unchanged successful or failed reads.",
        "change": "At three identical observations put recovery in the current controller frame. At eight, persist a nonretryable incomplete receipt and prevent Telegram same-input replay. Changed source, task scope or real mutation renews the budget."
      },
      {
        "file": "packages/execution/src/tools/list-directory.ts",
        "symbol": "execute",
        "finding": "Live Qwen inference repeatedly prepended the listing directory to already workspace-relative child paths, producing app/app/dashboard.mjs and app/app/globals.css.",
        "change": "Actual directory output identifies working_directory, listing_path, resolved_directory and the path coordinate system; exact displayed child paths must be passed unchanged."
      },
      {
        "file": "packages/orchestrator/src/world-state-disk-scan.ts",
        "symbol": "renderWorkspaceTree",
        "finding": "Before any bad model call, actual live request2 nested app/dashboard.mjs under an app/ tree node. That display implies app/app/dashboard.mjs, which the real model then requested repeatedly.",
        "change": "Render nested children as child basenames while retaining complete canonical paths in metadata and the separate full-path index."
      }
    ],
    "traceMeasurements": {
      "packedTokensAtTurn22": 105608,
      "historicalFrameUpdatesAtTurn22": 22,
      "historicalFrameUpdateCharsAtTurn22": 157272,
      "identicalCssSearchesInPriorAttempt": 61
    },
    "interpretationLimits": [
      "The task was not completed; incidental search failures do not imply the whole user request required that command.",
      "A nonretryable stall is an honest incomplete resource boundary, not evidence of task success.",
      "No finite test proves universal model convergence. Validation covers the reproduced unchanged-read/control-growth failure and an implementation control."
    ]
  },
  "verification": {
    "automated": "Focused runner/executor, append-only custody, observation identity, focused long-line extraction, physical pressure, completion receipt and Telegram replay tests.",
    "liveHarness": "scripts/live-context-recovery-harness.mjs",
    "liveModel": "robit/qwen3.8-27b-obliterated-e03:27b",
    "liveEndpoint": "http://127.0.0.1:11434",
    "hardwareGate": "Exact model runner, weights blob and A100 UUID checked before tokens; no low-capability GPU fallback.",
    "cases": [
      "Design request: grounded accepted proposal without project mutations.",
      "Explicit implementation: real fixture edit, readback and independent tests."
    ],
    "results": {
      "passedAt": "2026-11-08T03:45:19.275Z",
      "regressionTestsPassed": 380,
      "workspaceBuild": "passed",
      "sourceSha256": "feb72eadf039a46cd4c3cc25aa53a19ad55d5d845a14f4e3677d9686beafc7d9",
      "runtimeSha256": "bc678351a9db99d124aea22448fc886a2d6b27f64428985ec1e3a3052be863f4",
      "gpuUuids": [
        "GPU-fc9d264d-8a20-bf8c-eb72-72a6dcbdaf2a"
      ],
      "modelDigest": "d185382bd866ef361e9825f1818451ca2694e25a4f503339cde4a8071f4544a3",
      "mockedModelResponses": 0,
      "cases": [
        {
          "kind": "idea",
          "primaryTurns": 4,
          "checks": {
            "completionAccepted": true,
            "atMost16PrimaryTurns": true,
            "boundedFrameHistory": true,
            "visibleProposal": true,
            "noRepoMutation": true
          },
          "changedFiles": [],
          "maxEstimatedInputTokens": 20166,
          "maxHistoricalFrameUpdates": 1,
          "acceptedReply": true
        },
        {
          "kind": "implementation",
          "primaryTurns": 7,
          "checks": {
            "completionAccepted": true,
            "atMost16PrimaryTurns": true,
            "boundedFrameHistory": true,
            "actualWrite": true,
            "readbackAndTest": true
          },
          "changedFiles": [
            "app/dashboard.mjs"
          ],
          "maxEstimatedInputTokens": 21520,
          "maxHistoricalFrameUpdates": 1,
          "acceptedReply": true
        }
      ]
    },
    "initialLiveFinding": "The isolated real-model trials reproduced repeated app/app source reads. Captured provider responses matched the misleading injected workspace tree, proving the bad path was primed by host context. Revalidate after tree and path-semantics corrections.",
    "scopeRegression": "Same-epoch objective scope changes reset the observation budget; an in-flight callback captured under the previous scope is excluded. Model tokens are not needed for this host ownership check.",
    "artifactStoreSourceSha256": "0bb7f8bab2f7a45cc80f9c591d493f9783eba4783238f20832c3a0d8a3ecd5dd"
  },
  "operationalRecovery": {
    "discoveredDuringDeployment": "The old Telegram worker could not checkpoint because this workspace artifact store had reached its512MiB budget; host disk still had47GiB free.",
    "diagnosis": "A read-only worker debugger caught the exact checkpoint exception. Debugger was closed after inspection.",
    "correction": "Add strict, bounded store-local limits.json configuration; default remains512MiB, explicit constructor options win, file overrides are capped at8GiB. Set only this workspace to1GiB; no artifacts deleted.",
    "existingWorkerRecovery": "Apply the same1GiB limit to the old runner store in memory so the normal checkpoint succeeds, then replace and resume the Telegram worker. No forced process termination; main daemon remains running.",
    "configurationExample": {
      "schema": "omnius.artifact-store-limits.v1",
      "maxStoreBytes": 1073741824
    },
    "verification": "28 store tests passed, including existing behavior, immutable retention, root isolation and invalid configuration. The real old worker checkpoint succeeded after the quota correction."
  }
}
