Repository navigation
馃悰 Keep REPL source ownership across sequential nested calls - #977
Conversation
PR #977: 馃悰 Keep REPL source ownership across sequential nested calls20 files, +779 / -102 Scope馃敶 PR has 881 lines changed. Split into focused PRs. 馃煛 881 lines changed. PRs under 400 receive more thorough review. StructuralOxlint structural signals:
SlopOxlint slop signals:
Static AnalysisOxlint: 92 diagnostics across 7 files (19 rules) no-unused-vars (18): packages/core/src/generated-xmd.ts, packages/core/src/execute.ts, packages/core/src/expand.ts CorrectnessNo extraneous code patterns detected. |
Why
Sequential calls to the same nested Markdown component can execute successfully while
xmd replrefuses to display their retained history. Two Wrapper/Leaf calls producingfirst/secondneed distinct invocation ownership even when they share an authored site and coroutine.Closes #976.
What changes
Each attributed operation retains the exact prior successful import coordinate that owns its source. The REPL can inspect both nested calls, continue interrupted work, and reopen completed work without repeating completed effects.
How it works
Core binds the existing import
DurablePositionin the internal scopedSourceOwnerContext (executablemd.source-owner). Component bodies use their own import; projected caller Content restores its captured caller binding. Attribution writers capture that binding before handing work to another owned task. Elicit and Prompt retain their original props-only APIs; ownership-only invocation and expansion arguments are removed.The additive journal description field contains
{ coroutineId, index }, where index is the existing zero-based per-coroutine yield index within the entry. Projection validates the exact prior import, source and ancestry. Existing unique legacy histories retain inference; ambiguous legacy histories and invalid explicit references refuse without rewriting or re-executing history.Review guide
Start with SO1鈥揝O7 in
packages/cli/tests/repl-model.test.ts, then source admission/Context binding inexecute.tsandexpand.ts, attribution writers, and exact-reference validation inpackages/cli/src/repl/model.ts.Final signed head:
0f165fb2da28710dc548cbb19c17ffc5c2df2fd9. Base:d422daedcfad446b959ec691cb5bad5957f9c178, targeting main with no stacked dependency. ROOT reviewed the final scope and finite correction; this does not claim two independent reviewer agents.How to verify it
The six frozen rows cover sequential nested ownership at every serialized prefix, repeated loop sites and caller projection, real terminal inspection, separate-process completed reopen with an unchanged journal/provider counter, interrupted current/legacy continuation, and malformed/invalid explicit references plus RS1/RS2 regressions. SO7 additionally proves ordinary code-block middleware copies preserve ownership.
Focused receipts for the Context correction: ownership/model/generated suites pass (13 suites, 95 steps); affected boundary suites pass (32 suites, 218 steps); Deno terminal journey passes (1 suite, 1 step).
The temporary fixture declares its module type and links prepared project dependencies using the existing CLI test convention. Its journal reader waits for the existing Ready state before parsing the settled file, avoiding reads during an append while preserving strict validation. Both complete terminal journeys (include selection and #976 ownership/reopen) pass under Node and Deno:
Changed-file oxlint and formatting, diff checks and normal commit signature verification pass. Required CI on the final head is the delivery gate; the exhaustive runtime suites run there.
Risks and limitations
Terminal evidence uses the production source CLI and a counted fake Elicitation provider; no paid Agent call is made. The original ambiguous #975 journal remains untouched and cannot gain ownership metadata retroactively; its completed Architect result remains preserved.
Scope confirmation