Skip to content

PR2: Session-node data quality — working_dir + agent + heal-forward - #87

Closed
Diego Colombo (colombod) wants to merge 1 commit into
feat/ingest-durable-cursorfrom
feat/session-node-data-quality
Closed

PR2: Session-node data quality — working_dir + agent + heal-forward#87
Diego Colombo (colombod) wants to merge 1 commit into
feat/ingest-durable-cursorfrom
feat/session-node-data-quality

Conversation

@colombod

Copy link
Copy Markdown
Collaborator

Second of the progressive split of #79 into smaller, independently-reviewable PRs. Stacks on PR1 (#85, ingest correctness) → #81 (storage-protocol isolation) → #78.

Delivers

  • working_dir end-to-end: persisted on the Session node populate-if-missing (never overwrites an existing value), lifted from the event envelope through post_events, coalesced at the Neo4j MERGE, with a model field + validator.
  • agent field (folds in fix: persist agent name on sub-session nodes across a delivery-order race (v6.7.4) #83): populate-if-missing on the Session node, same non-overwrite pattern as working_dir, adjacent in ensure_session_node.
  • IncompleteSession heal-forward: an out-of-order session:start/session:fork arriving after events heals the placeholder forward instead of leaving an IncompleteSession.

Scope

  • Session-node data quality only. No cursor/queue/offset changes (that is PR1, underneath) — diff verified to touch none of queue_manager/* or registry.py.

Surface

  • Additive session-node fields → version 7.0.0 → 7.1.0 + CHANGELOG.

Verification

  • 2150 non-Neo4j tests pass (0 fail); 7 new Neo4j tests pass on a live container (working_dir non-overwrite race, agent-field ordering race, heal-forward); boot-and-serve smoke green (/version → 7.1.0, a sample event's working_dir + agent persist on the Session node).

…eteSession heal-forward

Session-node data-quality changes, stacked on the durable-ingest cursor work.
No cursor/queue code -- that lives in the base branch underneath.

working_dir is now a complete feature: EventRequest accepts an optional
top-level working_dir envelope field (blank/whitespace-only rejected), the
events endpoint lifts it into the event data, and ensure_session_node writes it
onto the Session node. Populate-if-missing -- a node created before working_dir
was known is backfilled by the first subsequent event carrying a non-empty
value; an already-set value is never overwritten (the Neo4j write uses
coalesce(n.working_dir, row.working_dir) rather than last-write-wins, and
working_dir is excluded from the blind SET n += row.props).

agent is backfilled on the existing-node branch with the same
populate-if-missing rule. The agent name for a spawned sub-session arrives only
on the parent's delegate:agent_spawned event, but the child's own session:start
can create the node first, so the parent event routinely lands on the
existing-node branch where agent was previously dropped -- leaving :Session.agent
empty and undercounting WHERE s.agent = ... queries.

IncompleteSession heal-forward: a stale IncompleteSession marker (stamped when a
session:end drained before its session:start/fork) is stripped the moment the
real start/fork is processed, leaving only the correct terminal label. classify()
routes every start/fork transition through _heal_forward.

Tests: heal-forward unit matrix + neo4j race; working_dir non-overwrite unit +
neo4j race; agent non-overwrite unit + neo4j race.

Version 7.1.0.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.

1 participant