A conservative force only returns the energy back when the object moves in a closed path, that is, it returns to the initial position (it doesn't matter if he returns due to other forces). This can be demonstrated as a theorem, but the intuitive explanation is that a conservative force depends only on the spatial coordinates, and not in the direction of motion (such as friction), and thus eventually when the body moves back the field force is in the opposite directions and makes work of the opposite sign, such that in a closed loop the overall work of the field over the particle is zero. The additional property for a field is that this happens regardless of the path taken (that is, you do not need to go back to the original position using the same path you used when moving forward. This can be shown to be the case when the force is described as the gradient of a potential.
Update:
I reread your question and I realized that I didn't actually answer your specific question (I misinterpreted the question).
Let us start with the easy case: a mass attached to a spring. Here your body is the mass and the agent is the spring. Describing the mass
moving in a conservative field instead of describing it in terms of mutual forces is much easier, as we do not have to take into account
the details of the internal forces within the spring. The mass losses energy and this energy is stored in the spring, not in the mass.
However we can give an alternative description ignoring the spring and saying that the mass accumulated potential energy. This is very convenient,
but only if your are sure that the spring will always be attached to the mass (so you can describe the force from the spring as conservative). But if you cut the
spring when the mass is at rest, the mass will "suddenly lose" its potential energy (the force is no longer conservative), the energy was actually
in the spring an will be dissipated as heat (assuming the spring will eventually stop moving, as in a real spring).
In the case of long distance forces that cannot be switched off, such as gravity, the description is a little more complex. If you have a very large
mass as the agent, you can approximate it as not moving due to the reaction force from the object, and describe the object as moving in a potential
field where it stores potential energy. A more accurate description would be that the agent actually moves and gains this as kinetic energy (when the object moves "up",
the earth will follow it and also move up too so it gains kinetic energy). But this motion is so small that you do not take it into account in your description. For all practical purposes the
object sees the agent as being at rest. Of course, I am assuming that you can move the object with a force that doesn't interact with the agent, otherwise it is the same but this time
the agent might be storing the energy in some different way, however the details do not matter for all practical purposes.
Let's start with different scenarios that you could analyse. Work is, as you say, displacement times force in the direction of displacement. In the simplest scenario, where you have a nonvarying force and a nonvarying direction, this amounts to
$$ W=F\cdot s$$
If you consider two different scenarios, each with a work and a force, you have the calculations $W_1=F_1\cdot s_1$ and $W_2=F_2\cdot s_2$. Now, in principle, you could choose whatever paths and whatever forces you want - you could even try to fix $W_1$ or $W_2$ and see which paths lead to this answer. This gives you a number of different scenarios that you could analyse and I'll write down most of them:
- You fix work, consider two different forces and then consider paths.
- You fix paths and consider two different forces.
- You fix paths and work done and see which forces can be applied to obtain the work on the given path.
- You fix force and work and see which different paths can be taken.
- You fix the force and consider different paths.
- You fix the force and consider different paths between the same points.
Examples and Elaboration:
(Your) scenario: Now what you are doing is essentially a variant of the first one: You consider two different forces, $F_1$ which is upward and $F_2$ which is diagonal. You consider two different paths $s_1$ which is upward and $s_2$ which is diagonal. Now you have engineered your example in such a way that the work in both cases ($F_1$ along the path $s_1$ giving work $W_1$ and $F_2$ along the path $s_2$ giving work $W_2$) is the same. I call this "fix the work". Now what do you learn from such an example about forces and how they work? Absolutely nothing.
This is a physically nonsensical scenario. Why? When you consider work done in different force fields, there is absolutely no reason why the work should be the same - you have completely different scenarios. In fact, you can always just multiply one of the forces by some factor to make sure that the results differ. Another example? Well, let's take an arbitrary force $F_1$. It could be a field, it could be an upward force, whatever. Take an arbitrary work $F_2$, which is notably different from $F_1$. Take two paths, they could be curved, closed, whatever. Call them $s_1$ and $s_2$. Then, as you learned in the other answers, $W_1=\int F_1\cdot ds_1$ and $W_2=\int F_2\cdot ds_2$. There is no reason to expect that $W_1=W_2$ and indeed, if I randomly choose the fields and paths, this will never be the case. However, I can always multiply $F_2$ by $W_1/W_2$, creating a force $\tilde{F}_2=F_2\cdot W_1/W_2$ such that $\tilde{W}_2=W_1$. I could achieve this also by changing the paths. This is possible, because you have have an underdetermined system of equations - but it tells you absolutely nothing.
But that doesn't tell me anything, because it's hard to compare the two scenarios: It's like saying that if you go for a run in the mountains, it takes you the same amount of time as if you go to run at the lake. Oh, and by the way, you always go there by bus so the two paths start and end at different points. The two paths are completely different and it's just coincidental that you take the same time. Your time is maybe "path-independent", but only by coincidence. Maybe in winter, you suddenly take longer in the mountains because of the snow, maybe in spring, it takes longer to run around the lake, because there is a flood.
Scenarios 2 and 3: These are also not very interesting. Both of them could be reasonably applied to experimentally compare forces (the first more than the second) and if the forces are different, there is no reason to expect the work to be the same on two paths (once again, if they are the same, just multiply one force by some factor to make the work different again). From a theoretical perspective, of course, it suffices to have a look at the force field directly. In any case, these are not the scenarios when people talk about path-independence.
To give an example, you could fix a path and an object, e.g. an inclined plane of length $5m$ and inclination $45^\circ$ and you let the object slide down the plane on different surfaces (which creates different forces). By measuring the kinetic energy at the bottom, you can then calculate the work done by the friction forces. This is nice, but it has nothing to do with path-independence.
Scenario 4 and 5: These are also not very interesting. Once again, there is no reason to expect the forces to be the same if you measure work done on paths in completely different areas of the force field. For example, it takes more work to jump one metre high than it does to walk one metre horizontally if we only take gravity as our force and it's downward.
Last scenario: Finally, we have a look at the "real deal":
- You fix the force and consider different paths between the same points.
In other words: I fix a force (e.g. gravity), I fix a starting point (e.g. my basement) and an endpoint (e.g. my living room) and now I ask work has to be done to get some object (e.g. a sofa) from starting point to endpoint. The question is: Does this work depend on the path? Would it be better to go the direct way up the stairs and into the living room, or does it matter if take the detour and go via my bedroom in the second floor? If it doesn't matter, this is called path-independence. Since I always consider the same force field, I cannot simply multiply one of the forces by a factor to achieve that the work is not the same anymore. A priori, there is no reason to expect that the work done should be independent of the path I take, but it turns out that this is often the case!
This is the case if the force is convervative or in other words, if there is a potential defined everywhere and whose gradient is the force. This is the case for Newton's gravity or electromagnetism (mostly). It is however generally not the case for friction forces.
The reason why certain forces are path independent stems from the fundamental theorem of calculus: If a potential exists, integrating along a path is just the same as taking the difference of the potential at the endpoints.
Best Answer
the fault is in the assumption that work done on the box only goes towards gravitational potential energy. take note that if the applied force exceeds the weight of the box at any time, the box will accelerate and also attain kinetic energy.
assuming $g_{earth}$ = $10N/kg$, then the box never accelerates, and the full $ 20J$ work done goes into increases the box's potential energy.
assuming $g_{moon}$ = $1.6N/kg$, then by $W_{PE}\approx mgh$, $W_{PE}= 3.2J$. the "missing" $16.8J$ goes towards kinetic energy (this box is moving very fast by the time it reaches the top).
I'll leave it to you to confirm that the KE is indeed 16.8J. (hint $v^2=2as$, where $a=\frac{(10N-1.6N)}{1kg} $and $s=2m$