Skip to content

Fix cross-task capture attribution in recorded facts - #602

Closed
jamesKhor wants to merge 1 commit into
BaaRai:mainfrom
jamesKhor:fix/fact-capture-scope
Closed

jamesKhor wants to merge 1 commit into
BaaRai:mainfrom
jamesKhor:fix/fact-capture-scope

Conversation

@jamesKhor

Copy link
Copy Markdown
Contributor

What changes

record_fact now uses activity from the current task and intent to record where a quote appeared. A text match in the shared recorder cannot establish who sent an exchange. Removing that lookup makes a fact and its eligibility to close a goal independent of another task's captures.

Non-HTTP goals: Free-text shell and tool output remains available as evidence, but it can no longer close a goal by itself. An observed operator_input fact can qualify when its evidence quotes a recorded human message in the same intent. Verified findings retain their existing proof path.

Migration 0016 clears the old capture ID from identifiable affected facts, preserves their evidence and activity links, and retires affected active digests. Restoring an old task archive runs the same repair before the graph becomes visible. Legacy records with neither capture marker fall outside the repair.

Verification

  • Reran 10 focused checks under the Go race detector on 1b9cf72 with disposable PostgreSQL and SQLite databases. All passed. The two-task regression checks the stored fact and proof result with the recorder detached, empty, and holding a matching response.
  • The isolation, upgrade and archive-restore regressions each passed three additional race-enabled runs.
  • On the same revision, go vet ./... passed. The full Linux suite recorded 3,289 passing tests and subtests, 38 skips and zero failures. Seven native Windows checks passed.

I'd welcome your feedback on the non-HTTP proof behavior, especially which structured tool results should qualify as evidence in a future change.

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Data isolation is the right direction, but three points block it:

  1. prove_goal still accepts evidence from a linked task. A fact from another task must not close this task's goal.
  2. Old facts without provenance skip verification. Please make that fail closed.
  3. tool_output facts can no longer prove a goal, so TCP/DNS and other non-HTTP goals cannot close autonomously. Preserve a task-scoped tool_output proof path, or state explicitly that non-HTTP goals are operator-only and add a test.

Also rebase on main: #598 is merged and took migration 0016, so this PR must renumber to 0017. Keep the migration repair and the digest retirement.

@BaaRai BaaRai closed this in 91da834 Nov 28, 2026
nohanbluu pushed a commit to nohanbluu/ARTEX that referenced this pull request Nov 28, 2026
…BaaRai#602)

Rebased onto main (5f5ec32), keeping migration 0017_legacy_fact_capture_provenance.sql, cross-task shared-capture isolation, repair_legacy_fact_captures, and digest retirement.

Addresses review findings:
- prove_goal resolves evidence strictly within this task (GetNode, not GetNodeWithSources), blocking linked-task facts/findings from closing this task's goals.
- Facts with missing, empty, unverified, retired (captured_traffic), or non-matching provenance fail closed in prove_goal.
- Preserves a task-scoped tool_output proof path for TCP/DNS/non-HTTP goals by tying tool_output facts strictly to this task's recorded tool_result activity (ToolResultActivityContainingEvidence + ActivityMatchesProvenance) without ever reading the shared proxy store.
- For source=operator_input, prove_goal requires the whitespace/case-normalized summary to be contained in the verified operator evidence quote, preventing a benign real operator quote from smuggling an unrelated summary claim (tested in TestProveGoalOperatorInputSummaryMustMatchEvidencePG).
Co-authored-by: James K <jamesKhor@users.noreply.github.com>
@BaaRai

BaaRai commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Landed via #639 after the review fixes: prove_goal resolves evidence inside the current task, missing or unverified provenance fails closed, non-HTTP goals close through a task-scoped tool_output fact tied to recorded tool_result activity, and operator_input summaries must be contained in the verified quote. Migration 0017 carries the legacy repair. Thanks for the original work, James K.

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