Repository navigation
Conversation
A cleared project records an explicit marker rather than absence, so no later read can mistake it for "unset" and restore the directory the slot was deliberately moved off.
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
5 similar comments
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
Consolidation with PR #11831: port one history.py line and four tests there This branch and PR #11831 carry the same cleared-project code:
At this head the change does nothing yet:
PR #11831 fills all three gaps. It calls What only this PR has:
Suggestion: make PR #11831 the host and port these items there instead of rebasing this branch. When porting:
From a full open-PR audit against origin/main c66f95b (2026-09-25); findings were checked by independent reviewers reading the code. Reply here if this is wrong. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
Triage update (origin/main 5edf2fe, 2026-10-05): the 2026-09-25 consolidation advice still holds Re-checked against the current head 1b7ba08 and main:
The recommendation is unchanged: make #11831 the host and port this PR's unique parts there. Those are the From a full open-PR audit; reply here if this is wrong. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
Thank you @rnoack1 for this work. Status check: the plan from 2026-09-25 and 2026-10-06 is to port this PR's unique parts into #11831 and close this one once they land. At #11831's head ( So I am leaving this open for now. No code or branch changes were made. |
|
Closing this draft as part of stale-PR cleanup: it has had no activity for 14+ days. Nothing is lost. The branch stays, and you can reopen this PR (or open a fresh one rebased on main) whenever you pick it up again. Thanks for the work. |
Problem / Motivation
An empty
projecton a chat slot means two different things — never set, or deliberatelycleared — and the slot stored only absence. Every later read therefore saw "unset" and
restored the previous directory, so clearing a project did not stick: the next turn bound the
very directory the slot had been moved off, and relative writes landed there.
Two mechanisms made it stubborn. The metadata merge is an upsert, which cannot delete a
key, so a truthy-only write silently retained the old value rather than clearing it. And a
provider handed a falsy
work_dirbinds to a concrete default and reports that path as itsown cwd, so comparing a raw stored
""against a live binding never matched — the slotcold-started every turn instead of reusing its session.
Why it matters
A cleared project is a deliberate act with a security-adjacent consequence: it is how a slot
is moved off a directory. Restoring that directory afterwards puts the next turn's writes back
where the user asked them not to go, and does it silently, because nothing in the slot's state
records that a clear ever happened.
The same record carries a pending retirement arm, which had a second sharp edge: an arm was
dropped unconditionally, so a producer unwinding its own failed work could drop an arm a
concurrent producer had just written, letting that producer's in-flight start bind the wrong
project.
What changed
A cleared project is now an explicit marker rather than absence, so no read can mistake it for
"unset":
config/paths.pygains the marker andresolved_cwd, which puts both sides of everydirectory comparison through one definition — the same resolution a provider applies to its
own
work_dir. An empty cwd with no session key raises rather than guessing a root, becausethe provider factory resolves it to a per-session directory, not to the shared workspace.
marker, or nothing at all.
merge (writing both fields unconditionally), channel surfacing, fork, and the history
record's own shape.
arm passes the generation it was given, and the drop no-ops if another producer has armed
the same key in between, leaving that arm and its in-flight start alone.
The session-allocation core, the arm verbs on the session manager, the lifecycle refusal and
the key-binding helper are carried here as shared primitives so this change compiles and tests
standalone; they are identical to their copies in the sibling PRs.
Tests
15 new cases in
test/test_chat_slot_project.py, covering: the tri-state answer for a set,cleared and never-set project; the cleared marker surviving a restart and beating a project
that outlived its clear; a reselected project winning over a carried marker; the merge writing
both fields unconditionally; a second save overwriting the marker rather than omitting it; and
arm retraction leaving a concurrent producer's arm in place while still dropping its own.
Verified against a pristine checkout of the same base commit over a 466-file blast radius:
14 failed / 28064 passed on this branch versus 14 failed / 28049 passed on the control
— identical failing-test id sets, so zero new failures and zero accidental fixes. Each of the
15 added tests also passes individually, against a negative control confirming a nonexistent
test name collects nothing.
Six further cases from the same source change are deferred: they exercise the HTTP handler
layer, which is not carried here, and will follow once it lands.