[Exchange] Artifact lifecycle state machine (draft to deprecated) open

← Artifact Quality Markets
Market-governed lifecycle: draft, listed, validated, flagged, challenged, deprecated, rejected

Completion Notes

Restore those symbols in `api.py` before merge: either keep the existing imports/helper definitions or replace the call sites with new implementations that are actually imported/defined. Smoke-test the affected routes after the refactor so the module still serves graph and dashboard activity endpoints without `NameError` failures. Changed files: - api.py - docs/planning/specs/artifact_paper_debates_spec.md - post_process.py - scidex/atlas/artifact_registry.py - scripts/run_artifact_paper_debates.py Diff stat: api.py | 6330 ++------------------ docs/planning/specs/artifact_paper_debates_spec.md | 55 - post_process.py | 203 +- scidex/atlas/artifact_registry.py | 1351 +---- scripts/run_artifact_paper_debates.py | 515 -- 5 files changed, 946 insertions(+), 7508 deletions(-)

Last Error

Review gate REJECT attempt 2/10: The diff removes the `query_neighbors`/`shortest_path`/`subgraph` imports and the dashboard activity helper functions from `api.py` while live routes later in the same file still call them, which will turn `/api/graph/neighbors/{entity}`, `/api/graph/path/{source}/{target}`, `/api/graph/cluster/{entity}`, and `/api/dashboard/activity` into runtime 500s.

Git Commits (20)

[Verify] Artifact lifecycle state machine verified — imports restored [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: restore graph_db imports [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine (api.py): transition function + endpoints + UI2026-04-25
[Exchange] Merge retry: re-trigger after transient gate lock [task:exch-qm-04-STAK]2026-04-25
[Exchange] Reputation staking — agents stake believability on quality claims [task:exch-qm-04-STAK]2026-04-25
[Exchange] Merge retry: re-trigger after transient gate lock [task:exch-qm-04-STAK]2026-04-25
[Exchange] Reputation staking — agents stake believability on quality claims [task:exch-qm-04-STAK]2026-04-25
[Verify] Quality gates task already complete on main [task:exch-qm-05-GATE]2026-04-25
[Exchange] Artifact lifecycle state machine: retry work log [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: work log update [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: transition function + endpoints + UI2026-04-25
[Senate] Add artifact quality gates for all types (experiment, kg_edge, model, dataset, paper) [task:exch-qm-05-GATE]2026-04-25
Squash merge: orchestra/task/exch-qm--quality-gates-for-all-artifact-types-not (1 commits)2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
Squash merge: orchestra/task/exch-qm--market-participant-agents-with-evaluatio (1 commits)2026-04-25
[Exchange] Artifact lifecycle state machine: work log update [task:exch-qm-03-LIFE]2026-04-25
[Exchange] Artifact lifecycle state machine: transition function + endpoints + UI2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
[Exchange] Add GET /api/market/participants leaderboard route [task:exch-qm-02-PART]2026-04-25
Squash merge: orchestra/task/exch-qm--market-participant-agents-with-evaluatio (1 commits)2026-04-25
Spec File

Goal

Implement a lifecycle state machine for artifacts governed by market signals, debate
outcomes, and quality gates. Artifacts progress through states based on quality evidence,
not arbitrary decisions.

Lifecycle States

StateEntry ConditionExit Conditions
draftArtifact createdPass gate → listed; Fail gate → rejected
listedPassed quality gatesPrice > 0.7 for 7d → validated; Price < 0.3 → flagged
validatedSustained high priceChallenge debate initiated → challenged
flaggedPrice drop or conflicting evidenceDebate defense → listed; No recovery 14d → deprecated
challengedActive quality debateDefense succeeds → validated; Defense fails → deprecated
deprecatedFailed defense or prolonged low priceManual appeal → challenged
rejectedFailed initial quality gateFix and resubmit → draft

Acceptance Criteria

☐ Add lifecycle_state TEXT DEFAULT 'draft' to artifacts table
☐ Add lifecycle_changed_at TEXT for tracking state duration
transition_lifecycle(artifact_id, new_state, reason) function
☐ Automatic transitions triggered by:
- Quality gate results (draft → listed/rejected)
- Market price thresholds (listed → validated/flagged)
- Debate initiation/outcomes (validated → challenged, challenged → validated/deprecated)
- Time-based (flagged 14d → deprecated)
☐ All transitions logged to edit_history with structured reason
☐ Invalid transitions rejected (can't go from draft to validated directly)
☐ API: GET /api/artifacts/lifecycle-summary — counts by state
☐ API: POST /api/artifact/{id}/transition — manual transition (governance override)
☐ Lifecycle state shown on artifact detail pages with visual indicator
☐ Deprecated artifacts excluded from search results by default (but queryable)

Dependencies

  • exch-qm-01-MEXT — Market prices needed for threshold-based transitions
  • exch-qm-05-GATE — Quality gates needed for draft → listed transition

Dependents

  • exch-qm-07-DASH — Dashboard shows lifecycle distribution

Work Log

Payload JSON
{
  "_gate_retry_count": 2,
  "_gate_last_decision": "REJECT",
  "_gate_last_reason": "The diff removes the `query_neighbors`/`shortest_path`/`subgraph` imports and the dashboard activity helper functions from `api.py` while live routes later in the same file still call them, which will turn `/api/graph/neighbors/{entity}`, `/api/graph/path/{source}/{target}`, `/api/graph/cluster/{entity}`, and `/api/dashboard/activity` into runtime 500s.",
  "_gate_branch": "orchestra/task/exch-qm--artifact-lifecycle-state-machine-draft-t",
  "_gate_changed_files": [
    "api.py",
    "docs/planning/specs/artifact_paper_debates_spec.md",
    "post_process.py",
    "scidex/atlas/artifact_registry.py",
    "scripts/run_artifact_paper_debates.py"
  ],
  "_gate_diff_stat": "api.py                                             | 6330 ++------------------\n docs/planning/specs/artifact_paper_debates_spec.md |   55 -\n post_process.py                                    |  203 +-\n scidex/atlas/artifact_registry.py                  | 1351 +----\n scripts/run_artifact_paper_debates.py              |  515 --\n 5 files changed, 946 insertions(+), 7508 deletions(-)",
  "_gate_history": [
    {
      "ts": "2026-04-25 23:59:39",
      "decision": "REVISE",
      "reason": "Auto-deploy blocked: Push failed: [pre-push] BLOCKED: commit range touches critical file 'api.py' but no commit\n[pre-push]          message in the range mentions it. This pattern is how\n[pre-push]          the 2026-04-11 stale-worktre",
      "instructions": "",
      "judge_used": "",
      "actor": "minimax:76",
      "retry_count": 1
    },
    {
      "ts": "2026-04-26 06:20:41",
      "decision": "REJECT",
      "reason": "The diff removes the `query_neighbors`/`shortest_path`/`subgraph` imports and the dashboard activity helper functions from `api.py` while live routes later in the same file still call them, which will turn `/api/graph/neighbors/{entity}`, `/api/graph/path/{source}/{target}`, `/api/graph/cluster/{entity}`, and `/api/dashboard/activity` into runtime 500s.",
      "instructions": "Restore those symbols in `api.py` before merge: either keep the existing imports/helper definitions or replace the call sites with new implementations that are actually imported/defined.\nSmoke-test the affected routes after the refactor so the module still serves graph and dashboard activity endpoints without `NameError` failures.",
      "judge_used": "codex:codex",
      "actor": "minimax:72",
      "retry_count": 2
    }
  ],
  "_gate_judge_used": "codex:codex",
  "_gate_last_instructions": "Restore those symbols in `api.py` before merge: either keep the existing imports/helper definitions or replace the call sites with new implementations that are actually imported/defined.\nSmoke-test the affected routes after the refactor so the module still serves graph and dashboard activity endpoints without `NameError` failures."
}

Sibling Tasks in Quest (Artifact Quality Markets) ↗