TITLE: Are all generalized Scott sets realized as generalized standard systems?
QUESTION [11 upvotes]: Below, I've focused on PA when lots of other theories would do. If replacing PA with a different theory leads to a more answerable question, feel free to do so.

The standard system of a nonstandard model $M$ of PA is the set of sets of natural numbers coded by elements of $M$: $$SS(M)=\{X\subseteq\omega: \exists a\in M\forall x\in\mathbb{N}(x\in X\iff p_x\vert a)\}.$$ (Here "$p_i$" denotes the $i$th prime.) An easy overspill argument shows that $SS(M)$ is always a Scott set,$^1$ and Scott proved that every countable Scott set is the standard system of some nonstandard model.$^2$
We can define an analogous notion$^3$ of standard system with $\mathbb{N}$ replaced with more general initial segments: if $M\subsetneq_{end} N$ are models of PA, then we let $SS_M(N)$ be the set of elements of $M$ coded by elements of $N$: $$SS_M(N)=\{X\subseteq M: \exists a\in N\forall x\in M(x\in X\iff p_x\vert a)\}.$$ (Here "$p_i$" denotes the $i$th prime in the sense of $N$, or equivalently in this case of $M$.) The same overspill argument shows that the second-order structure $(M, SS_M(N))$ is a model of WKL.
My question is whether the analogue of Scott's theorem holds, at least for countable $M$:

Question. Suppose $M$ is a countable model of PA and $\mathcal{X}$ is a countable family of subsets of $M$ such that $(M, \mathcal{X})\models$ WKL. Is there an $N\supsetneq_{end} M$ such that $SS_M(N)=\mathcal{X}$?

The problem here is that in the usual case, we don't need to worry about $\subseteq$ versus $\subseteq_{end}$, whereas that poses a real problem here.

$^1$A set of sets of natural numbers closed under join and Turing reducibility such that for every infinite binary tree in the set, an infinite path through that tree is also in the set. Equivalently, the second-order part of an $\omega$-model of WKL.
$^2$The generalization of Scott's theorem to uncountable Scott sets is wildly open. Knight and Nadel generalized Scott's theorem to Scott systems of cardinality $\aleph_1$, thus solving the problem under the assumption of CH, but their argument breaks down immediately for models of cardinality $\aleph_2$ or greater. Meanwhile, Gitman has recently shown that the question has an affirmative answer for a class of Scott sets characterized in terms of forcing, assuming the set-theoretic hypothesis PFA (which contradicts CH); however, my understanding is that her arguments really only apply to that particular class of Scott sets and that the hypothesis of PFA is currently necessary.
$^3$I've had trouble finding much literature on this, especially compared to the usual notion of a standard system, but Kossak and Schmerl's book does contain some information about them (especially in Chapter $7$).

REPLY [4 votes]: Your question has a positive answer: there do exist proper end extensions for countable models with the required coded sets.
The PA requirement can be weakened. Generalizing results of Friedman[1973], the MacDowell-Specker Theorem extensions of Phillips[1974] and Gaifman[1976], and the results of Kirby, MacAloon, and Murawski[1979], Joseph Quinsey proved in his unpublished (and perhaps unreadable) 1980 thesis Lemma 5.9: 

Suppose $M$ is a countable model of arithmetic and $\mathcal{X}$ is a countable family of subsets of $M$ such that 
$$(M, \mathcal{X})\models exp + \Delta_0^0\text{-Induction} + \Delta_0^0\text{-Arith-Collection} + \text{WKL}$$
where Arith-Collection is the schema (with $q$ not free in $\theta$):
$$\forall m \lt n\, \exists p\,\theta \rightarrow \exists q\,\forall m \lt n \, \exists p \lt q\,\theta \,.$$
Let $\text{T} \in \mathcal{X}$ be such that in $(M, \mathcal{X})$, $\text{T}$ is is the encoding of a consistent set of sentences of arithmetic. Then there exists a proper end-extension $N$ of $M$ which is a model of the standard sentences of $\text{T}$ and is such that $SS_M(N)=\mathcal{X}$.
Moreover, if $(M, \mathcal{X})$ is a model of $\Pi_1^0\text{-overspill}$ (or if $M$ is the standard model), $N$ can be chosen to be recursively saturated.

If additional conditions are placed on $(M, \mathcal{X})$, then using the embedding techniques of Friedman[1973], Wilkie[1977], and Wilmers[1977], we may obtain elementary end extensions. Theorem 5.8 of Quinsey's thesis gives:

Let $k \ge 1$. Suppose $M$ is a countable model of arithmetic and $\mathcal{X}$ is a countable family of subsets of $M$ such that 
$$(M, \mathcal{X})\models \Delta_0^0\text{-CA} + \Delta_0^0\text{-Arith-Collection} + \text{WKL} + \text{“the $\bar{k}$th Turing jump of the empty set exists"}$$
Further suppose that $\Pi_1^0\text{-overspill}$ holds in $(M, \mathcal{X})$. Let $c  \in M$. Then there exists a structure $(N, \mathcal{Y})$ isomorphic to $(M, \mathcal{X})$ such that 

$N$ is a $(k - 1)$-elementary initial segment of $M$,
$SS_N(M)=\mathcal{Y}$, and
the isomorphism fixes $c$.

If in addition we have that $\Sigma_1^1\text{-overspill}$ holds in $(M, \mathcal{X})$ and that
$$(M, \mathcal{X})\models \text{“the $\bar{k}$th Turing jump of the empty set exists"}$$
for each standard integer $k$, then we may require that $N \prec M$.

Since the two structures are isomorphic, we may swap them to get the end-extension. Note in passing that these two results have nothing to do with the main thrust of the thesis, which is to explore applications of Kripke's notion of fulfillability.