﻿# Qwen Code caches repeated YAML parsing while returning independent sanitized values

Mutate nested values returned from one YAML call and repeat the same input; cached raw parsing must not create shared mutable configuration across callers.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-agent-qwen-yaml-private-cache-fresh-values/
Language: en

The November 15 Qwen Code v0.27.4 release includes a bounded private cache for successful repeated YAML input during startup work. Callers still receive fresh sanitized values, preserving isolation from earlier callers’ mutations. This is a configuration correctness question as much as a parsing optimization: returning one shared mutable object could make a later session inherit a change that was never written to its configuration file.

## Top-level copying is not sufficient isolation

Parse a harmless YAML fixture containing nested objects and arrays. Mutate one nested member in the first returned value, then parse the unchanged text again and compare with an independently constructed expectation. A shallow top-level copy can pass a simple scalar test while still sharing nested references. Include array insertion and deletion as separate controls so the fixture detects aliasing that leaves existing scalar values apparently correct.

## Sanitization belongs to the returned contract

Compare cached and uncached parses through the same public configuration path, including fields the existing sanitizer handles. The implementation reuses a private raw result, not a caller-owned final object. Verify the caller sees the same allowed shape each time. An optimization that skips sanitization on cache hits can produce a different configuration contract for identical text depending on which call happened to populate the cache first.

## Failures and diagnostics remain observable

Repeat invalid YAML and a successful fixture that emits existing warnings or debug output. The PR describes caching successful input while retaining diagnostics. Do not convert a parse failure into a stale successful configuration from another input. Capture each returned error alongside emitted diagnostics, then correct the text and retry. This establishes that process-level reuse does not make a repaired configuration remain broken or make an invalid edit silently reuse an earlier accepted object.

## Bounded retention has a lifecycle meaning

Exercise more distinct synthetic inputs than the tested cache capacity and observe eviction through a supported test seam. Do not infer that sensitive frontmatter disappears as soon as one caller discards its returned value; the PR notes retention until eviction or process exit. A useful adoption record separates fresh returned values, bounded internal retention and process shutdown. It verifies isolation and reuse without claiming that this cache is a durable configuration store or a secure-erasure mechanism.

## Sources

- [Qwen Code v0.27.4 release notes](https://github.com/QwenLM/qwen-code/releases/tag/v0.27.4)
- [Implementation and review #17209](https://github.com/QwenLM/qwen-code/pull/17209)

## Related reading

- [Subagent permissions: delegation does not add authority](/journal/frontier-space-subagent-permission-inheritance/)
- [Inspect sandbox boundaries: a configured container does not move Python tool wrappers](/journal/fg2-inspect-sandbox-tool-wrapper-host-execution/)
