Skip to content

Track NotebookLM projection sync as an openxFactory open item - #209

Merged
brettheap merged 1 commit into
mainfrom
docs/notebooklm-sync-open-item
Aug 19, 2026
Merged

brettheap merged 1 commit into
mainfrom
docs/notebooklm-sync-open-item

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

The NotebookLM projection sync is openxFactory-owned tooling (scripts/sync-notebooklm-books.py, the lifecycle-notebook-projection capability) run at the aggregation level over every repo. A pending --apply run is blocked on NotebookLM host auth. This lands the item as a durable open operational item in its rightful repo (it had been carried on an OpsxFactory session list).

What's here

  • docs/notebooklm-sync-open-item.md — the open item: the pending sync run, the auth blocker (nlm login --wsl fails on this WSL2 host — Windows Chrome over a TCP CDP port the firewall blocks), the workaround built for it, the account decision (personal profile owns the books), the strategic direction (migrate to a machine Google user account so re-auth is unattended — staged as notebook-projection-identity), a related known bug, and step-by-step resume instructions.
  • scripts/nlm_auth.py — the Playwright WSLg persistent-profile auth harness. Launches Chromium inside WSL under WSLg over a stdio pipe (no TCP, no Windows firewall — the exact wall that blocked nlm login --wsl), harvests the five Google cookies, imports them via nlm login --manual. Persistent profile ⇒ one attended sign-in, then unattended refreshes. Unresolved: whether WSLg surfaces a GUI window on this host (a Windows-side question, not a harness defect).
  • README doc index + projection doc §11 link to the open item.

Not in scope

No sync is run by this PR (it needs the login). Nothing live. This is tracking + the workaround tool, so the item survives in the repo instead of on a session list.

🤖 Generated with Claude Code

The projection sync is openxFactory-owned tooling (scripts/sync-notebooklm-books.py)
run at the aggregation level; a pending --apply run is blocked on the NotebookLM
host auth. Records it as a durable open operational item in this repo:

- docs/notebooklm-sync-open-item.md — pending run, the auth blocker, the
  built workaround, the machine-account direction, and how to resume.
- scripts/nlm_auth.py — the Playwright WSLg persistent-profile auth harness
  (launches Chromium over a stdio pipe, bypassing the firewall/TCP-CDP wall
  that blocks nlm login --wsl; imports cookies via nlm login --manual).
- README doc index + lifecycle-notebook-projection.md section 11 link to it.

Moves this off the OpsxFactory session list to its rightful openxFactory home.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 19, 2026 01:26

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds durable in-repo tracking for the NotebookLM projection sync’s blocked --apply run and introduces a WSLg/Playwright-based authentication harness intended to unblock future unattended sync runs under WSL2.

Changes:

  • Adds a new operational runbook documenting the current sync blocker, workaround, and resume steps.
  • Introduces scripts/nlm_auth.py, a Playwright persistent-profile harness to capture Google session cookies and import them into the nlm CLI profile store.
  • Links the new operational item from the README doc index and the lifecycle notebook projection doc.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
scripts/nlm_auth.py New Playwright-based WSLg auth helper to bootstrap/refresh NotebookLM session cookies for nlm.
README.md Adds the new operational-item doc to the core docs index.
docs/notebooklm-sync-open-item.md New durable “open operational item” documenting the blocked sync run, auth wall, workaround, and resume steps.
docs/lifecycle-notebook-projection.md Adds a pointer from the capability doc to the operational tracking item.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/nlm_auth.py
Comment on lines +33 to +38
def google_cookies(ctx) -> dict[str, str]:
out = {}
for c in ctx.cookies():
if c.get("domain", "").endswith("google.com"):
out[c["name"]] = c["value"]
return out
Comment thread scripts/nlm_auth.py
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("mode", choices=["bootstrap", "refresh"])
ap.add_argument("--profile", default="opensoft-bot", help="target nlm profile name")
Comment thread scripts/nlm_auth.py
"'' or 'bundled' = Playwright's bundled Chromium (did NOT render under this WSLg)")
args = ap.parse_args()

Path(args.profile_dir).mkdir(parents=True, exist_ok=True)
Comment thread scripts/nlm_auth.py
Comment on lines +85 to +88
launch_kwargs = dict(
headless=not headed,
args=["--no-sandbox", "--disable-blink-features=AutomationControlled"],
)
@brettheap
brettheap merged commit 47b062e into main Aug 19, 2026
1 check passed
brettheap pushed a commit that referenced this pull request Aug 19, 2026
…line

The mechanism performed the exact reset the ratified rule is titled against. It
does not any more, and the proof is a driven demote rather than a reading of the
code — which is the only kind of evidence this defect has ever yielded, since
nothing writes the round-trip slot by name and a grep for it concluded the rule was
merely unimplemented.

WHAT LANDED, against the seven ratified scenarios.

`scripts/ideation_dashboard/round_trip.py` — new, pure, text in and text out. Two
addressed operations: the provenance slots, and the `xspec:candidate`-marked
section bodies. Nothing else in the document is touched, and that boundedness is
what makes it safe to refresh a fragment a human has been working in.

The plan half marks the ONE move whose destination is the topic's declared primary
fragment, path-only and in the PURE plan, so `demote-<stamp>.plan.yaml` declares it
before anything is written — a human reviewing the plan should not have to infer it
from a basename. That move keeps `Status: staged`, set positively rather than by
omitting a flip, so a snapshot whose header had drifted is normalized too. The
`draft` flip is untouched for the documents bound for `openspec/`.

The executor half is a new `_restore_outline` with the three cases: absent →
restore then refresh; byte-identical → the same; DIFFERS → the live fragment is the
authority, its bytes are never replaced, the refresh applies into it, and the
snapshot is preserved beside it as a VISIBLE `<topic>.snapshot-<change-id>.md` and
named in the README. "Never byte-replace" must not quietly become "silently discard
the other copy".

THREE THINGS THE DESIGN DID NOT FORESEE, all found by writing tests rather than by
review.

`str.splitlines(keepends=True)` — the obvious row model, and the one `_flip_status`
uses — also breaks on \\x0b, \\x0c, \\x1c-\\x1e, \\x85, U+2028 and U+2029. A
governance document containing one would be re-split and rejoined into DIFFERENT
BYTES by a function whose entire promise is that unchanged bytes survive. The
module carries its own three-ending split, and `join(split(t)) == t` is asserted
over eight ending shapes: every other guarantee here is phrased as "these bytes
survive", and that sentence is only meaningful if the pair is lossless.

Per-line endings, not one detected flavor. A rewritten line keeps ITS OWN ending
and only CREATED lines take the document's first-break flavor. Detecting one flavor
and rejoining with it — easier, and what a first draft would do — silently
normalizes every ending in a mixed-EOL document: the same defect class from the
other direction.

And the trap the tasks predicted, hit anyway: `Path.read_text` has no `newline=` in
3.12, and its universal-newline mode translates CRLF to LF ON THE WAY IN. The first
cut of the differs branch read the live fragment with it, so a CRLF outline came
back wholly LF — this verb's move arm was already fixed for exactly that once, and
it re-entered through the newest arm. Every document read is `read_bytes().decode`
now. The CRLF test caught it; nothing else would have.

TESTS: 45 in `test_round_trip.py` and 9 driven cases in `test_gate_console.py`,
whose 83 pre-existing tests stay green untouched. They stay green for a reason
worth asserting rather than assuming — the fixture change ships with no
supporting-docs, so it has no outline move and this arm is inert for it, which a new
test now pins so that "the old tests pass" cannot mean "the new code never ran".

The three-way fence agreement my design promised as the mitigation for a THIRD
implementation of one rule is built, and it compares what each module DOES with
fences rather than a private helper's signature: for ten fixtures, the set of
headings `round_trip.py`, `doc_health.families` and `outline-model.js` each treat as
REAL must be identical. It also pins the predicate's spelling in all three files,
because a fixture set only samples the input space. `~~~` is in there deliberately
— it IS a CommonMark fence and none of the three treats it as one, so a future
"improvement" to any one of them fails here rather than silently diverging.

Every non-obvious bite was mutation-validated: seven mutations, each caught by the
intended test — the outline arm removed entirely (the pre-change defect; 7 tests
catch it), the outline flipped back to draft, a differing destination byte-replaced,
the slot search made fence-blind, replacement lines taking the proposal's endings, a
fabricated `Raised`, and `read_text` re-armed. Both files restored and re-verified
byte-identical.

ONE TASK WAS NOT IMPLEMENTABLE AS I WROTE IT, recorded in tasks.md rather than
quietly narrowed. My 3.3 asked for the snapshot disposition in "the transition
manifest AND the README note". The manifest is written BEFORE any file moves, so it
cannot know whether a destination existed and differed — that is an execution-time
fact about the real tree. Split accordingly: the plan and manifest declare the RULE,
the README records the OUTCOME and names the preserved file. The ratified
requirement asks for it "named in the transition's own record", singular, and the
README is that record — so the contract is met and it was my task wording that
over-specified. Task 2.1's wording was likewise narrowed: `classify_change_file`
was left exactly as it is, because widening a path-only public contract to carry a
topic name its caller already has is the wrong trade; `plan_demotion` marks the move
instead, which is still the pure plan.

DRIVEN PROOF: real `GateConsole.demote` + `execute_demotion_plan` over a real tree
with a live differing fragment. Disposition `preserved`; the live Summary and the
human's own idea-note survived; the aspirational text stayed out; `Status: staged`
held; all five slots filled including `Raised` from the manifest; the `xspec` body
equals the RETURNED proposal's `## Why`; the snapshot kept visible and named;
`_primary_fragment` still selects the outline. No demote was run against the LIVE
corpus — that deletes a change folder and moves real material, and reverting is not
the same as never having done it; the fixture copy runs byte-identical code paths,
and the narrowing is recorded.

Gates, exit codes read directly: `pytest tests/ideation-dashboard -q` 3229 passed,
6 skipped, exit 0; `pytest tests/doc-health -q` exit 1 with the SAME four
pre-existing `test_client_identity_composition.py` failures, diffed as a set
(identical); openspec `--strict` exit 0 and `--all --strict` exit 0 (62/62);
doc-health single-repo exit 0 and byte-identical to a stashed baseline run at the
branch base, no normalization — its 6 -> 7 error count between slices is
`docs/notebooklm-sync-open-item.md` from `47b062e` (#209), untouched by this branch
and proven so rather than asserted.

Not archived, and the parent change's task 4.2 is untouched: realization evidence
and the archive gate come after merge, and that test stays the parent's task.

Co-Authored-By: Claude Opus <[email protected]>
@brettheap
brettheap deleted the docs/notebooklm-sync-open-item branch September 4, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants