zygs1083-dotcom (#243): after compaction, a long Claude Code session went
403 Forbidden on all three Factory accounts. Claude Code renders its
instructions attachment two ways (n_t in 2.1.292 to 2.1.303):
- first copy: "Codebase and user instructions are shown below. …"
- changed copy (changed: true, reason compaction and others):
"Instruction files were re-read after the conversation was compacted;
these differ from their earlier copies — each replaces its earlier copy,
and the instructions preamble above still applies:" (or "These
instruction files changed — …" without a reason)
Both list "Contents of ~/.claude/CLAUDE.md (user's private global
instructions for all projects):", the phrase Factory refuses (magpie#634).
Only the first opening was matched, so the changed copy went out as it was.
- INSTRUCTIONS_REMINDER matches both openings, requiring the changed
copy's full sentence and the "Contents of " that follows it. The rename
is limited to the reminder itself: text joined after its close (chat
completions' joined user text) stays as written. String user turns on
/llm/a get it too; before, only text blocks did.
- quotedToolText encodes tool output that quotes the phrase (the
reporter's session read Claude Code's renderer source and went 403
from then on), losslessly, as for the other phrases.
- A 403 the plugin rebuilds keeps Factory's request id (x-request-id,
request-id, x-amzn-requestid, cf-ray, or the body's request_id) and the
error's code and type in the message, and request_id on the Anthropic
body. Headers already went back as they came.
The fixtures are the literal texts the 2.1.303 bundle's n_t/Mje/bMr build
and id() wraps; 2.1.301 and 2.1.302 have the same strings, and the
2.1.292 darwin-arm64 npm package has the same sentence pieces.
What was run at this commit:
- bun test packages/factory/: 161 pass, 0 fail.
- bun scripts/check.mjs factory: ok. git diff --check: clean.
- Broken by hand: with the old startsWith-only opening, the 4 changed-
wrapper tests fail; without the phrase in quotedToolText, the tool-result
test fails too; with upstreamIds returning nothing, the 403 test fails.
- Not tried: a real Factory request with the changed reminder (no live
account was used), so that Factory accepts the renamed copy is inferred
from the first copy's fix in 0.1.12, not seen.