Skip to content

Regression: #2760 dropped permission context when loading legacy v1 session state (re-opens #2768) #2888

Open

Description

@chang6666

Summary

#2769 fixed #2768 ("ReActAgent legacy-state load silently drops permissionContext (downgrades to DEFAULT)") by forwarding the caller's permCtx to LegacyStateLoader. Commit 6059782 (#2760) rewrote ReActAgent.loadOrCreateAgentStateForSlot(...) and dropped that argument, calling the 3-arg LegacyStateLoader.loadFromLegacySessionWithPresence(stateStore, userId, sessionId) overload again — so the regression described in #2768 is live on main again.

Impact

Same as #2768: any session that still has v1-era keys (memory_messages / toolkit_activeGroups) but no new-format agent_state — typically the first turn after a 1.x → 2.0 migration — gets its caller-configured permission mode (e.g. BYPASS) silently downgraded to DEFAULT.

Repro / Fix

  • Repro: seed v1 legacy keys, build an agent with permissionContext(BYPASS), perform the first call() — the reconstructed state comes back DEFAULT instead of BYPASS.
  • Fix: PR fix(core): pass builder permission context when loading legacy v1 session state #2886 (passes permCtx to the 4-arg overload; includes an end-to-end regression test ReActAgentLegacyPermissionContextTest that fails on current main with expected: <BYPASS> but was: <DEFAULT>).

Activity

  1. oss-maintainer commented on Sep 14, 2026

    @oss-maintainer
    Collaborator

    Issue Evaluation

    Category: bug | Area: area/core/agent | Status: Confirmed regression (verified against current main)

    Root Cause: ReActAgent.loadOrCreateAgentStateForSlot receives the caller's permCtx and uses it for the fresh-state path, but its legacy-state path calls the 3-arg LegacyStateLoader.loadFromLegacySessionWithPresence(stateStore, userId, sessionId) overload, which forwards null and silently downgrades a caller-configured permission mode (e.g. BYPASS) to DEFAULT. This re-introduces the behaviour already fixed in #2769 for #2768 after #2760 rewrote the method.
    Impact: Any session that still has v1-era keys (memory_messages / toolkit_activeGroups) but no new-format state loses its permission context on load.
    Severity: high

    The fix is to forward permCtx through the legacy load path (the same shape as #2886). Please ensure a regression test pins the legacy + permission-context combination.


    Automated evaluation by github-manager-bot

  2. added
    area/core/agent
    on Sep 14, 2026
  3. aiyili commented on Nov 27, 2026

    @aiyili
    Contributor

    The call site this regression lives in is still on 2.0.x (50886798): ReActAgent.loadOrCreateAgentStateForSlot calls the three-argument LegacyStateLoader.loadFromLegacySessionWithPresence(stateStore, userId, sessionId), so a session that only has v1 keys is reconstructed without the builder's permissionContext. main no longer has this call.

    I'd like to fix it on 2.0.x, with the same shape as #2886 / #3221 (the permCtx argument forwarded), plus a regression test that pins the legacy + permission-context combination through ReActAgent. LegacyStateLoaderTest covers the loader's four-argument overload, but nothing covers the caller.

    As far as I can tell from the code, the effect on 2.0.x is limited to the getAgentState(...) accessors: activateSlotForContext applies the builder's context again on the first activation of a slot, so a call() is not affected. I will confirm that with the test before opening the PR.

  4. aiyili commented on Nov 27, 2026

    @aiyili
    Contributor

    Opened #4452 against 2.0.x.

    The test confirmed what I wrote above: with the change, a session that only has v1 keys is reconstructed with the builder's context, mode and rules, where it was DEFAULT with no rules before. Two cases pass before and after and are there to bound the change: an existing state keeps its own context, and a call() applies the builder's context on first activation. So on 2.0.x the regression was visible through getAgentState(...), not through a call.

    The full agentscope-core suite has the same result before and after on Windows and in a Linux container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core/agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions